diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java | 14 |
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) { |