aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Xrb28ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-11-13 08:30:09 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-11-13 08:30:22 +1300
commit8abf4f011eef72e06dd24720e00ce27350b0b047 (patch)
tree4e9556c5dcade8d3dfbf0be7df0f310b7fe3f7d8 /src/org/traccar/protocol/Xrb28ProtocolDecoder.java
parent3ea901e4198c6dbbdde74c6e49805714694c8271 (diff)
downloadtrackermap-server-8abf4f011eef72e06dd24720e00ce27350b0b047.tar.gz
trackermap-server-8abf4f011eef72e06dd24720e00ce27350b0b047.tar.bz2
trackermap-server-8abf4f011eef72e06dd24720e00ce27350b0b047.zip
Fix issue with XRB 28 decoder
Diffstat (limited to 'src/org/traccar/protocol/Xrb28ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Xrb28ProtocolDecoder.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/Xrb28ProtocolDecoder.java b/src/org/traccar/protocol/Xrb28ProtocolDecoder.java
index c3af2c4f3..7c382900a 100644
--- a/src/org/traccar/protocol/Xrb28ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xrb28ProtocolDecoder.java
@@ -42,7 +42,8 @@ public class Xrb28ProtocolDecoder extends BaseProtocolDecoder {
}
private static final Pattern PATTERN = new PatternBuilder()
- .text("*HBCR,")
+ .text("*")
+ .expression("....,")
.expression("..,") // vendor
.number("d{15},") // imei
.expression("..,") // type
@@ -67,25 +68,25 @@ public class Xrb28ProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
- DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, sentence.substring(10, 26));
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, sentence.substring(8, 24));
if (deviceSession == null) {
return null;
}
- String type = sentence.substring(27, 29);
+ String type = sentence.substring(25, 27);
if (channel != null) {
if (type.matches("L0|L1|W0|E1")) {
channel.write(new NetworkMessage(
- sentence.substring(0, 29) + "#\n", remoteAddress));
+ sentence.substring(0, 27) + "#\n", remoteAddress));
} else if (type.equals("R0") && pendingCommand != null) {
String command = pendingCommand.equals(Command.TYPE_ALARM_ARM) ? "L1," : "L0,";
channel.write(new NetworkMessage(
- sentence.substring(0, 27) + command + sentence.substring(32) + "\n", remoteAddress));
+ sentence.substring(0, 25) + command + sentence.substring(30) + "\n", remoteAddress));
pendingCommand = null;
}
}
- Parser parser = new Parser(PATTERN, sentence.substring(2));
+ Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
return null;
}