diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-17 08:11:29 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-17 08:11:29 -0700 |
commit | 09a85fa9e43b9781d3d8e12bbbe0ff42a7d02b12 (patch) | |
tree | e44bdc5115d8486b746fb3cead81b6d53660bcdb /src/main/java/org/traccar/protocol/C2stekProtocolDecoder.java | |
parent | ee30e6e63f110476f557ed4ca8a081eb5b589101 (diff) | |
download | trackermap-server-09a85fa9e43b9781d3d8e12bbbe0ff42a7d02b12.tar.gz trackermap-server-09a85fa9e43b9781d3d8e12bbbe0ff42a7d02b12.tar.bz2 trackermap-server-09a85fa9e43b9781d3d8e12bbbe0ff42a7d02b12.zip |
Support C2Stek variation (fix #4331)
Diffstat (limited to 'src/main/java/org/traccar/protocol/C2stekProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/C2stekProtocolDecoder.java | 12 |
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; } |