From b35863ef77196a1ca060169df0c022eb25d99a7d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 24 Aug 2013 13:03:56 +1200 Subject: Send TK102 response --- src/org/traccar/protocol/Tk102ProtocolDecoder.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/Tk102ProtocolDecoder.java b/src/org/traccar/protocol/Tk102ProtocolDecoder.java index 820aaee11..7250db67b 100644 --- a/src/org/traccar/protocol/Tk102ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk102ProtocolDecoder.java @@ -54,16 +54,26 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder { String sentence = (String) msg; - // Detect device identifier + // Login if (sentence.startsWith("[!")) { String imei = sentence.substring(14, 14 + 15); try { deviceId = getDataManager().getDeviceByImei(imei).getId(); } catch(Exception error) { Log.warning("Unknown device - " + imei); + return null; + } + + if (channel != null) { + channel.write("[”0000000001" + sentence.substring(13) + "]"); } } + // Quit + else if (sentence.startsWith("[#")) { + // TODO: Send response + } + // Parse message else if (deviceId != null) { -- cgit v1.2.3