aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-10-29 20:29:46 -0700
committerAnton Tananaev <anton@traccar.org>2023-10-29 20:29:46 -0700
commit1db5f2aac51279c65ff2b983923452c6f4bad4e9 (patch)
treeb2cd4616ac049bb90d0a4db1df147bdc408c8247 /src/main
parent870fcd261f736311bc7458e9374aac1dfdf1b9fd (diff)
downloadtrackermap-server-1db5f2aac51279c65ff2b983923452c6f4bad4e9.tar.gz
trackermap-server-1db5f2aac51279c65ff2b983923452c6f4bad4e9.tar.bz2
trackermap-server-1db5f2aac51279c65ff2b983923452c6f4bad4e9.zip
Better DSM detection
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java
index 801e8d22e..75cd52384 100644
--- a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java
@@ -19,6 +19,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Device;
import org.traccar.session.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
@@ -45,6 +46,7 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_PATH_REQUEST = 0x000C;
public static final int MSG_PATH_RESPONSE = 0x000D;
+ private String model;
private String uniqueId;
private int dataSize;
private int dataCurrent;
@@ -52,7 +54,11 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder {
private ByteBuf media;
private boolean isPacketData() {
- return dataSize < 1000;
+ if (model == null) {
+ return dataSize < 8192;
+ } else {
+ return !"DSM".equals(model);
+ }
}
@Override
@@ -71,6 +77,7 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder {
deviceSession = getDeviceSession(channel, remoteAddress, uniqueId);
long settings = buf.readUnsignedInt();
if (channel != null && deviceSession != null) {
+ model = getCacheManager().getObject(Device.class, deviceSession.getDeviceId()).getModel();
ByteBuf response = Unpooled.buffer();
if (BitUtil.check(settings, 25)) {
response.writeShort(MSG_PATH_REQUEST);