diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/L100ProtocolDecoder.java | 7 | ||||
-rw-r--r-- | src/org/traccar/protocol/SabertekProtocolDecoder.java | 4 | ||||
-rw-r--r-- | src/org/traccar/protocol/TotemProtocolDecoder.java | 5 |
3 files changed, 12 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"); } |