aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-04-23 06:10:45 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-04-23 06:10:45 +1200
commit9175e41b2ceab18df2d46dd67c90fcd52a720547 (patch)
tree33c4dda1ce512243276233fc4fb87624680fd4a3 /src/org
parent61dda68755cee73b1ddf18d0f4f37d434b2a3a45 (diff)
downloadtrackermap-server-9175e41b2ceab18df2d46dd67c90fcd52a720547.tar.gz
trackermap-server-9175e41b2ceab18df2d46dd67c90fcd52a720547.tar.bz2
trackermap-server-9175e41b2ceab18df2d46dd67c90fcd52a720547.zip
Implement eSky ES320 and E321 protocols
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/EskyProtocolDecoder.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/org/traccar/protocol/EskyProtocolDecoder.java b/src/org/traccar/protocol/EskyProtocolDecoder.java
index 60ef4f846..bf790541b 100644
--- a/src/org/traccar/protocol/EskyProtocolDecoder.java
+++ b/src/org/traccar/protocol/EskyProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2018 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.
@@ -37,16 +37,18 @@ public class EskyProtocolDecoder extends BaseProtocolDecoder {
.number("d+;") // index
.number("(d+);") // imei
.text("R;") // data type
- .number("(d+)").text("+") // satellites
+ .number("(d+)[+;]") // satellites
.number("(dd)(dd)(dd)") // date
- .number("(dd)(dd)(dd)").text("+") // time
- .number("(-?d+.d+)").text("+") // latitude
- .number("(-?d+.d+)").text("+") // longitude
- .number("(d+.d+)").text("+") // speed
- .number("(d+)").text("+") // course
- .text("0x").number("(d+)").text("+") // input
- .number("(d+)").text("+") // message type
- .number("(d+)").text("+") // odometer
+ .number("(dd)(dd)(dd)[+;]") // time
+ .number("(-?d+.d+)[+;]") // latitude
+ .number("(-?d+.d+)[+;]") // longitude
+ .number("(d+.d+)[+;]") // speed
+ .number("(d+)[+;]") // course
+ .groupBegin()
+ .text("0x").number("(d+)[+;]") // input
+ .number("(d+)[+;]") // message type
+ .number("(d+)[+;]") // odometer
+ .groupEnd("?")
.number("(d+)") // voltage
.any()
.compile();
@@ -77,10 +79,13 @@ public class EskyProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromMps(parser.nextDouble()));
position.setCourse(parser.nextDouble());
- position.set(Position.KEY_INPUT, parser.nextHexInt());
- position.set(Position.KEY_EVENT, parser.nextInt());
- position.set(Position.KEY_ODOMETER, parser.nextInt());
- position.set(Position.KEY_POWER, parser.nextInt());
+ if (parser.hasNext(3)) {
+ position.set(Position.KEY_INPUT, parser.nextHexInt());
+ position.set(Position.KEY_EVENT, parser.nextInt());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
+ }
+
+ position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);
return position;
}