diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-08-24 13:03:56 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-08-24 13:03:56 +1200 |
commit | b35863ef77196a1ca060169df0c022eb25d99a7d (patch) | |
tree | f232c3a4aae540efe9c2262430fba3dedb36f2b7 /src/org/traccar/protocol | |
parent | 61d7f40251ead2c3b7bd5525fd0a3602b23a21e8 (diff) | |
download | trackermap-server-b35863ef77196a1ca060169df0c022eb25d99a7d.tar.gz trackermap-server-b35863ef77196a1ca060169df0c022eb25d99a7d.tar.bz2 trackermap-server-b35863ef77196a1ca060169df0c022eb25d99a7d.zip |
Send TK102 response
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/Tk102ProtocolDecoder.java | 12 |
1 files changed, 11 insertions, 1 deletions
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) { |