24 #ifndef HDLCD_CLIENT_DESTROY_H 25 #define HDLCD_CLIENT_DESTROY_H 34 l_HdlcdClientDestroy.m_SerialPortNbr = a_SerialPortNbr;
35 return l_HdlcdClientDestroy;
39 auto l_HdlcdClientDestroy(std::shared_ptr<HdlcdClientDestroy>(
new HdlcdClientDestroy));
40 l_HdlcdClientDestroy->m_eDeserialize = DESERIALIZE_BODY;
41 l_HdlcdClientDestroy->m_BytesRemaining = 3;
42 return l_HdlcdClientDestroy;
47 assert(m_eDeserialize == DESERIALIZE_FULL);
48 return m_SerialPortNbr;
60 const std::vector<unsigned char> Serialize()
const {
61 assert(m_eDeserialize == DESERIALIZE_FULL);
62 std::vector<unsigned char> l_Buffer;
64 l_Buffer.emplace_back((m_SerialPortNbr >> 8) & 0xFF);
65 l_Buffer.emplace_back((m_SerialPortNbr >> 0) & 0xFF);
72 switch (m_eDeserialize) {
73 case DESERIALIZE_BODY: {
77 m_SerialPortNbr = ntohs(*(reinterpret_cast<const uint16_t*>(&
m_Buffer[1])));
78 m_eDeserialize = DESERIALIZE_FULL;
81 case DESERIALIZE_ERROR:
82 case DESERIALIZE_FULL:
92 uint16_t m_SerialPortNbr;
94 DESERIALIZE_ERROR = 0,
98 E_DESERIALIZE m_eDeserialize;
101 #endif // HDLCD_CLIENT_DESTROY_H
static HdlcdClientDestroy Create(uint16_t a_SerialPortNbr)
uint16_t GetSerialPortNbr() const
std::vector< unsigned char > m_Buffer
The buffer containing partly received frames or higher-layer payload.
static std::shared_ptr< HdlcdClientDestroy > CreateDeserializedFrame()