Version FC
Dependencies: DmTftLibrary eeprom SX1280Lib filesystem mbed
Fork of MSNV2-Terminal_V1-5 by
Diff: ControlMessagePart.hpp
- Revision:
- 24:92c30dabfda4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ControlMessagePart.hpp Tue Sep 11 21:45:52 2018 +0000 @@ -0,0 +1,44 @@ +#ifndef __CONTROLMESSAGEPART_HPP__ +#define __CONTROLMESSAGEPART_HPP__ + +#include <string> + +#include "Context.h" + +#ifdef TEST_ENVIRONMENT +#include <cstdint> +#else +#include <stdint.h> +#endif + + +namespace misnet { + class ControlMessagePart; +} + + +class misnet::ControlMessagePart { + public: + // Data frame type + enum DATA_FRAME_TYPE { + CONFIG = 0, + IOT = 1, + SYNC = 2 + }; + + ControlMessagePart(DATA_FRAME_TYPE data_frame_type, uint16_t payload_module_id, uint16_t ack_value); + + std::string serialize(); // Returns a string that represents the control data to be sent to gateway + + private: + static const uint16_t PAYLOAD_MODULE_ID_MASK = 0x3FFF; + static const uint16_t ACKNOWLEDGE_VALUE_MASK = 0xFFF; + + uint32_t _control_part_info; // Aggregation of data frame type, payload module id and acknowledge value + uint8_t _data_frame_type; // Data frame type + uint16_t _payload_module_id; // Payload module identification + uint16_t _acknowledge_value; // Acknowledge value + uint32_t _message_integrity_code; // Message Authentication Code +}; + +#endif // __CONTROLMESSAGEPART_HPP__