aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorLeonhard Heizinger <leonhard.heizinger@ur.de>2019-04-10 09:54:54 +0200
committerLeonhard Heizinger <leonhard.heizinger@ur.de>2019-04-10 09:54:54 +0200
commit25cbe0ed501319dbb23cc260817a797df5be9fb6 (patch)
treea544dd74eafd889627613ec5668e8d479116f5b1 /src/main
parent22436a2434faa8912c8a352e65306d0dc0669b5c (diff)
parentd701e4cd549e99c594a7ddf41359b59f34ad2cff (diff)
downloadtraccar-server-25cbe0ed501319dbb23cc260817a797df5be9fb6.tar.gz
traccar-server-25cbe0ed501319dbb23cc260817a797df5be9fb6.tar.bz2
traccar-server-25cbe0ed501319dbb23cc260817a797df5be9fb6.zip
Merge branch 'master' of https://github.com/he-leon/traccar
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java
index 9e28b5051..feedb2c5e 100644
--- a/src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2019 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.
@@ -44,7 +44,11 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN = new PatternBuilder()
.text("(").optional()
- .number("(d+)(,)?") // device id
+ .groupBegin()
+ .expression("(.{12})") // device id
+ .or()
+ .expression("(.+),") // device id
+ .groupEnd()
.expression("(.{4}),?") // command
.number("(d*)")
.number("(dd)(dd)(dd),?") // date (mmddyy if comma-delimited, otherwise yyddmm)
@@ -371,7 +375,17 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
+ String id = null;
+ boolean alternative = false;
+ if (parser.hasNext()) {
+ id = parser.next();
+ }
+ if (parser.hasNext()) {
+ id = parser.next();
+ alternative = true;
+ }
+
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);
if (deviceSession == null) {
return null;
}
@@ -379,8 +393,6 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
- boolean alternative = parser.next() != null;
-
decodeType(position, parser.next(), parser.next());
DateBuilder dateBuilder = new DateBuilder();