aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/model/Position.java2
-rw-r--r--src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java8
-rw-r--r--src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java12
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java3
10 files changed, 28 insertions, 11 deletions
diff --git a/src/main/java/org/traccar/model/Position.java b/src/main/java/org/traccar/model/Position.java
index 41cfeaf2e..2bd71f383 100644
--- a/src/main/java/org/traccar/model/Position.java
+++ b/src/main/java/org/traccar/model/Position.java
@@ -90,6 +90,7 @@ public class Position extends Message {
public static final String KEY_ICCID = "iccid";
public static final String KEY_PHONE = "phone";
public static final String KEY_SPEED_LIMIT = "speedLimit";
+ public static final String KEY_DRIVING_TIME = "drivingTime";
public static final String KEY_DTCS = "dtcs";
public static final String KEY_OBD_SPEED = "obdSpeed"; // knots
@@ -98,6 +99,7 @@ public class Position extends Message {
public static final String KEY_RESULT = "result";
public static final String KEY_DRIVER_UNIQUE_ID = "driverUniqueId";
+ public static final String KEY_CARD = "card";
// Start with 1 not 0
public static final String PREFIX_TEMP = "temp";
diff --git a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
index a9d77b46e..e0dd1d62d 100644
--- a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
@@ -308,11 +308,11 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
}
if (parser.hasNext()) {
- String rfid = parser.next();
- if (rfid.matches("\\p{XDigit}+")) {
- position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(Integer.parseInt(rfid, 16)));
+ String value = parser.next();
+ if (value.matches("\\p{XDigit}+")) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(Integer.parseInt(value, 16)));
} else {
- position.set("driverLicense", rfid);
+ position.set(Position.KEY_CARD, value);
}
}
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 28308ab77..c7713bdc2 100644
--- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -680,7 +680,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(Double.parseDouble(values[index - 1])));
}
if (BitUtil.check(reportMask, 12)) {
- position.set("drivingHours", Double.parseDouble(values[index++]));
+ position.set(Position.KEY_DRIVING_TIME, Double.parseDouble(values[index++]));
}
if (BitUtil.check(reportMask, 13)) {
position.set("idleHours", Double.parseDouble(values[index++]));
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index 5b639ddfc..02a629103 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -119,6 +119,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
SPACE10X,
STANDARD,
OBD6,
+ WETRUST,
}
private Variant variant;
@@ -833,7 +834,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
String data = buf.readCharSequence(buf.readUnsignedByte(), StandardCharsets.US_ASCII).toString();
buf.readUnsignedByte(); // alarm
buf.readUnsignedByte(); // swiped
- position.set("driverLicense", data.trim());
+ position.set(Position.KEY_CARD, data.trim());
} else if (variant == Variant.BENWAY) {
int mask = buf.readUnsignedShort();
position.set(Position.KEY_IGNITION, BitUtil.check(mask, 8 + 7));
@@ -869,6 +870,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
position.set(Position.PREFIX_TEMP + 1, temperature);
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 10);
+ } else if (variant == Variant.WETRUST) {
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_CARD, buf.readCharSequence(
+ buf.readUnsignedByte(), StandardCharsets.US_ASCII).toString());
+ position.set(Position.KEY_ALARM, buf.readUnsignedByte() > 0 ? Position.ALARM_GENERAL : null);
+ position.set("cardStatus", buf.readUnsignedByte());
+ position.set(Position.KEY_DRIVING_TIME, buf.readUnsignedShort());
}
}
@@ -1391,6 +1399,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
variant = Variant.SPACE10X;
} else if (header == 0x7878 && type == MSG_STATUS && length == 0x13) {
variant = Variant.OBD6;
+ } else if (header == 0x7878 && type == MSG_GPS_LBS_1 && length == 0x29) {
+ variant = Variant.WETRUST;
} else {
variant = Variant.STANDARD;
}
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index 7227c5584..5e73967d5 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -608,7 +608,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
break;
case 0xED:
stringValue = buf.readCharSequence(length, StandardCharsets.US_ASCII).toString();
- position.set("driverLicense", stringValue.trim());
+ position.set(Position.KEY_CARD, stringValue.trim());
break;
case 0xEE:
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
diff --git a/src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java
index f3b56973a..1f8c4d2da 100644
--- a/src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -282,7 +282,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_RSSI, parser.nextHexInt());
position.set(Position.KEY_ODOMETER, parser.nextHexLong());
position.set(Position.KEY_SATELLITES, parser.nextHexInt());
- position.set("driverLicense", parser.next());
+ position.set(Position.KEY_CARD, parser.next());
position.set(Position.KEY_ODOMETER, parser.nextLong());
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
diff --git a/src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java b/src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java
index ba9b41654..f0b1e709d 100644
--- a/src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java
@@ -234,7 +234,7 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder {
} else if (type == 1) {
- position.set("driverLicense", buf.readCharSequence(
+ position.set(Position.KEY_CARD, buf.readCharSequence(
blockEnd - buf.readerIndex(), StandardCharsets.UTF_8).toString());
}
diff --git a/src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java
index a8fc801e7..1ad15f39c 100644
--- a/src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Vt200ProtocolDecoder.java
@@ -123,7 +123,7 @@ public class Vt200ProtocolDecoder extends BaseProtocolDecoder {
position.set("tripStart", decodeDate(buf).getTime());
position.set("tripEnd", decodeDate(buf).getTime());
- position.set("drivingTime", buf.readUnsignedShort());
+ position.set(Position.KEY_DRIVING_TIME, buf.readUnsignedShort());
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt());
position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt());
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index 3b4cb158e..5dc6b803e 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -18,6 +18,10 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
"78780D01086471700328358100093F040D0A"));
verifyAttribute(decoder, binary(
+ "78782912170316053b3bcf015b51220af1201105d56100000000000000000000869c0130010000000238d1af0d0a"),
+ Position.KEY_DRIVING_TIME, 0);
+
+ verifyAttribute(decoder, binary(
"78781219012ed042cc00954d00040419000056fe290d0a"),
Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
diff --git a/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java
index 8fdc8c23c..d90e5e07e 100644
--- a/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.jupiter.api.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class TzoneProtocolDecoderTest extends ProtocolTest {
@@ -12,7 +13,7 @@ public class TzoneProtocolDecoderTest extends ProtocolTest {
verifyAttribute(decoder, binary(
"545a00d424240153011300000863835029944118170316023b180016040485c73d2479187e170316023b1800000000060c000000000d1cc0406303019904aa00000000008a012520205e544f4e474c4f4d245049544f4f4e244d522e5e5e3f3b363030373634333132303130303134323234323d3139303631393538313032363d3f2b2020202020202020202020202032322020202020202020202020203120202020202020202020202030303234363238202031303730302020202020202020202020202020202020202020203f00030080000006e80e0d0a"),
- "driverLicense", "% ^TONGLOM$PITOON$MR.^^?;6007643120100142242=190619581026=?+ 22 1 0024628 10700 ?");
+ Position.KEY_CARD, "% ^TONGLOM$PITOON$MR.^^?;6007643120100142242=190619581026=?+ 22 1 0024628 10700 ?");
verifyAttributes(decoder, binary(
"545a003724240407020200000180322000001610160b151019100000000c010a07320101088600007dca000baa102837016a0114025500000169e80d0a"));