aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/C2stekProtocolDecoder.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/C2stekProtocolDecoder.java b/src/main/java/org/traccar/protocol/C2stekProtocolDecoder.java
index 42a61ef85..aef158fc7 100644
--- a/src/main/java/org/traccar/protocol/C2stekProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/C2stekProtocolDecoder.java
@@ -49,10 +49,12 @@ public class C2stekProtocolDecoder extends BaseProtocolDecoder {
.number("(-?d+.d+)#") // altitude
.number("(d+)#") // battery
.number("d+#") // geo area alarm
- .number("(x+)#") // alarm
- .number("([01])?") // armed
+ .number("(x+)") // alarm
+ .groupBegin()
+ .number("#([01])?") // armed
.number("([01])") // door
.number("([01])#") // ignition
+ .groupEnd("?")
.any()
.text("$AP")
.compile();
@@ -114,8 +116,10 @@ public class C2stekProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext()) {
position.set(Position.KEY_ARMED, parser.nextInt() > 0);
}
- position.set(Position.KEY_DOOR, parser.nextInt() > 0);
- position.set(Position.KEY_IGNITION, parser.nextInt() > 0);
+ if (parser.hasNext(2)) {
+ position.set(Position.KEY_DOOR, parser.nextInt() > 0);
+ position.set(Position.KEY_IGNITION, parser.nextInt() > 0);
+ }
return position;
}