update 电单车协议

This commit is contained in:
Guoqs
2024-08-29 15:10:41 +08:00
parent 45ff60f052
commit 896fa64e34
3 changed files with 39 additions and 3 deletions

View File

@@ -73,7 +73,7 @@ public abstract class AbsEBikeMessage {
// 读取物理ID
byte[] physicalIdBytes = Arrays.copyOfRange(messageBytes, 5, 9);
int physicalId = BytesUtil.bytesToIntLittle(physicalIdBytes);
int physicalId = BytesUtil.convertToPhysicalId(physicalIdBytes);
// 读取消息ID
byte[] messageIdBytes = Arrays.copyOfRange(messageBytes, 9, 11);

View File

@@ -84,8 +84,13 @@ public class EBikeMessageCmd21 extends AbsEBikeMessage {
statusList.add(PortStatusEnum.getDescriptionByValue(status));
}
this.portStatus = statusList;
this.rssi = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, dataBytes.length - 2, dataBytes.length - 1));
this.temperature = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, dataBytes.length - 1, dataBytes.length));
this.rssi = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, dataBytes.length - 2, dataBytes.length - 1)) + "";
//
int i = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, dataBytes.length - 1, dataBytes.length));
if (i > 65) {
i = i - 65;
}
this.temperature = i + "";
}
}