#ifndef _TELEMETRY_HPP_ #define _TELEMETRY_HPP_ 1 #if __cplusplus < 201103L #include #define static_assert BOOST_STATIC_ASSERT #endif #include "tx01_endian.hpp" #define TX01_MSG_HEADER_MAGIC 1234567890 #define TX01_MSG_POSTAMBLE -1234567890 struct tx01_msg_header { // should be MSG_HEADER_MAGIC big_int32_t magic; // size of the message (including header and postamble) big_int32_t size; // user configurable for flow identification big_int32_t flow; }; static_assert(sizeof(struct tx01_msg_header) == 12); struct tx01_data_msg { struct tx01_msg_header header; big_int32_t time_tag_1; big_int32_t time_tag_2; big_uint32_t seq_counter; big_int32_t frame_check_result; big_int32_t frame_sync_stat; big_int32_t bit_slip_stat; big_int32_t tm_delay; big_int32_t frame_len; big_int32_t sync_word_len; big_int32_t frame_check_rs_stat; big_int32_t data_fmt; big_int32_t _unused0; big_int32_t _unused1; char data[]; }; static_assert(sizeof(struct tx01_data_msg) == 64); /* Try to match a tx01_msg_header at ptr. If success, return a pointer * to this tx01_msg_header. Otherwise return NULL. */ extern const struct tx01_msg_header * tx01_try_match_msg_header(const char *ptr); extern const struct tx01_data_msg * tx01_try_match_data_msg(const struct tx01_msg_header *ptr); #undef _STATIC_ASSERT #undef _CAT2 #undef _CAT #endif