aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-11-20 20:26:21 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-11-20 20:26:21 +1300
commit8eb7ced3563809046d0b569247db490201f7ac98 (patch)
treec4ac8a29510d2459cfd34cbe403c3f0142f0dbbc /src
parentf313718772b72a3ff72a37de3b26b80194432b9e (diff)
downloadtrackermap-server-8eb7ced3563809046d0b569247db490201f7ac98.tar.gz
trackermap-server-8eb7ced3563809046d0b569247db490201f7ac98.tar.bz2
trackermap-server-8eb7ced3563809046d0b569247db490201f7ac98.zip
Handle different event types
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/FreematicsProtocolDecoder.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/FreematicsProtocolDecoder.java b/src/org/traccar/protocol/FreematicsProtocolDecoder.java
index b91690d71..866e0fd6e 100644
--- a/src/org/traccar/protocol/FreematicsProtocolDecoder.java
+++ b/src/org/traccar/protocol/FreematicsProtocolDecoder.java
@@ -37,9 +37,10 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
}
private Object decodeEvent(
- Channel channel, SocketAddress remoteAddress, String sentence) throws Exception {
+ Channel channel, SocketAddress remoteAddress, String sentence) {
DeviceSession deviceSession = null;
+ String event = null;
String time = null;
for (String pair : sentence.split(",")) {
@@ -53,6 +54,8 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
deviceSession = getDeviceSession(channel, remoteAddress, value);
}
break;
+ case "EV":
+ event = value;
case "TS":
time = value;
break;
@@ -61,8 +64,8 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
}
}
- if (channel != null && deviceSession != null && time != null) {
- String message = "1#EV=1,RX=1,TS=" + time;
+ if (channel != null && deviceSession != null && event != null && time != null) {
+ String message = String.format("1#EV=%s,RX=1,TS=%s", event, time);
message += '*' + Checksum.sum(message);
channel.writeAndFlush(new NetworkMessage(message, remoteAddress));
}