diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-18 16:14:18 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-18 16:14:18 +1200 |
commit | d3e063cf9de8a45bed4dfe87b73aadfd8d2edeab (patch) | |
tree | a8de0435d01e2379c1c43fdc2be2b6d00e552f40 /src/org/traccar/protocol/MiniFinderProtocolDecoder.java | |
parent | 24fa824e20cf68d36f760e4b921edb1fb25525b3 (diff) | |
download | trackermap-server-d3e063cf9de8a45bed4dfe87b73aadfd8d2edeab.tar.gz trackermap-server-d3e063cf9de8a45bed4dfe87b73aadfd8d2edeab.tar.bz2 trackermap-server-d3e063cf9de8a45bed4dfe87b73aadfd8d2edeab.zip |
Decode MiniFinder status flags
Diffstat (limited to 'src/org/traccar/protocol/MiniFinderProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/MiniFinderProtocolDecoder.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java index 089b491d2..96eaaf0fa 100644 --- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java +++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java @@ -90,9 +90,33 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(5)) { int flags = parser.nextInt(16); - position.set(Position.KEY_FLAGS, flags); + position.setValid(BitUtil.check(flags, 0)); + if (BitUtil.check(flags, 2)) { + position.set(Position.KEY_ALARM, Position.ALARM_FAULT); + } + if (BitUtil.check(flags, 6)) { + position.set(Position.KEY_ALARM, Position.ALARM_SOS); + } + if (BitUtil.check(flags, 7)) { + position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED); + } + if (BitUtil.check(flags, 8)) { + position.set(Position.KEY_ALARM, Position.ALARM_FALL_DOWN); + } + if (BitUtil.check(flags, 12)) { + position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); + } + if (BitUtil.check(flags, 14)) { + position.set(Position.KEY_ALARM, Position.ALARM_MOTION); + } + if (BitUtil.check(flags, 15)) { + position.set(Position.KEY_ALARM, Position.ALARM_MOVEMENT); + } + + position.set(Position.KEY_GSM, BitUtil.between(flags, 16, 20)); + position.setAltitude(parser.nextDouble()); position.set(Position.KEY_BATTERY, parser.next()); |