update 电单车协议

This commit is contained in:
Guoqs
2024-08-30 15:35:29 +08:00
parent 4080cc4675
commit 5920cf0e18
3 changed files with 91 additions and 20 deletions

View File

@@ -62,6 +62,8 @@ public class EBikeMessageCmd21 extends AbsEBikeMessage {
*/
private List<String> portStatus;
private List<String> statusDescList;
/**
* 信号强度指分机与主机之间的无线信号强度如LORA信号。00则为有线组网或无信号强度功能
*/
@@ -79,11 +81,14 @@ public class EBikeMessageCmd21 extends AbsEBikeMessage {
byte[] statusBytes = BytesUtil.copyBytes(dataBytes, 3, this.portNumber);
List<String> statusList = Lists.newArrayList();
List<String> statusDescList = Lists.newArrayList();
for (byte statusByte : statusBytes) {
int status = BytesUtil.bytesToIntLittle(new byte[]{statusByte});
statusList.add(PortStatusEnum.getDescriptionByValue(status));
statusList.add(String.valueOf(status));
statusDescList.add(PortStatusEnum.getDescriptionByValue(status));
}
this.portStatus = statusList;
this.statusDescList = statusDescList;
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));