From 7ade92a97f41951aecfbb9de720780cf5232e2c1 Mon Sep 17 00:00:00 2001 From: edvalley <52469633+edvalley@users.noreply.github.com> Date: Sun, 9 Jul 2023 16:06:18 -0400 Subject: Fix more errors --- src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java index e3409c85a..f0753cb5c 100644 --- a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java @@ -220,22 +220,21 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { return null; } - String deviceId = parser.next(); - DeviceSession deviceSession = - getDeviceSession(channel, remoteAddress, deviceId); + getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } String deviceModel = null; - Device device = getCacheManager().getObject(Device.class, deviceId); + Device device = getCacheManager().getObject(Device.class, deviceSession.getDeviceId()); if (device != null) { deviceModel = device.getModel(); } Position position = new Position(getProtocolName()); - position.setDeviceId(deviceId); + + position.setDeviceId(deviceSession.getDeviceId()); DateBuilder dateBuilder = new DateBuilder() .setTime(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0)); @@ -281,7 +280,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { sendAcknowledge(status, event, checksum, channel, remoteAddress); String devicePassword = AttributeUtil.getDevicePassword( - getCacheManager(), deviceId, getProtocolName(), DEFAULT_DEVICE_PASSWORD); + getCacheManager(), deviceSession.getDeviceId(), getProtocolName(), DEFAULT_DEVICE_PASSWORD); sendEventResponse(event, devicePassword, channel, remoteAddress); } -- cgit v1.2.3