aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/HuabaoProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-20 22:29:15 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-20 22:29:15 -0800
commit81d4920ba7e45d762f7e276195b9b085e88249a4 (patch)
treefd483b8d0625604107f8ce8afcb1cfe7909389bd /src/org/traccar/protocol/HuabaoProtocolDecoder.java
parent13a59da88ee76b8d1f927284b98ef14949584252 (diff)
downloadtrackermap-server-81d4920ba7e45d762f7e276195b9b085e88249a4.tar.gz
trackermap-server-81d4920ba7e45d762f7e276195b9b085e88249a4.tar.bz2
trackermap-server-81d4920ba7e45d762f7e276195b9b085e88249a4.zip
Decode additional data
Diffstat (limited to 'src/org/traccar/protocol/HuabaoProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/HuabaoProtocolDecoder.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/org/traccar/protocol/HuabaoProtocolDecoder.java
index 2eb75a710..f5e73c1f9 100644
--- a/src/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -193,7 +193,24 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
.setSecond(BcdUtil.readInteger(buf, 2));
position.setTime(dateBuilder.getDate());
- // additional information
+ while (buf.readableBytes() > 2) {
+ int subtype = buf.readUnsignedByte();
+ int length = buf.readUnsignedByte();
+ switch (subtype) {
+ case 0x01:
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 100);
+ break;
+ case 0x30:
+ position.set(Position.KEY_RSSI, buf.readUnsignedByte());
+ break;
+ case 0x31:
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
+ break;
+ default:
+ buf.skipBytes(length);
+ break;
+ }
+ }
return position;
}