diff options
author | Anton Tananaev <anton@traccar.org> | 2023-09-22 07:35:44 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-09-22 07:35:44 -0700 |
commit | d5bc3cc9d97be0df8e0ce46b000556efb08a9451 (patch) | |
tree | 27fb4eb5b27bcffbab26862564c6f1b443a3f906 /src/main | |
parent | a8ea5f619cea8cc29289a91e3d4ac31a989759dd (diff) | |
download | trackermap-server-d5bc3cc9d97be0df8e0ce46b000556efb08a9451.tar.gz trackermap-server-d5bc3cc9d97be0df8e0ce46b000556efb08a9451.tar.bz2 trackermap-server-d5bc3cc9d97be0df8e0ce46b000556efb08a9451.zip |
Add NTO tracker alarms
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/NtoProtocolDecoder.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/NtoProtocolDecoder.java b/src/main/java/org/traccar/protocol/NtoProtocolDecoder.java index bbdae485e..ba9ebd95d 100644 --- a/src/main/java/org/traccar/protocol/NtoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/NtoProtocolDecoder.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import io.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Protocol; +import org.traccar.helper.BitUtil; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; import org.traccar.model.Position; @@ -74,7 +75,16 @@ public class NtoProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(parser.nextDouble()); position.setCourse(parser.nextInt()); - position.set(Position.KEY_STATUS, parser.next()); + long status = parser.nextHexLong(); + position.set(Position.KEY_STATUS, status); + position.set(Position.KEY_ALARM, BitUtil.check(status, 1) ? Position.ALARM_JAMMING : null); + position.set(Position.KEY_ALARM, BitUtil.check(status, 3 * 8 + 1) ? Position.ALARM_POWER_CUT : null); + position.set(Position.KEY_ALARM, BitUtil.check(status, 3 * 8 + 2) ? Position.ALARM_OVERSPEED : null); + position.set(Position.KEY_ALARM, BitUtil.check(status, 3 * 8 + 3) ? Position.ALARM_VIBRATION : null); + position.set(Position.KEY_ALARM, BitUtil.check(status, 3 * 8 + 4) ? Position.ALARM_GEOFENCE_ENTER : null); + position.set(Position.KEY_ALARM, BitUtil.check(status, 3 * 8 + 5) ? Position.ALARM_GEOFENCE_EXIT : null); + position.set(Position.KEY_ALARM, BitUtil.check(status, 4 * 8) ? Position.ALARM_LOW_BATTERY : null); + position.set(Position.KEY_ALARM, BitUtil.check(status, 4 * 8 + 4) ? Position.ALARM_DOOR : null); return position; } |