From db45cf357db965691f87bff6d206608189afb25e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 16 Jun 2021 20:49:33 -0700 Subject: Support AM01 protocol --- .../java/org/traccar/protocol/Gt06ProtocolDecoder.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/main/java') 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); -- cgit v1.2.3