diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-16 20:49:33 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-16 20:49:33 -0700 |
commit | db45cf357db965691f87bff6d206608189afb25e (patch) | |
tree | 742ca081d6b10cf118187fba2fffc9a605676f77 /src/main | |
parent | 372743857314a0dfad83eef65ed2418a62dae04b (diff) | |
download | traccar-server-db45cf357db965691f87bff6d206608189afb25e.tar.gz traccar-server-db45cf357db965691f87bff6d206608189afb25e.tar.bz2 traccar-server-db45cf357db965691f87bff6d206608189afb25e.zip |
Support AM01 protocol
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index 6d49be0ce..3f3a96109 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -60,6 +60,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_GPS_LBS_1 = 0x12; public static final int MSG_GPS_LBS_2 = 0x22; public static final int MSG_GPS_LBS_3 = 0x37; + public static final int MSG_GPS_LBS_4 = 0x2D; public static final int MSG_STATUS = 0x13; public static final int MSG_SATELLITE = 0x14; public static final int MSG_STRING = 0x15; @@ -67,7 +68,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_WIFI = 0x17; public static final int MSG_GPS_LBS_STATUS_2 = 0x26; public static final int MSG_GPS_LBS_STATUS_3 = 0x27; - public static final int MSG_LBS_MULTIPLE = 0x28; + public static final int MSG_LBS_MULTIPLE_1 = 0x28; + public static final int MSG_LBS_MULTIPLE_2 = 0x2E; public static final int MSG_LBS_WIFI = 0x2C; public static final int MSG_LBS_EXTEND = 0x18; public static final int MSG_LBS_STATUS = 0x19; @@ -117,6 +119,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { case MSG_GPS_LBS_1: case MSG_GPS_LBS_2: case MSG_GPS_LBS_3: + case MSG_GPS_LBS_4: case MSG_GPS_LBS_STATUS_1: case MSG_GPS_LBS_STATUS_2: case MSG_GPS_LBS_STATUS_3: @@ -138,6 +141,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { case MSG_GPS_LBS_1: case MSG_GPS_LBS_2: case MSG_GPS_LBS_3: + case MSG_GPS_LBS_4: case MSG_GPS_LBS_STATUS_1: case MSG_GPS_LBS_STATUS_2: case MSG_GPS_LBS_STATUS_3: @@ -170,7 +174,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { case MSG_GPS_PHONE: case MSG_HEARTBEAT: case MSG_GPS_LBS_STATUS_3: - case MSG_LBS_MULTIPLE: + case MSG_LBS_MULTIPLE_1: + case MSG_LBS_MULTIPLE_2: case MSG_LBS_2: case MSG_FENCE_MULTI: return true; @@ -680,8 +685,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - if (type == MSG_LBS_MULTIPLE || type == MSG_LBS_EXTEND || type == MSG_LBS_WIFI - || type == MSG_LBS_2 || type == MSG_WIFI_3) { + if (type == MSG_LBS_MULTIPLE_1 || type == MSG_LBS_MULTIPLE_2 || type == MSG_LBS_EXTEND + || type == MSG_LBS_WIFI || type == MSG_LBS_2 || type == MSG_WIFI_3) { boolean longFormat = type == MSG_LBS_2 || type == MSG_WIFI_3; @@ -705,7 +710,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // time leads - if (type != MSG_LBS_MULTIPLE && type != MSG_LBS_2) { + if (type != MSG_LBS_MULTIPLE_1 && type != MSG_LBS_MULTIPLE_2 && type != MSG_LBS_2) { int wifiCount = buf.readUnsignedByte(); for (int i = 0; i < wifiCount; i++) { String mac = ByteBufUtil.hexDump(buf.readSlice(6)).replaceAll("(..)", "$1:"); @@ -912,7 +917,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } } - if ((type == MSG_GPS_LBS_2 || type == MSG_GPS_LBS_3) && buf.readableBytes() >= 3 + 6) { + if ((type == MSG_GPS_LBS_2 || type == MSG_GPS_LBS_3 || type == MSG_GPS_LBS_4) && buf.readableBytes() >= 3 + 6) { position.set(Position.KEY_IGNITION, buf.readUnsignedByte() > 0); position.set(Position.KEY_EVENT, buf.readUnsignedByte()); // reason position.set(Position.KEY_ARCHIVE, buf.readUnsignedByte() > 0); |