From 4268c1f1840349297a61e6972a61404f3f0e5e04 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 2 Jun 2017 22:54:18 +1200 Subject: Support text extra data for Alematics --- src/org/traccar/protocol/AlematicsProtocolDecoder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') 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; } -- cgit v1.2.3