aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-01-22 09:51:19 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2022-01-22 09:51:19 -0800
commit865e3c41122a07c6e752b299b0d687330b22ebda (patch)
tree10d6e82407404671b73b139459794d739d1b3703 /src/main
parent96c3589154583f57e5aa39663679fc5df103f394 (diff)
downloadtrackermap-server-865e3c41122a07c6e752b299b0d687330b22ebda.tar.gz
trackermap-server-865e3c41122a07c6e752b299b0d687330b22ebda.tar.bz2
trackermap-server-865e3c41122a07c6e752b299b0d687330b22ebda.zip
Set device id
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
index 40beedbf6..b1140d79c 100644
--- a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
@@ -68,12 +68,19 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
char type = sentence.charAt(1);
Position position = new Position(getProtocolName());
+ DeviceSession deviceSession;
if (type != 'M') {
if (type == 'W') {
- getLastLocation(position, null);
- position.set(Position.KEY_RESULT, sentence.substring(sentence.indexOf(',') + 1, sentence.length() - 2));
- return position;
+ deviceSession = getDeviceSession(channel, remoteAddress);
+ if (deviceSession != null) {
+ position.setDeviceId(deviceSession.getDeviceId());
+ getLastLocation(position, null);
+ position.set(
+ Position.KEY_RESULT,
+ sentence.substring(sentence.indexOf(',') + 1, sentence.length() - 2));
+ return position;
+ }
} else if (channel != null && (type == 'Q' || type == 'L')) {
channel.writeAndFlush(new NetworkMessage("[TX,];;", remoteAddress));
}
@@ -85,7 +92,7 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
+ deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
if (deviceSession == null) {
return null;
}