aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/TelicProtocolDecoder.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/TelicProtocolDecoder.java b/src/org/traccar/protocol/TelicProtocolDecoder.java
index bbd4b0574..8207e5956 100644
--- a/src/org/traccar/protocol/TelicProtocolDecoder.java
+++ b/src/org/traccar/protocol/TelicProtocolDecoder.java
@@ -54,7 +54,7 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder {
.expression("(?:[^,]*,){7}")
.number("(d+),") // battery
.expression("[^,]*,")
- .number("(d+)") // external
+ .number("(d+)?") // external
.any()
.compile();
@@ -83,6 +83,8 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder {
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+ org.traccar.helper.PatternUtil.MatchResult matchResult =
+ org.traccar.helper.PatternUtil.checkPattern(PATTERN.pattern(), (String) msg);
Parser parser = new Parser(PATTERN, (String) msg);
if (!parser.matches()) {
@@ -130,7 +132,10 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder {
}
position.set(Position.KEY_BATTERY, parser.nextInt());
- position.set(Position.KEY_POWER, parser.nextInt());
+
+ if (parser.hasNext()) {
+ position.set(Position.KEY_POWER, parser.nextInt());
+ }
return position;
}