aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Tk103ProtocolDecoder.java
diff options
context:
space:
mode:
authorduke2906 <philipp.prangenberg@gmail.com>2016-09-26 15:09:20 +0200
committerGitHub <noreply@github.com>2016-09-26 15:09:20 +0200
commit960bf899414d89221e92138fdb98777c3f4f73ec (patch)
tree87f5fd96185aa5f2fff0f84e2e2fa8be379ee837 /src/org/traccar/protocol/Tk103ProtocolDecoder.java
parent0d3c05a24992eeeba02032e474d3a9bbb3239f10 (diff)
parentaaec58aec04256845dc37afd713b488071b1406b (diff)
downloadtrackermap-server-960bf899414d89221e92138fdb98777c3f4f73ec.tar.gz
trackermap-server-960bf899414d89221e92138fdb98777c3f4f73ec.tar.bz2
trackermap-server-960bf899414d89221e92138fdb98777c3f4f73ec.zip
Merge pull request #1 from tananaev/master
Update Changes, including version 3.7
Diffstat (limited to 'src/org/traccar/protocol/Tk103ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 90c80be71..c638e7f27 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -78,20 +78,20 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
private String decodeAlarm(int value) {
switch (value) {
- case 1:
- return Position.ALARM_ACCIDENT;
- case 2:
- return Position.ALARM_SOS;
- case 3:
- return Position.ALARM_VIBRATION;
- case 4:
- return Position.ALARM_LOW_SPEED;
- case 5:
- return Position.ALARM_OVERSPEED;
- case 6:
- return Position.ALARM_GEOFENCE_EXIT;
- default:
- return null;
+ case 1:
+ return Position.ALARM_ACCIDENT;
+ case 2:
+ return Position.ALARM_SOS;
+ case 3:
+ return Position.ALARM_VIBRATION;
+ case 4:
+ return Position.ALARM_LOW_SPEED;
+ case 5:
+ return Position.ALARM_OVERSPEED;
+ case 6:
+ return Position.ALARM_GEOFENCE_EXIT;
+ default:
+ return null;
}
}
@@ -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)");
+ }
}
}