aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-12-20 11:44:27 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2014-12-20 11:44:27 +1300
commit0ebf3a50268bc6e7d1937b376a5a97f71f7608e7 (patch)
tree822bf2ec60c132af3d613e0bc02ed9d6be399d7a /src/org/traccar/protocol
parent80cf3d7233ea99f22c4d2e6c7b946c8dbc974251 (diff)
downloadtrackermap-server-0ebf3a50268bc6e7d1937b376a5a97f71f7608e7.tar.gz
trackermap-server-0ebf3a50268bc6e7d1937b376a5a97f71f7608e7.tar.bz2
trackermap-server-0ebf3a50268bc6e7d1937b376a5a97f71f7608e7.zip
Clean up GT06 decoder
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index e7fe9453b..12187e1ed 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -133,13 +133,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
} else if (deviceId != null && (
type == MSG_GPS ||
- type == MSG_GPS_LBS_1 ||
- type == MSG_GPS_LBS_2 ||
- type == MSG_GPS_LBS_STATUS_1 ||
- type == MSG_GPS_LBS_STATUS_2 ||
- type == MSG_GPS_LBS_STATUS_3 ||
- type == MSG_GPS_PHONE ||
- type == MSG_GPS_LBS_EXTEND)) {
+ type == MSG_GPS_LBS_1 ||
+ type == MSG_GPS_LBS_2 ||
+ type == MSG_GPS_LBS_STATUS_1 ||
+ type == MSG_GPS_LBS_STATUS_2 ||
+ type == MSG_GPS_LBS_STATUS_3 ||
+ type == MSG_GPS_PHONE ||
+ type == MSG_GPS_LBS_EXTEND)) {
// Create new position
Position position = new Position();
@@ -206,23 +206,10 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
// Status
if (type == MSG_GPS_LBS_STATUS_1 || type == MSG_GPS_LBS_STATUS_2 || type == MSG_GPS_LBS_STATUS_3) {
- int flags = buf.readUnsignedByte();
- String binaryAlarm = Integer.toBinaryString(flags);
- Log.debug("Binary of Flags" + binaryAlarm);
-
- String alarm = binaryAlarm.substring(1, 4);
-
-
- if(alarm.equals("100")) {
- Log.debug("SOS ALARM");
- extendedInfo.set("sos", true);
- } else if(alarm.equals("011")){
- Log.debug("LOW BATTERY ALARM");
- extendedInfo.set("sos", true);
- }
-
extendedInfo.set("alarm", true);
+ int flags = buf.readUnsignedByte();
+
extendedInfo.set("acc", (flags & 0x2) != 0);
// TODO parse other flags