Debian Codegraph @

3rdparty/rplidar_sdk/sdk/src/dataunpacker/unpacker/handler_capsules.h

raw symbols SCIP
1 /*
2 * Slamtec LIDAR SDK
3 *
4 * Copyright (c) 2014 - 2023 Shanghai Slamtec Co., Ltd.
5 * http://www.slamtec.com
6 *
7 */
8
9 /*
10 * Sample Data Unpacker System
11 * Capsule Style Sample Node Handlers
12 */
13
14 /*
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions are met:
17 *
18 * 1. Redistributions of source code must retain the above copyright notice,
19 * this list of conditions and the following disclaimer.
20 *
21 * 2. Redistributions in binary form must reproduce the above copyright notice,
22 * this list of conditions and the following disclaimer in the documentation
23 * and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 */
38
39 #pragma once
40
41 BEGIN_DATAUNPACKER_NS()
42
43 namespace unpacker {
44
45 class UnpackerHandler_CapsuleNode : public IDataUnpackerHandler {
46 public:
47 UnpackerHandler_CapsuleNode();
48 virtual ~UnpackerHandler_CapsuleNode();
49
50 virtual _u8 getSampleAnswerType() const;
51 virtual void onData(LIDARSampleDataUnpackerInner* engine, const _u8* data, size_t size);
52 virtual void reset();
53 virtual void onUnpackerContextSet(LIDARSampleDataUnpacker::UnpackerContextType type, const void* data, size_t size);
54 protected:
55
56 void _onScanNodeCapsuleData(rplidar_response_capsule_measurement_nodes_t &, LIDARSampleDataUnpackerInner* engine);
57
58 std::vector<_u8> _cached_scan_node_buf;
59 int _cached_scan_node_buf_pos;
60 bool _is_previous_capsuledataRdy;
61
62 rplidar_response_capsule_measurement_nodes_t _cached_previous_capsuledata;
63 _u64 _cached_last_data_timestamp_us;
64
65 SlamtecLidarTimingDesc _cachedTimingDesc;
66 };
67
68 class UnpackerHandler_UltraCapsuleNode : public IDataUnpackerHandler {
69 public:
70 UnpackerHandler_UltraCapsuleNode();
71 virtual ~UnpackerHandler_UltraCapsuleNode();
72
73 virtual _u8 getSampleAnswerType() const;
74 virtual void onData(LIDARSampleDataUnpackerInner* engine, const _u8* data, size_t size);
75 virtual void reset();
76 virtual void onUnpackerContextSet(LIDARSampleDataUnpacker::UnpackerContextType type, const void* data, size_t size);
77 protected:
78 void _onScanNodeUltraCapsuleData(rplidar_response_ultra_capsule_measurement_nodes_t&, LIDARSampleDataUnpackerInner* engine);
79
80
81 std::vector<_u8> _cached_scan_node_buf;
82 int _cached_scan_node_buf_pos;
83 bool _is_previous_capsuledataRdy;
84
85 rplidar_response_ultra_capsule_measurement_nodes_t _cached_previous_ultracapsuledata;
86 _u64 _cached_last_data_timestamp_us;
87
88 SlamtecLidarTimingDesc _cachedTimingDesc;
89
90 };
91
92
93
94 class UnpackerHandler_DenseCapsuleNode : public IDataUnpackerHandler {
95 public:
96 UnpackerHandler_DenseCapsuleNode();
97 virtual ~UnpackerHandler_DenseCapsuleNode();
98
99 virtual _u8 getSampleAnswerType() const;
100 virtual void onData(LIDARSampleDataUnpackerInner* engine, const _u8* data, size_t size);
101 virtual void reset();
102 virtual void onUnpackerContextSet(LIDARSampleDataUnpacker::UnpackerContextType type, const void* data, size_t size);
103 protected:
104 void _onScanNodeDenseCapsuleData(rplidar_response_dense_capsule_measurement_nodes_t&, LIDARSampleDataUnpackerInner* engine);
105
106
107 std::vector<_u8> _cached_scan_node_buf;
108 int _cached_scan_node_buf_pos;
109 bool _is_previous_capsuledataRdy;
110
111 rplidar_response_dense_capsule_measurement_nodes_t _cached_previous_dense_capsuledata;
112 _u64 _cached_last_data_timestamp_us;
113
114 SlamtecLidarTimingDesc _cachedTimingDesc;
115
116 };
117
118
119 class UnpackerHandler_UltraDenseCapsuleNode : public IDataUnpackerHandler {
120 public:
121 UnpackerHandler_UltraDenseCapsuleNode();
122 virtual ~UnpackerHandler_UltraDenseCapsuleNode();
123
124 virtual _u8 getSampleAnswerType() const;
125 virtual void onData(LIDARSampleDataUnpackerInner* engine, const _u8* data, size_t size);
126 virtual void reset();
127 virtual void onUnpackerContextSet(LIDARSampleDataUnpacker::UnpackerContextType type, const void* data, size_t size);
128 protected:
129 void _onScanNodeUltraDenseCapsuleData(rplidar_response_ultra_dense_capsule_measurement_nodes_t&, LIDARSampleDataUnpackerInner* engine);
130
131 std::vector<_u8> _cached_scan_node_buf;
132 int _cached_scan_node_buf_pos;
133 bool _is_previous_capsuledataRdy;
134
135 rplidar_response_ultra_dense_capsule_measurement_nodes_t _cached_previous_ultra_dense_capsuledata;
136 _u64 _cached_last_data_timestamp_us;
137
138
139
140 int _last_node_sync_bit;
141 int _last_dist_q2;
142
143 SlamtecLidarTimingDesc _cachedTimingDesc;
144 };
145
146
147 }
148
149 END_DATAUNPACKER_NS()