aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-04-26 20:44:10 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-04-26 20:44:10 -0700
commit309e6a6d4e153b67aa598d67b45f3128716576b8 (patch)
tree688b2a3ed475fc1b114c3ec35c8dcf300befbf8a /src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
parent802a0e395d48ac9dbab54a4c01227aec5801c6f3 (diff)
downloadtrackermap-server-309e6a6d4e153b67aa598d67b45f3128716576b8.tar.gz
trackermap-server-309e6a6d4e153b67aa598d67b45f3128716576b8.tar.bz2
trackermap-server-309e6a6d4e153b67aa598d67b45f3128716576b8.zip
Decode alarm codes
Diffstat (limited to 'src/main/java/org/traccar/protocol/StartekProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/StartekProtocolDecoder.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java b/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
index b80c8e174..9b3780d0f 100644
--- a/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
@@ -69,6 +69,22 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
.any()
.compile();
+ private String decodeAlarm(int value) {
+ switch (value) {
+ case 5:
+ case 6:
+ return Position.ALARM_DOOR;
+ case 39:
+ return Position.ALARM_ACCELERATION;
+ case 40:
+ return Position.ALARM_BRAKING;
+ case 41:
+ return Position.ALARM_CORNERING;
+ default:
+ return null;
+ }
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -86,7 +102,9 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
- position.set(Position.KEY_EVENT, parser.nextInt());
+ int event = parser.nextInt();
+ position.set(Position.KEY_ALARM, decodeAlarm(event));
+ position.set(Position.KEY_EVENT, event);
position.setTime(parser.nextDateTime());
position.setValid(parser.next().equals("A"));