aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-02-14 10:47:03 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-02-14 10:47:16 -0800
commit421b663d45a18fa95a4873840bfaa671cc1724a8 (patch)
tree483f92129d109d2e1e6dea58a88e3bd6282a5b44 /src/main/java
parent52e16f65e1f4b3c3d56bda60f16860db235b0e5c (diff)
downloadtrackermap-server-421b663d45a18fa95a4873840bfaa671cc1724a8.tar.gz
trackermap-server-421b663d45a18fa95a4873840bfaa671cc1724a8.tar.bz2
trackermap-server-421b663d45a18fa95a4873840bfaa671cc1724a8.zip
Alternative device id
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java b/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
index b6d7f4e45..71e2fccd6 100644
--- a/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,9 +75,9 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
}
private Object decodePosition(
- Channel channel, SocketAddress remoteAddress, String sentence) throws Exception {
+ Channel channel, SocketAddress remoteAddress, String sentence, String id) {
- DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);
if (deviceSession == null) {
return null;
}
@@ -187,12 +187,13 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
int endIndex = sentence.indexOf('*');
if (startIndex > 0 && endIndex > 0) {
+ String id = sentence.substring(0, startIndex);
sentence = sentence.substring(startIndex + 1, endIndex);
if (sentence.startsWith("EV")) {
return decodeEvent(channel, remoteAddress, sentence);
} else {
- return decodePosition(channel, remoteAddress, sentence);
+ return decodePosition(channel, remoteAddress, sentence, id);
}
}