aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-03-06 07:14:45 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-03-06 07:14:45 +1300
commit88456dc2e2b3cc5a618b2a041c43230ed550f12f (patch)
treeb544a05232e442dc2fb56e8e231bbc64d40e9f63 /src
parentf8fb4e0476d050aadb66734836c785c1624fea38 (diff)
downloadtraccar-server-88456dc2e2b3cc5a618b2a041c43230ed550f12f.tar.gz
traccar-server-88456dc2e2b3cc5a618b2a041c43230ed550f12f.tar.bz2
traccar-server-88456dc2e2b3cc5a618b2a041c43230ed550f12f.zip
Suntech ST600 series support
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index 58e670307..034894b52 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -21,6 +21,8 @@ import org.traccar.Context;
import org.traccar.DeviceSession;
import org.traccar.helper.BitUtil;
import org.traccar.helper.UnitsConverter;
+import org.traccar.model.CellTower;
+import org.traccar.model.Network;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -156,7 +158,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
}
}
- private Position decode235(
+ private Position decode2356(
Channel channel, SocketAddress remoteAddress, String protocol, String[] values) throws ParseException {
int index = 0;
@@ -175,7 +177,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(deviceSession.getDeviceId());
position.set(Position.KEY_TYPE, type);
- if (protocol.equals("ST300") || protocol.equals("ST500")) {
+ if (protocol.equals("ST300") || protocol.equals("ST500") || protocol.equals("ST600")) {
index += 1; // model
}
@@ -186,7 +188,12 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
position.setTime(dateFormat.parse(values[index++] + values[index++]));
if (!protocol.equals("ST500")) {
- index += 1; // cell
+ int cid = Integer.parseInt(values[index++], 16);
+ if (protocol.equals("ST600")) {
+ position.setNetwork(new Network(CellTower.from(
+ Integer.parseInt(values[index++]), Integer.parseInt(values[index++]),
+ Integer.parseInt(values[index++]), cid, Integer.parseInt(values[index++]))));
+ }
}
position.setLatitude(Double.parseDouble(values[index++]));
@@ -369,7 +376,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
} else if (values[0].equals("ST910")) {
return decode9(channel, remoteAddress, values);
} else {
- return decode235(channel, remoteAddress, values[0].substring(0, 5), values);
+ return decode2356(channel, remoteAddress, values[0].substring(0, 5), values);
}
}