From bc65eb120807b7c899d3fd95fbb6684934bfa3ef Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 15 Jun 2024 06:53:13 -0700 Subject: Support GT06 RFID card --- src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java') diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 05a33cc72..962bcb5c8 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -17,6 +17,10 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780D01086471700328358100093F040D0A")); + verifyAttribute(decoder, binary( + "7878281718060e021831c6026e8acc0c361b1000140001cc00286d000f4dbf0000012ca7e001000004b2630d0a"), + Position.KEY_DRIVER_UNIQUE_ID, "0000012ca7e00100"); + verifyAttribute(decoder, binary( "78782732180214123324ca0162bdf0041f45d900190b0a02d4000bc5270000ec025206040202005e07e10d0a"), Position.KEY_ALARM, Position.ALARM_POWER_CUT); -- cgit v1.2.3 From e938fe96f5edca81551323d37ff8c9f02e28773c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 19 Jun 2024 08:41:17 -0700 Subject: Updated Sucre Lee protocol --- .../java/org/traccar/protocol/Gt06ProtocolDecoder.java | 18 ++++++++++++++++-- src/test/java/org/traccar/ProtocolTest.java | 3 +++ .../org/traccar/protocol/Gt06ProtocolDecoderTest.java | 8 ++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java') diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index 0c23f42d3..319349d0e 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -360,7 +360,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { lac = buf.readUnsignedShort(); } long cid; - if (type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7) { + if (type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7 || variant == Variant.SL4X) { cid = buf.readLong(); } else if (type == MSG_GPS_LBS_6 || variant == Variant.SEEWORLD) { cid = buf.readUnsignedInt(); @@ -923,11 +923,21 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { position.set("humidity", buf.readUnsignedShort() * 0.01); } - if ((type == MSG_GPS_LBS_2 || type == MSG_GPS_LBS_3 || type == MSG_GPS_LBS_4) + if (type == MSG_GPS_LBS_STATUS_4 && variant == Variant.SL4X) { + position.setAltitude(buf.readShort()); + } + + if ((type == MSG_GPS_LBS_2 || type == MSG_GPS_LBS_3 || type == MSG_GPS_LBS_4 || type == MSG_GPS_LBS_5) && 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); + if (variant == Variant.SL4X) { + if (buf.readableBytes() > 2 + 6) { + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + } + position.setAltitude(buf.readShort()); + } } if (type == MSG_GPS_LBS_3) { @@ -1495,8 +1505,12 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { variant = Variant.JC400; } else if (header == 0x7878 && type == MSG_LBS_3 && length == 0x37) { variant = Variant.SL4X; + } else if (header == 0x7878 && type == MSG_GPS_LBS_5 && length == 0x2a) { + variant = Variant.SL4X; } else if (header == 0x7878 && type == MSG_GPS_LBS_STATUS_4 && length == 0x27) { variant = Variant.SL4X; + } else if (header == 0x7878 && type == MSG_GPS_LBS_STATUS_4 && length == 0x29) { + variant = Variant.SL4X; } else if (header == 0x7878 && type == MSG_GPS_LBS_2 && length == 0x2f) { variant = Variant.SEEWORLD; } else if (header == 0x7878 && type == MSG_GPS_LBS_STATUS_1 && length == 0x26) { diff --git a/src/test/java/org/traccar/ProtocolTest.java b/src/test/java/org/traccar/ProtocolTest.java index 23ba562f8..0726000be 100644 --- a/src/test/java/org/traccar/ProtocolTest.java +++ b/src/test/java/org/traccar/ProtocolTest.java @@ -123,6 +123,9 @@ public class ProtocolTest extends BaseTest { case "course": assertEquals(expected, position.getCourse()); break; + case "altitude": + assertEquals(expected, position.getAltitude()); + break; default: assertEquals(expected, position.getAttributes().get(key)); break; diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 962bcb5c8..32a492df5 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -17,6 +17,14 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780D01086471700328358100093F040D0A")); + verifyAttribute(decoder, binary( + "7878293218061301261ccd0274c4ad050d7c960018000a02d4000ac3c70dbdc40b46f004210202af001784290d0a"), + "altitude", -31703.0); + + verifyAttribute(decoder, binary( + "78782a31180613012b39cc0274c4dc050d7cd000180002d4000ac3c70dbdc4150100000000000002a6000ea40b0d0a"), + "altitude", 678.0); + verifyAttribute(decoder, binary( "7878281718060e021831c6026e8acc0c361b1000140001cc00286d000f4dbf0000012ca7e001000004b2630d0a"), Position.KEY_DRIVER_UNIQUE_ID, "0000012ca7e00100"); -- cgit v1.2.3 From 3679bcc9dc31fbab434f79a71ccb012c53b61c5e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 19 Jun 2024 08:48:44 -0700 Subject: Updated Sucre Lee protocol --- src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 5 +++++ src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java') diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index 319349d0e..d088077e2 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -1155,6 +1155,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ICCID, ByteBufUtil.hexDump(buf.readSlice(10)).replaceAll("f", "")); return position; + } else if (subType == 0x0b) { + + position.set("networkTechnology", buf.readByte() > 0 ? "4G" : "2G"); + return position; + } else if (subType == 0x0d) { if (buf.getByte(buf.readerIndex()) != '!') { diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 32a492df5..aba0a6293 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -17,6 +17,10 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780D01086471700328358100093F040D0A")); + verifyAttribute(decoder, binary( + "79790007940B010A0B5ACE0D0A"), + "networkTechnology", "4G"); + verifyAttribute(decoder, binary( "7878293218061301261ccd0274c4ad050d7c960018000a02d4000ac3c70dbdc40b46f004210202af001784290d0a"), "altitude", -31703.0); @@ -29,9 +33,8 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { "7878281718060e021831c6026e8acc0c361b1000140001cc00286d000f4dbf0000012ca7e001000004b2630d0a"), Position.KEY_DRIVER_UNIQUE_ID, "0000012ca7e00100"); - verifyAttribute(decoder, binary( - "78782732180214123324ca0162bdf0041f45d900190b0a02d4000bc5270000ec025206040202005e07e10d0a"), - Position.KEY_ALARM, Position.ALARM_POWER_CUT); + verifyNotNull(decoder, binary( + "78782732180214123324ca0162bdf0041f45d900190b0a02d4000bc5270000ec025206040202005e07e10d0a")); verifyAttribute(decoder, binary( "78782616170A080C0E24C0027C58AD0C2B8B0100454E0901CC0025030328E7A0005D4B13021EC373170D0A"), -- cgit v1.2.3 From e9b1392ddc72bd8d5adcde69012e90cb4004c930 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 24 Jun 2024 06:40:28 -0700 Subject: Change GT06 RFID decoding --- src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 2 +- src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java') diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index d088077e2..eb8ba2375 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -960,8 +960,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } if (type == MSG_GPS_LBS_RFID) { - buf.readUnsignedByte(); // validity position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(8))); + buf.readUnsignedByte(); // validity } if (buf.readableBytes() == 3 + 6 || buf.readableBytes() == 3 + 4 + 6) { diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index aba0a6293..9e9d3667d 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -31,7 +31,7 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyAttribute(decoder, binary( "7878281718060e021831c6026e8acc0c361b1000140001cc00286d000f4dbf0000012ca7e001000004b2630d0a"), - Position.KEY_DRIVER_UNIQUE_ID, "0000012ca7e00100"); + Position.KEY_DRIVER_UNIQUE_ID, "bf0000012ca7e001"); verifyNotNull(decoder, binary( "78782732180214123324ca0162bdf0041f45d900190b0a02d4000bc5270000ec025206040202005e07e10d0a")); -- cgit v1.2.3 From 9c2c1566ab292ecc351c273c2ab0f3faf75a7daf Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 29 Jun 2024 06:52:44 -0700 Subject: Add LW2G and LW4G support --- .../org/traccar/protocol/Gt06ProtocolDecoder.java | 30 +++++++++++++++++++--- .../traccar/protocol/Gt06ProtocolDecoderTest.java | 3 +++ 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java') diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index eb8ba2375..372cf5f78 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -101,6 +101,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_GPS_LBS_7 = 0xA0; // GK310 & JM-VL03 public static final int MSG_LBS_2 = 0xA1; // GK310 public static final int MSG_WIFI_3 = 0xA2; // GK310 + public static final int MSG_GPS_LBS_STATUS_5 = 0xA2; // LWxG public static final int MSG_FENCE_SINGLE = 0xA3; // GK310 public static final int MSG_FENCE_MULTI = 0xA4; // GK310 & JM-LL301 public static final int MSG_LBS_ALARM = 0xA5; // GK310 & JM-LL301 @@ -127,6 +128,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { SL4X, SEEWORLD, RFID, + LW4G, } private Variant variant; @@ -174,6 +176,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { case MSG_GPS_LBS_STATUS_2: case MSG_GPS_LBS_STATUS_3: case MSG_GPS_LBS_STATUS_4: + case MSG_GPS_LBS_STATUS_5: case MSG_GPS_PHONE: case MSG_GPS_LBS_EXTEND: case MSG_GPS_LBS_7: @@ -199,6 +202,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { case MSG_GPS_LBS_STATUS_2: case MSG_GPS_LBS_STATUS_3: case MSG_GPS_LBS_STATUS_4: + case MSG_GPS_LBS_STATUS_5: case MSG_GPS_LBS_7: case MSG_GPS_LBS_RFID: case MSG_FENCE_SINGLE: @@ -219,6 +223,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { case MSG_GPS_LBS_STATUS_2: case MSG_GPS_LBS_STATUS_3: case MSG_GPS_LBS_STATUS_4: + case MSG_GPS_LBS_STATUS_5: case MSG_FENCE_MULTI: case MSG_LBS_ALARM: return true; @@ -354,13 +359,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { mnc = buf.readUnsignedByte(); } int lac; - if (type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7) { + if (type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7 || type == MSG_GPS_LBS_STATUS_5) { lac = buf.readInt(); } else { lac = buf.readUnsignedShort(); } long cid; - if (type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7 || variant == Variant.SL4X) { + if (type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7 || variant == Variant.SL4X || type == MSG_GPS_LBS_STATUS_5) { cid = buf.readLong(); } else if (type == MSG_GPS_LBS_6 || variant == Variant.SEEWORLD) { cid = buf.readUnsignedInt(); @@ -690,7 +695,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } else if (type == MSG_LBS_MULTIPLE_1 || type == MSG_LBS_MULTIPLE_2 || type == MSG_LBS_MULTIPLE_3 || type == MSG_LBS_EXTEND || type == MSG_LBS_WIFI || type == MSG_LBS_2 || type == MSG_LBS_3 - || type == MSG_WIFI_3 || type == MSG_WIFI_5) { + || (type == MSG_WIFI_3 && variant != Variant.LW4G) || type == MSG_WIFI_5) { DateBuilder dateBuilder = new DateBuilder((TimeZone) deviceSession.get(DeviceSession.KEY_TIMEZONE)) .setDate(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()) @@ -828,11 +833,15 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { boolean hasLength = hasStatus(type) && type != MSG_LBS_STATUS && type != MSG_LBS_ALARM - && (type != MSG_GPS_LBS_STATUS_1 || variant != Variant.VXT01); + && (type != MSG_GPS_LBS_STATUS_1 || variant != Variant.VXT01) + && type != MSG_GPS_LBS_STATUS_5; decodeLbs(position, buf, type, hasLength); } if (hasStatus(type)) { + if (type == MSG_GPS_LBS_STATUS_5) { + buf.readUnsignedByte(); // network indicator + } decodeStatus(position, buf); if (variant == Variant.OBD6) { int signal = buf.readUnsignedShort(); @@ -846,6 +855,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // working mode position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0); } else { + if (type == MSG_GPS_LBS_STATUS_5) { + position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01); + } int battery = buf.readUnsignedByte(); position.set(Position.KEY_BATTERY_LEVEL, battery <= 6 ? battery * 100 / 6 : battery); position.set(Position.KEY_RSSI, buf.readUnsignedByte()); @@ -856,6 +868,14 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } } + if (type == MSG_GPS_LBS_STATUS_5) { + buf.readUnsignedByte(); // language + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + position.set(Position.KEY_HOURS, buf.readUnsignedInt() * 1000); + buf.skipBytes(8); // terminal id + position.set(Position.KEY_INPUT, buf.readUnsignedShort()); + } + if (type == MSG_GPS_LBS_1) { if (variant == Variant.GT06E_CARD) { position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); @@ -1522,6 +1542,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { variant = Variant.SEEWORLD; } else if (header == 0x7878 && type == MSG_GPS_LBS_RFID && length == 0x28) { variant = Variant.RFID; + } else if (header == 0x7878 && type == MSG_GPS_LBS_STATUS_5 && length == 0x40) { + variant = Variant.LW4G; } else { variant = Variant.STANDARD; } diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 9e9d3667d..da070e224 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -17,6 +17,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780D01086471700328358100093F040D0A")); + verifyPosition(decoder, binary( + "787840a218061b0e0f05cf021d22430aa2660b005c00014e140000026500000000024d4e02114504df06031c010007d00000000000086973105524576500c802a86fda0d0a")); + verifyAttribute(decoder, binary( "79790007940B010A0B5ACE0D0A"), "networkTechnology", "4G"); -- cgit v1.2.3 From e1be8916132fd0102cfe298a75abcfdcd43f244b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 20 Jul 2024 17:37:32 -0700 Subject: Support Jimi IoT extended heartbeat --- .../java/org/traccar/protocol/Gt06ProtocolDecoder.java | 16 ++++++++++++++++ .../org/traccar/protocol/Gt06ProtocolDecoderTest.java | 4 ++++ 2 files changed, 20 insertions(+) (limited to 'src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java') diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index f17671cd7..e25499190 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -88,6 +88,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_X1_GPS = 0x34; public static final int MSG_X1_PHOTO_INFO = 0x35; public static final int MSG_X1_PHOTO_DATA = 0x36; + public static final int MSG_STATUS_2 = 0x36; // Jimi IoT 4G public static final int MSG_WIFI_2 = 0x69; public static final int MSG_GPS_MODULAR = 0x70; public static final int MSG_WIFI_4 = 0xF3; @@ -218,6 +219,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { private static boolean hasStatus(int type) { switch (type) { case MSG_STATUS: + case MSG_STATUS_2: case MSG_LBS_STATUS: case MSG_GPS_LBS_STATUS_1: case MSG_GPS_LBS_STATUS_2: @@ -845,6 +847,20 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } } + if (type == MSG_STATUS_2) { + buf.readUnsignedByte(); // language + while (buf.readableBytes() > 6) { + int moduleType = buf.readUnsignedShort(); + int moduleLength = buf.readUnsignedByte(); + switch (moduleType) { + case 0x0018 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0); + case 0x0032 -> position.set("startupStatus", buf.readUnsignedByte()); + case 0x006A -> position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte()); + default -> buf.skipBytes(moduleLength); + } + } + } + if (type == MSG_GPS_LBS_STATUS_5) { buf.readUnsignedByte(); // language position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index da070e224..bb809529a 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -17,6 +17,10 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780D01086471700328358100093F040D0A")); + verifyAttribute(decoder, binary( + "787817360005040002003201010018020192006a015f0324aeaf0d0a"), + Position.KEY_BATTERY, 4.02); + verifyPosition(decoder, binary( "787840a218061b0e0f05cf021d22430aa2660b005c00014e140000026500000000024d4e02114504df06031c010007d00000000000086973105524576500c802a86fda0d0a")); -- cgit v1.2.3