aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-07-29 15:50:59 +0500
committerAbyss777 <abyss@fox5.ru>2016-07-29 15:50:59 +0500
commit20c2456a9df46eaef04c787ea5471bf31a71f93c (patch)
treef8e76fb8f6cf27b0d1b2a9476dcb8436f4e88feb /src/org/traccar/protocol/MeiligaoProtocolDecoder.java
parentcd0c04a03b359dfc5b1ea3f61b93aaae8f6fec3e (diff)
downloadtrackermap-server-20c2456a9df46eaef04c787ea5471bf31a71f93c.tar.gz
trackermap-server-20c2456a9df46eaef04c787ea5471bf31a71f93c.tar.bz2
trackermap-server-20c2456a9df46eaef04c787ea5471bf31a71f93c.zip
Organized alarms in the first part of protocols
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 9c7e9ea23..196b24d27 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -150,6 +150,31 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
return server;
}
+
+ private String decodeAlarm(short value) {
+ switch (value) {
+ case 0x01: return Position.ALARM_SOS;
+ case 0x02: return Position.PREFIX_BUTTON + "B" + Position.ENDING_PRESSED;
+ case 0x03: return Position.PREFIX_BUTTON + "C" + Position.ENDING_PRESSED;
+ case 0x04: return Position.PREFIX_IO + "4" + Position.ENDING_ACTIVE;
+ case 0x05: return Position.PREFIX_IO + "5" + Position.ENDING_ACTIVE;
+ case 0x10: return Position.ALARM_LOW_BATTERY;
+ case 0x11: return Position.ALARM_OVERSPEED;
+ case 0x12: return Position.ALARM_MOVEMENT;
+ case 0x13: return Position.ALARM_GEOFENCE_ENTER;
+ case 0x14: return Position.ALARM_TRACKER_ON;
+ case 0x15: return Position.ALARM_GPS_BLIND_ENTER;
+ case 0x16: return Position.ALARM_GPS_BLIND_EXIT;
+ case 0x31: return Position.ALARM_SOS + Position.ENDING_RELEASED;
+ case 0x32: return Position.PREFIX_BUTTON + "B" + Position.ENDING_RELEASED;
+ case 0x33: return Position.PREFIX_BUTTON + "C" + Position.ENDING_RELEASED;
+ case 0x34: return Position.PREFIX_IO + "4" + Position.ENDING_INACTIVE;
+ case 0x35: return Position.PREFIX_IO + "5" + Position.ENDING_INACTIVE;
+ case 0x50: return Position.ALARM_POWER_OFF;
+ case 0x53: return Position.ALARM_GPS_ANTENNA_CUT;
+ default: return null;
+ }
+ }
@Override
protected Object decode(
@@ -196,7 +221,10 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
// Custom data
if (command == MSG_ALARM) {
- position.set(Position.KEY_ALARM, buf.readUnsignedByte());
+ String alarm = decodeAlarm(buf.readUnsignedByte());
+ if (alarm != null) {
+ position.set(Position.KEY_ALARM, alarm);
+ }
} else if (command == MSG_POSITION_LOGGED) {
buf.skipBytes(6);
}