7 #ifndef IFM3D_DESERIALIZE_STRUCT_TOF_INFO_V4_HPP
8 #define IFM3D_DESERIALIZE_STRUCT_TOF_INFO_V4_HPP
10 #include <ifm3d/deserialize/deserialize_utils.hpp>
11 #include <ifm3d/deserialize/struct_tof_info_v3.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 TOF_INFO_MEASUREMENT_BLOCK_INDEX = 0x01A0;
22 constexpr
auto TOF_INFO_MEASUREMENT_RANGE_MIN_INDEX = 0x01A4;
23 constexpr
auto TOF_INFO_MEASUREMENT_RANGE_MAX_INDEX = 0x01A8;
30 using Ptr = std::shared_ptr<TOFInfoV4>;
33 IsValid(
const uint8_t* data,
size_t size)
35 auto version = mkval<std::uint32_t>(data + TOF_INFO_VERSION_INDEX);
41 Read(
const uint8_t* data,
size_t size)
43 if (!IsValid(data, size))
48 TOFInfoV3::Read(data, size);
49 const uint8_t* start_ptr = data;
51 mkval<std::uint32_t>(start_ptr + TOF_INFO_MEASUREMENT_BLOCK_INDEX);
52 measurement_range_min =
53 mkval<float>(start_ptr + TOF_INFO_MEASUREMENT_RANGE_MIN_INDEX);
54 measurement_range_max =
55 mkval<float>(start_ptr + TOF_INFO_MEASUREMENT_RANGE_MAX_INDEX);
68 float measurement_range_min{};
74 float measurement_range_max{};
81 Deserialize(
const Buffer& tof_info_buffer)
85 tof_info_v4.Read(tof_info_buffer.
Ptr<uint8_t>(0),
86 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_tof_info_v3.hpp:39
Definition: struct_tof_info_v4.hpp:28
uint32_t measurement_block_index
Current measurement block index (range 0 to N-1, where N is the number of sub-modes).
Definition: struct_tof_info_v4.hpp:62
static constexpr size_t TOF_INFO_V4_SIZE
size of ToFInfoV4 in bytes
Definition: struct_tof_info_v4.hpp:78