1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/examples/qqtnetworkexample/qqtserialmessage.h
tianduanrui e3a0357214 update
2018-04-30 10:25:29 +08:00

47 lines
1.1 KiB
C++

#ifndef QQTSERIALMESSAGE_H
#define QQTSERIALMESSAGE_H
#include "qqtmessage.h"
#define _SERIAL_HEAD 0xAA55
#define _SERIAL_TAIL 0xCC33
class QQTSerialMessage : public QQtMessage
{
public:
explicit QQTSerialMessage ( QObject* parent = 0 );
const quint16& head() const;
void setHead ( quint16 head );
const quint16& size() const;
void setSize ( quint16 size );
//user
const quint16& cmd() const;
void setCmd ( quint16 cmd );
//user
const QByteArray& data() const;
void setData ( QByteArray& data );
const quint16& sum() const;
void setSum ( quint16 sum );
const quint16& tail() const;
void setTail ( quint16 tail );
void translate();
// QQTSyntax interface
public:
void parser ( const QByteArray& l ) override;
void packer ( QByteArray& l ) const override;
private:
quint16 m_Head;
quint16 m_Size;
quint16 m_Cmd;
QByteArray m_Data;
quint16 m_Sum;
quint16 m_Tail;
};
QDebug operator<< ( QDebug dbg, const QQTSerialMessage& c );
#endif // QQTSERIALMESSAGE_H