diff options
Diffstat (limited to 'src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 08d8252a3..601d127f1 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -38,6 +38,8 @@ import java.util.TimeZone; public class SuntechProtocolDecoder extends BaseProtocolDecoder { + private String prefix; + private int protocolType; private boolean hbm; private boolean includeAdc; @@ -48,6 +50,10 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { super(protocol); } + public String getPrefix() { + return prefix; + } + public void setProtocolType(int protocolType) { this.protocolType = protocolType; } @@ -626,15 +632,16 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { } else { String[] values = buf.toString(StandardCharsets.US_ASCII).split(";"); + prefix = values[0]; - if (values[0].length() < 5) { + if (prefix.length() < 5) { return decodeUniversal(channel, remoteAddress, values); - } else if (values[0].startsWith("ST9")) { + } else if (prefix.startsWith("ST9")) { return decode9(channel, remoteAddress, values); - } else if (values[0].startsWith("ST4")) { + } else if (prefix.startsWith("ST4")) { return decode4(channel, remoteAddress, values); } else { - return decode2356(channel, remoteAddress, values[0].substring(0, 5), values); + return decode2356(channel, remoteAddress, prefix.substring(0, 5), values); } } } |