aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-03-30 07:29:04 -0700
committerAnton Tananaev <anton@traccar.org>2024-03-30 07:29:04 -0700
commit3066f3ccfa2a674fae27922f9f94b5e16eb68f9b (patch)
tree7b0fa6d0aa890f865a53ffd37f77ced90af88e9b /src
parent9e750264dd9a1cbfbd7e1aadfdeedbcdbb5d0a0d (diff)
downloadtrackermap-server-3066f3ccfa2a674fae27922f9f94b5e16eb68f9b.tar.gz
trackermap-server-3066f3ccfa2a674fae27922f9f94b5e16eb68f9b.tar.bz2
trackermap-server-3066f3ccfa2a674fae27922f9f94b5e16eb68f9b.zip
Model detection optimization
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 5ac7b2417..b14f64f4a 100644
--- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -79,6 +79,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
Map.entry("55", "GL50B"),
Map.entry("5E", "GV500MAP"),
Map.entry("6E", "GV310LAU"),
+ Map.entry("BD", "CV200"),
Map.entry("C2", "GV600M"),
Map.entry("DC", "GV600MG"),
Map.entry("DE", "GL500M"),
@@ -108,13 +109,14 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
if (declaredModel != null) {
return declaredModel.toUpperCase();
}
- if (PROTOCOL_MODELS.containsKey(protocolVersion.substring(0, 2))) {
- return PROTOCOL_MODELS.get(protocolVersion.substring(0, 2));
- }
- if (PROTOCOL_MODELS.containsKey(protocolVersion.substring(0, 6))) {
- return PROTOCOL_MODELS.get(protocolVersion.substring(0, 6));
+ String versionPrefix;
+ if (protocolVersion.length() > 6) {
+ versionPrefix = protocolVersion.substring(0, 6);
+ } else {
+ versionPrefix = protocolVersion.substring(0, 2);
}
- return "";
+ String model = PROTOCOL_MODELS.get(versionPrefix);
+ return model != null ? model : "";
}
private Position initPosition(Parser parser, Channel channel, SocketAddress remoteAddress) {