aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-07-15 11:41:44 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-07-15 11:41:58 +1200
commit1b4bcb2cef3f4e3907ed0820478f2f3cae245c7f (patch)
treefcb811adeb45e35bfdfcf69dd28e72649cb85e47
parent26f1cf12867d6f8bfe86d562a3beecb590b3a9b5 (diff)
downloadtrackermap-server-1b4bcb2cef3f4e3907ed0820478f2f3cae245c7f.tar.gz
trackermap-server-1b4bcb2cef3f4e3907ed0820478f2f3cae245c7f.tar.bz2
trackermap-server-1b4bcb2cef3f4e3907ed0820478f2f3cae245c7f.zip
Fix TK103 identification issue
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java16
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolDecoderTest.java3
2 files changed, 8 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 4c7da12e0..0106e5bf3 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -200,17 +200,11 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
String id = sentence.substring(0, 12);
String type = sentence.substring(12, 16);
- if (type.equals("BP00") || type.equals("BP05")) {
- String content = sentence.substring(16);
- if (content.length() >= 15) {
- getDeviceSession(channel, remoteAddress, content.substring(0, 15));
- }
- if (type.equals("BP00")) {
- channel.write("(" + id + "AP01HSO)");
- return null;
- } else if (type.equals("BP05")) {
- channel.write("(" + id + "AP05)");
- }
+ if (type.equals("BP00")) {
+ channel.write("(" + id + "AP01HSO)");
+ return null;
+ } else if (type.equals("BP05")) {
+ channel.write("(" + id + "AP05)");
}
}
diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index 4d872b082..f2ee8ffe5 100644
--- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest {
Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new Tk103Protocol());
+ verifyNull(decoder, text(
+ "(027044702512BP00027044702512HSO01A4)"));
+
verifyPosition(decoder, text(
"(864768011069660,ZC11,250517,V,0000.0000N,00000.0000E,000.0,114725,000.0,0.00,11)"));