aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug.xml2
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java11
-rw-r--r--test/org/traccar/protocol/UproProtocolDecoderTest.java3
3 files changed, 16 insertions, 0 deletions
diff --git a/debug.xml b/debug.xml
index 6ca6f78e9..e3ee64221 100644
--- a/debug.xml
+++ b/debug.xml
@@ -43,6 +43,8 @@
<entry key='deviceManager.lookupGroupsAttribute'>true</entry>
+ <entry key='decoder.ignoreSessionCache'>false</entry>
+
<entry key='event.enable'>true</entry>
<entry key='event.overspeedHandler'>true</entry>
<entry key='event.overspeed.notRepeat'>true</entry>
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index 15f5471e9..f1101567d 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -89,6 +89,17 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
}
public DeviceSession getDeviceSession(Channel channel, SocketAddress remoteAddress, String... uniqueIds) {
+ if (Context.getConfig().getBoolean("decoder.ignoreSessionCache")) {
+ long deviceId = findDeviceId(remoteAddress, uniqueIds);
+ if (deviceId != 0) {
+ if (Context.getConnectionManager() != null) {
+ Context.getConnectionManager().addActiveDevice(deviceId, protocol, channel, remoteAddress);
+ }
+ return new DeviceSession(deviceId);
+ } else {
+ return null;
+ }
+ }
if (channel instanceof DatagramChannel) {
long deviceId = findDeviceId(remoteAddress, uniqueIds);
DeviceSession deviceSession = addressDeviceSessions.get(remoteAddress);
diff --git a/test/org/traccar/protocol/UproProtocolDecoderTest.java b/test/org/traccar/protocol/UproProtocolDecoderTest.java
index c58a748a1..82d159d18 100644
--- a/test/org/traccar/protocol/UproProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/UproProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class UproProtocolDecoderTest extends ProtocolTest {
UproProtocolDecoder decoder = new UproProtocolDecoder(new UproProtocol());
+ verifyNothing(decoder, text(
+ "*AI2000905447674,BA&A2003064913201201845107561627121016&B0100000000&C05>8=961&F0333&K023101002154A7#"));
+
verifyPosition(decoder, text(
"*AI200905300036,AH&A0317264913209801844913060000251115&B0500000000&C0;4?72:9&F0000#"));