aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/BoxProtocolDecoder.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/BoxProtocolDecoder.java b/src/main/java/org/traccar/protocol/BoxProtocolDecoder.java
index 3635c29e5..853fa8f81 100644
--- a/src/main/java/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/BoxProtocolDecoder.java
@@ -47,7 +47,10 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.?d*),") // distance
.number("(d+),") // event
.number("(d+)") // status
- .any()
+ .groupBegin()
+ .text(";")
+ .expression("(.+)")
+ .groupEnd("?")
.compile();
@Override
@@ -99,6 +102,14 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
position.setValid(!BitUtil.check(status, 2));
position.set(Position.KEY_STATUS, status);
+ if (parser.hasNext()) {
+ String[] data = parser.next().split(";");
+ for (String item : data) {
+ int valueIndex = item.indexOf(',');
+ position.set(item.substring(0, valueIndex).toLowerCase(), item.substring(valueIndex + 1));
+ }
+ }
+
return position;
}