From 3fa2c036a5928ff85e584f1d05a1fa970f9b1a16 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 14 Sep 2016 02:25:52 +1200 Subject: Use IMEI for TK103 identification --- src/org/traccar/protocol/Tk103ProtocolDecoder.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') 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)"); + } } } -- cgit v1.2.3