aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-04-21 00:31:53 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-04-21 00:31:53 +1200
commitce1a5a24bbf0a74335cab0799c2d0acdcdde761c (patch)
treeb79ff4074bb031dc07cd1fcffcd30f0b321d48f8
parent27d1708b0e8062b143e4ca0ea818a6f0301e9a3e (diff)
downloadtraccar-server-ce1a5a24bbf0a74335cab0799c2d0acdcdde761c.tar.gz
traccar-server-ce1a5a24bbf0a74335cab0799c2d0acdcdde761c.tar.bz2
traccar-server-ce1a5a24bbf0a74335cab0799c2d0acdcdde761c.zip
Support newer Wialon protocol versions
-rw-r--r--src/org/traccar/protocol/WialonProtocolDecoder.java6
-rw-r--r--test/org/traccar/protocol/WialonProtocolDecoderTest.java3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java
index a07dfc7c9..90b7e7847 100644
--- a/src/org/traccar/protocol/WialonProtocolDecoder.java
+++ b/src/org/traccar/protocol/WialonProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2014 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2017 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -136,7 +136,9 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
if (sentence.startsWith("#L#")) {
- String imei = sentence.substring(3, sentence.indexOf(';'));
+ String[] values = sentence.substring(3).split(";");
+
+ String imei = values[0].indexOf('.') >= 0 ? values[1] : values[0];
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei);
if (deviceSession != null) {
sendResponse(channel, "#AL#", 1);
diff --git a/test/org/traccar/protocol/WialonProtocolDecoderTest.java b/test/org/traccar/protocol/WialonProtocolDecoderTest.java
index 4e73c7d49..881b39cf7 100644
--- a/test/org/traccar/protocol/WialonProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/WialonProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class WialonProtocolDecoderTest extends ProtocolTest {
WialonProtocolDecoder decoder = new WialonProtocolDecoder(new WialonProtocol());
verifyNull(decoder, text(
+ "#L#2.0;42001300083;;CE45"));
+
+ verifyNull(decoder, text(
"#L#123456789012345;test"));
verifyNull(decoder, text(