7 #ifndef IFM3D_DESERIALIZE_STRUCT_O3R__ODS_INFO_V1_HPP
8 #define IFM3D_DESERIALIZE_STRUCT_O3R__ODS_INFO_V1_HPP
11 #include <ifm3d/deserialize/deserialize_utils.hpp>
12 #include <ifm3d/device/device.h>
13 #include <ifm3d/device/err.h>
14 #include <ifm3d/fg/buffer.h>
15 #include <ifm3d/fg/organizer_utils.h>
21 constexpr
auto ODS_INFO_TIMESTAMP_NS_INDEX = 0x0000;
22 constexpr
auto ODS_INFO_ZONE_OCCUPIED_INDEX = 0x0008;
23 constexpr
auto ODS_INFO_ZONE_CONFIG_ID_INDEX = 0x000B;
30 using Ptr = std::shared_ptr<ODSInfoV1>;
33 IsValid(
const uint8_t*,
size_t size)
35 return size >= ODS_INFO_V1_SIZE;
39 Read(
const uint8_t* data,
size_t size)
41 if (!IsValid(data, size))
45 const uint8_t* start_ptr = data;
47 mkval<std::uint64_t>(start_ptr + ODS_INFO_TIMESTAMP_NS_INDEX);
48 mkarray<uint8_t, 3>(start_ptr + ODS_INFO_ZONE_OCCUPIED_INDEX,
51 mkval<uint32_t>(start_ptr + ODS_INFO_ZONE_CONFIG_ID_INDEX);
54 uint64_t timestamp_ns;
60 std::array<uint8_t, 3> zone_occupied;
64 uint32_t zone_config_id;
68 static constexpr
size_t ODS_INFO_V1_SIZE = 15;
71 Deserialize(
const Buffer& tof_info_buffer)
75 ods_info_v1.Read(tof_info_buffer.
Ptr<uint8_t>(0),
76 tof_info_buffer.
Size());
The class Buffer represent a STL container to store data from the ifm devices in 2 dimension and supp...
Definition: buffer.h:99
T * Ptr(std::uint32_t row)
returns a pointer to the specified Buffer row.
size_t Size() const
Return the size of the buffer in bytes.
Exception wrapper for library and system errors encountered by the library.
Definition: err.h:115
Definition: struct_o3r_ods_info_v1.hpp:28