添加一些基本类
This commit is contained in:
34
interface/codec.h
Normal file
34
interface/codec.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef CODEC_H
|
||||
#define CODEC_H
|
||||
|
||||
#include "QObject"
|
||||
#include "base/base.h"
|
||||
|
||||
class Codec : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Codec()
|
||||
{
|
||||
fullFrame = false;
|
||||
}
|
||||
virtual ~Codec() {}
|
||||
virtual myarray encode(int srcAddr, int dstAddr, int cmd, myarray data) = 0;
|
||||
virtual myarray decode(int &srcAddr, int &dstAddr, int &cmd, myarray data) = 0;
|
||||
virtual myarray decode(int &srcAddr, int &dstAddr, int &cmd)
|
||||
{
|
||||
if (fullFrame == true)
|
||||
{
|
||||
fullFrame = false;
|
||||
return decode(srcAddr, dstAddr, cmd, data);
|
||||
}
|
||||
return myarray();
|
||||
}
|
||||
virtual bool recvByte(int byte) = 0;
|
||||
|
||||
protected:
|
||||
bool fullFrame;
|
||||
myarray data;
|
||||
};
|
||||
|
||||
#endif // CODEC_H
|
Reference in New Issue
Block a user