|
@@ -38,7 +38,7 @@ public:
|
|
|
int32_t Deserialization(uint8_t *data, int length)
|
|
|
{
|
|
|
// 检查数据头尾
|
|
|
- if(data[0] != PIDS_DATA_HEAD || data[length] != PIDS_DATA_END) {
|
|
|
+ if(data[0] != PIDS_DATA_HEAD || data[length-1] != PIDS_DATA_END) {
|
|
|
ErrorL << "Incorrect data head and tail";
|
|
|
return ERR;
|
|
|
}
|
|
@@ -47,10 +47,11 @@ public:
|
|
|
|
|
|
// 检查数据校验位
|
|
|
int16_t crc = Crc16::GetCRC16(data, 9, DataLength);
|
|
|
- if((data[length-2] != (crc & 0xFF00)) >> 8 || (data[length-1] != crc & 0x00FF)){
|
|
|
+
|
|
|
+ if(data[length-3] != ((crc & 0xFF00) >> 8) || data[length-2] != (crc & 0x00FF)){
|
|
|
ErrorL << "Incorrect data check digit";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 数据校验通过提取数据
|
|
|
this->CurrentSite = data[9];
|
|
|
this->NextSite = data[10];
|