aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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(