aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-09-14 02:25:52 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-09-14 02:25:52 +1200
commit3fa2c036a5928ff85e584f1d05a1fa970f9b1a16 (patch)
tree6197753f8f94ad82039286a51f5fe2cfe7517876 /src
parent497627bc9fc7ab9330295ba463b50f4085b6be9b (diff)
downloadtraccar-server-3fa2c036a5928ff85e584f1d05a1fa970f9b1a16.tar.gz
traccar-server-3fa2c036a5928ff85e584f1d05a1fa970f9b1a16.tar.bz2
traccar-server-3fa2c036a5928ff85e584f1d05a1fa970f9b1a16.zip
Use IMEI for TK103 identification
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 90c80be71..7b3f44d33 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -111,11 +111,15 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
String id = sentence.substring(0, 12);
String type = sentence.substring(12, 16);
- if (type.equals("BP00")) {
- String content = sentence.substring(sentence.length() - 3);
- channel.write("(" + id + "AP01" + content + ")");
- } else if (type.equals("BP05")) {
- channel.write("(" + id + "AP05)");
+ if (type.equals("BP00") || type.equals("BP05")) {
+ String content = sentence.substring(16);
+ getDeviceSession(channel, remoteAddress, content.substring(0, 15));
+ if (type.equals("BP00")) {
+ channel.write("(" + id + "AP01" + content.substring(15) + ")");
+ return null;
+ } else if (type.equals("BP05")) {
+ channel.write("(" + id + "AP05)");
+ }
}
}