aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/Tk102ProtocolDecoder.java12
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) {