添加广播方式升级
This commit is contained in:
@@ -43,17 +43,17 @@ bool codec_m4::recvByte(int byte)
|
||||
return fullFrame;
|
||||
}
|
||||
|
||||
bool codec_m4::packCheck(myarray data)
|
||||
int codec_m4::packCheck(myarray data)
|
||||
{
|
||||
if (data[0] != 0xff)
|
||||
{
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
if (data.size() >= 2 && (data.size() == (data[1] + 2)))
|
||||
if (data.size() >= 2 && (data.size() >= (data[1] + 2)))
|
||||
{
|
||||
return true;
|
||||
return data[1] + 2;
|
||||
}
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
myarray codec_m4::encode(int srcAddr, int dstAddr, int cmd, myarray data)
|
||||
@@ -66,6 +66,7 @@ myarray codec_m4::encode(int srcAddr, int dstAddr, int cmd, myarray data)
|
||||
}
|
||||
myarray codec_m4::decode(int &srcAddr, int &dstAddr, int &cmd, myarray data)
|
||||
{
|
||||
// qDebug("m4 recv:%s",data.toHex(' ').data());
|
||||
if (packCheck(data))
|
||||
{
|
||||
return data.mid(2);
|
||||
|
Reference in New Issue
Block a user