aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/L100ProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/SabertekProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java5
-rw-r--r--test/org/traccar/protocol/L100ProtocolDecoderTest.java3
4 files changed, 15 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/L100ProtocolDecoder.java b/src/org/traccar/protocol/L100ProtocolDecoder.java
index 1fe18ff5e..fe2c298e1 100644
--- a/src/org/traccar/protocol/L100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/L100ProtocolDecoder.java
@@ -54,14 +54,15 @@ public class L100ProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.?d*|N.C),") // adc
.expression("[^,]*,") // reserved
.expression("[^,]*,") // reserved
- .number("(d+.d+),") // odometer
- .number("(d+.d+),") // temperature
- .number("(d+.d+),") // battery
+ .number("(d+.?d*),") // odometer
+ .number("(d+.?d*),") // temperature
+ .number("(d+.?d*),") // battery
.number("(d+),") // rssi
.number("(d+),") // mcc
.number("(d+),") // mnc
.number("(x+),") // lac
.number("(x+)") // cid
+ .any()
.text("ATL")
.compile();
diff --git a/src/org/traccar/protocol/SabertekProtocolDecoder.java b/src/org/traccar/protocol/SabertekProtocolDecoder.java
index d1f88dc5e..715aa37f2 100644
--- a/src/org/traccar/protocol/SabertekProtocolDecoder.java
+++ b/src/org/traccar/protocol/SabertekProtocolDecoder.java
@@ -15,6 +15,7 @@
*/
package org.traccar.protocol;
+import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
@@ -69,6 +70,9 @@ public class SabertekProtocolDecoder extends BaseProtocolDecoder {
}
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
+ if (channel != null) {
+ channel.write(ChannelBuffers.wrappedBuffer(new byte[]{(byte) (deviceSession != null ? 0x06 : 0x15)}));
+ }
if (deviceSession == null) {
return null;
}
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index d8943abd5..c200129d2 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -19,6 +19,7 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.helper.BitUtil;
+import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -408,7 +409,9 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
if (pattern == PATTERN4) {
- channel.write("$$0014AA" + sentence.substring(sentence.length() - 6));
+ String response = "$$0014AA" + sentence.substring(sentence.length() - 6, sentence.length() - 2);
+ response += String.format("%02X", Checksum.xor(response)).toUpperCase();
+ channel.write(response);
} else {
channel.write("ACK OK\r\n");
}
diff --git a/test/org/traccar/protocol/L100ProtocolDecoderTest.java b/test/org/traccar/protocol/L100ProtocolDecoderTest.java
index 04d3f8b5b..1e48ecef5 100644
--- a/test/org/traccar/protocol/L100ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/L100ProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class L100ProtocolDecoderTest extends ProtocolTest {
L100ProtocolDecoder decoder = new L100ProtocolDecoder(new L100Protocol());
verifyPosition(decoder, text(
+ "ATL861693039769518,$GPRMC,074930.000,A,2838.0112,N,07713.3602,E,0000,223.36,290518,,,A*7E,#01111011000100,0.012689,0,0,2.572415,0,4.015,22,404,4,88,3ad5,0,0.01,1.4_800F_VTS3D3_gen_peri_myn,,internet,00000000,ATL"));
+
+ verifyPosition(decoder, text(
"ATL867857039216564,$GPRMC,131101,A,2838.010010,N,7713.354980,E,0,0,240418,,,*09,#00011011000000,0,0,0,10.70,24.31,3.8,0,0,0,0,0ATL"));
verifyPosition(decoder, text(