00001 // Copyright (c) 2014, Pepperl+Fuchs GmbH, Mannheim 00002 // Copyright (c) 2014, Denis Dillenberger 00003 // All rights reserved. 00004 // 00005 // Use, modification, and distribution is subject to the 00006 // 3-clause BSD license ("Revised BSD License", 00007 // "New BSD License", or "Modified BSD License") 00008 // You should have received a copy of this license 00009 // in a file named COPYING or LICENSE. 00010 00011 #ifndef PACKET_STRUCTURE_H 00012 #define PACKET_STRUCTURE_H 00013 #include <cstdint> 00014 #include <vector> 00015 00016 namespace pepperl_fuchs { 00017 00018 #pragma pack(1) 00019 00020 00021 struct PacketHeader 00022 { 00024 std::uint16_t magic; 00025 00027 std::uint16_t packet_type; 00028 00030 std::uint32_t packet_size; 00031 00033 std::uint16_t header_size; 00034 00036 std::uint16_t scan_number; 00037 00039 std::uint16_t packet_number; 00040 00042 std::uint64_t timestamp_raw; 00043 00045 std::uint64_t timestamp_sync; 00046 00048 std::uint32_t status_flags; 00049 00051 std::uint32_t scan_frequency; 00052 00054 std::uint16_t num_points_scan; 00055 00057 std::uint16_t num_points_packet; 00058 00060 std::uint16_t first_index; 00061 00063 std::int32_t first_angle; 00064 00066 std::int32_t angular_increment; 00067 00069 std::uint32_t output_status; 00070 00072 std::uint32_t field_status; 00073 00075 //std::uint8 padding[0]; 00076 }; 00077 00080 struct PacketTypeC 00081 { 00082 PacketHeader header; 00083 std::uint32_t distance_amplitude_payload; // distance 20 bit, amplitude 12 bit 00084 }; 00085 #pragma pack() 00086 00089 struct ScanData 00090 { 00092 std::vector<std::uint32_t> distance_data; 00093 00095 std::vector<std::uint32_t> amplitude_data; 00096 00098 std::vector<PacketHeader> headers; 00099 }; 00100 00101 } 00102 00103 #endif // PACKET_STRUCTURE_H