aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/SuntechProtocolDecoder.java
diff options
context:
space:
mode:
authorParveen Kumar Yadav <parveenkumardeeva@gmail.com>2018-04-13 10:47:42 +0530
committerGitHub <noreply@github.com>2018-04-13 10:47:42 +0530
commitd448823edd0e8a7833c79b980cfe9778b849843a (patch)
tree50ad1ab51b93915cff422a1834baa5a2c579fce8 /src/org/traccar/protocol/SuntechProtocolDecoder.java
parent2c8392a0e16044905d983da56ab0919eadbb3858 (diff)
parent617393cf9f052298f7fb35f0c58138c87a6dd5c3 (diff)
downloadtrackermap-server-d448823edd0e8a7833c79b980cfe9778b849843a.tar.gz
trackermap-server-d448823edd0e8a7833c79b980cfe9778b849843a.tar.bz2
trackermap-server-d448823edd0e8a7833c79b980cfe9778b849843a.zip
Merge pull request #1 from traccar/master
Bringing Fork Up to Date
Diffstat (limited to 'src/org/traccar/protocol/SuntechProtocolDecoder.java')
-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..b739e699b 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++], 16), 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);
}
}