aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-09-10 16:53:41 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-09-10 16:53:41 +1200
commitae30beb0b049c0dc84d337adbffe68703f7d6e61 (patch)
tree788ce08e38d5533c9f04e9f5d88485e4cf073ff0 /src/org/traccar/protocol
parentb27ab90540402836b64e2eb634c37dcab7aa6608 (diff)
downloadtraccar-server-ae30beb0b049c0dc84d337adbffe68703f7d6e61.tar.gz
traccar-server-ae30beb0b049c0dc84d337adbffe68703f7d6e61.tar.bz2
traccar-server-ae30beb0b049c0dc84d337adbffe68703f7d6e61.zip
Support Prime 07 protocol
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index 64c45a22f..9603200ab 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -107,10 +107,18 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
+ boolean longId = buf.readableBytes() == 42;
+
buf.readByte(); // marker
- DeviceSession deviceSession = getDeviceSession(
- channel, remoteAddress, ByteBufUtil.hexDump(buf.readSlice(5)));
+ String id;
+ if (longId) {
+ id = ByteBufUtil.hexDump(buf.readSlice(8)).substring(0, 15);
+ } else {
+ id = ByteBufUtil.hexDump(buf.readSlice(5));
+ }
+
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);
if (deviceSession == null) {
return null;
}
@@ -183,6 +191,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
.expression("([EW]),")
.number("(d+.?d*),") // speed
.number("(d+.?d*)?,") // course
+ .number("(?:d+,)?") // battery
.number("(?:(dd)(dd)(dd))?") // date (ddmmyy)
.groupBegin()
.expression(",[^,]*,")