From 421b663d45a18fa95a4873840bfaa671cc1724a8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 14 Feb 2021 10:47:03 -0800 Subject: Alternative device id --- .../java/org/traccar/protocol/FreematicsProtocolDecoder.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/main/java/org/traccar/protocol') 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); } } -- cgit v1.2.3