diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2022-01-22 09:51:19 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2022-01-22 09:51:19 -0800 |
commit | 865e3c41122a07c6e752b299b0d687330b22ebda (patch) | |
tree | 10d6e82407404671b73b139459794d739d1b3703 /src/main/java/org | |
parent | 96c3589154583f57e5aa39663679fc5df103f394 (diff) | |
download | trackermap-server-865e3c41122a07c6e752b299b0d687330b22ebda.tar.gz trackermap-server-865e3c41122a07c6e752b299b0d687330b22ebda.tar.bz2 trackermap-server-865e3c41122a07c6e752b299b0d687330b22ebda.zip |
Set device id
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java | 15 |
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; } |