diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-08-19 13:01:46 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-08-19 13:01:46 +1200 |
commit | dd5f81b6ccaca626d07f7524abf44d8cb95b4faf (patch) | |
tree | 20c9ced92627d2f7a6d3fa07be675baa138e4374 /src/org/traccar | |
parent | d7725b0fb8ecde4d883a07d8bc4e77974c56eada (diff) | |
download | traccar-server-dd5f81b6ccaca626d07f7524abf44d8cb95b4faf.tar.gz traccar-server-dd5f81b6ccaca626d07f7524abf44d8cb95b4faf.tar.bz2 traccar-server-dd5f81b6ccaca626d07f7524abf44d8cb95b4faf.zip |
Add Suntech ST500 support
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/SuntechProtocolDecoder.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index 93c53d2cf..ec764774d 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -109,7 +109,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { return position; } - private Position decode23( + private Position decode235( Channel channel, SocketAddress remoteAddress, String protocol, String[] values) throws ParseException { int index = 0; @@ -132,7 +132,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - if (protocol.equals("ST300")) { + if (protocol.equals("ST300") || protocol.equals("ST500")) { index += 1; // model } @@ -142,7 +142,9 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); position.setTime(dateFormat.parse(values[index++] + values[index++])); - index += 1; // cell + if (!protocol.equals("ST500")) { + index += 1; // cell + } position.setLatitude(Double.parseDouble(values[index++])); position.setLongitude(Double.parseDouble(values[index++])); @@ -220,7 +222,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { if (protocol.equals("ST910")) { return decode9(channel, remoteAddress, values); } else { - return decode23(channel, remoteAddress, protocol, values); + return decode235(channel, remoteAddress, protocol, values); } } |