aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorjcardus <asklocation.net@gmail.com>2024-03-29 19:43:06 +0000
committerjcardus <asklocation.net@gmail.com>2024-03-29 19:43:06 +0000
commitb95fa6a433fe9fc464aa59256d0b33da46809d0b (patch)
tree6e3b3c9c486edbf8e09683dbc6d07fa6d62c8ae3 /src/main/java/org/traccar/protocol
parent97b61ee431d8384ad2c233adcd9e478b074bc41d (diff)
downloadtrackermap-server-b95fa6a433fe9fc464aa59256d0b33da46809d0b.tar.gz
trackermap-server-b95fa6a433fe9fc464aa59256d0b33da46809d0b.tar.bz2
trackermap-server-b95fa6a433fe9fc464aa59256d0b33da46809d0b.zip
C2 and F1
fallback to device name and attribute
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 0e08066ab..817e03f67 100644
--- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -79,6 +79,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
put("41", "GV75W");
put("FC", "GV600W");
put("6E", "GV310LAU");
+ put("C2", "GV600M");
+ put("F1", "GV350M");
put("802004", "GV58LAU");
put("802005", "GV355CEU");
}};
@@ -94,14 +96,15 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
ignoreFixTime = getConfig().getBoolean(Keys.PROTOCOL_IGNORE_FIX_TIME.withPrefix(getProtocolName()));
}
- private String getDeviceModel(String protocolVersion) {
+ private String getDeviceModel(DeviceSession deviceSession, String value, String protocolVersion) {
if (devices.containsKey(protocolVersion.substring(0, 2))) {
return devices.get(protocolVersion.substring(0, 2));
}
if (devices.containsKey(protocolVersion.substring(0, 6))) {
return devices.get(protocolVersion.substring(0, 6));
}
- return "";
+ String model = value.isEmpty() ? getDeviceModel(deviceSession) : value;
+ return model != null ? model.toUpperCase() : "";
}
private Position initPosition(Parser parser, Channel channel, SocketAddress remoteAddress) {
@@ -517,8 +520,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
- String model = getDeviceModel(protocolVersion);
- index += 1; // device name
+ String model = getDeviceModel(deviceSession, v[index++], protocolVersion);
index += 1; // report type
index += 1; // can bus state
long reportMask = Long.parseLong(v[index++], 16);
@@ -932,7 +934,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- String model = getDeviceModel(protocolVersion);
+ String model = getDeviceModel(deviceSession, v[index++], protocolVersion);
long mask = Long.parseLong(v[index++], 16);
Double power = v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1]) * 0.001;
index += 1; // report type