aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-06-02 22:54:18 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-06-02 22:54:18 +1200
commit4268c1f1840349297a61e6972a61404f3f0e5e04 (patch)
treef02ac8c5f0d02fae86afa241ea0a29196ef34f0f /src/org/traccar/protocol
parentece4c0e07827f001f998190eaa9fc9522ecb38ac (diff)
downloadtrackermap-server-4268c1f1840349297a61e6972a61404f3f0e5e04.tar.gz
trackermap-server-4268c1f1840349297a61e6972a61404f3f0e5e04.tar.bz2
trackermap-server-4268c1f1840349297a61e6972a61404f3f0e5e04.zip
Support text extra data for Alematics
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/AlematicsProtocolDecoder.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/AlematicsProtocolDecoder.java b/src/org/traccar/protocol/AlematicsProtocolDecoder.java
index 47d31b7a7..da0704242 100644
--- a/src/org/traccar/protocol/AlematicsProtocolDecoder.java
+++ b/src/org/traccar/protocol/AlematicsProtocolDecoder.java
@@ -54,8 +54,13 @@ public class AlematicsProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.d+),") // adc
.number("(d+.d+),") // power
.number("(d+),") // odometer
+ .groupBegin()
+ .text("0,$S,")
+ .expression("(.*)") // text message
+ .or()
.number("(d+),") // extra mask
.expression("(.*)") // extra data
+ .groupEnd()
.compile();
private void decodeExtras(Position position, Parser parser) {
@@ -138,7 +143,11 @@ public class AlematicsProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_POWER, parser.nextDouble());
position.set(Position.KEY_ODOMETER, parser.nextInt());
- decodeExtras(position, parser);
+ if (parser.hasNext()) {
+ position.set("text", parser.next());
+ } else {
+ decodeExtras(position, parser);
+ }
return position;
}