From 865e3c41122a07c6e752b299b0d687330b22ebda Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 22 Jan 2022 09:51:19 -0800 Subject: Set device id --- .../java/org/traccar/protocol/ArmoliProtocolDecoder.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java') 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; } -- cgit v1.2.3