diff options
author | casswarry0 <33078062+casswarry0@users.noreply.github.com> | 2021-11-23 15:35:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-23 15:35:10 +0000 |
commit | 26e3d8eb0c40822e5f39d144ecb053916c463e8f (patch) | |
tree | b28e4b09f4e2aea9179d482dd4a2b153b1db63c5 /src/main | |
parent | a425ea42de76ba81890fb52b1f06eff82bba1ded (diff) | |
parent | fd47e69b388b1e0af8aa5ead940773f6b2da3e81 (diff) | |
download | trackermap-server-26e3d8eb0c40822e5f39d144ecb053916c463e8f.tar.gz trackermap-server-26e3d8eb0c40822e5f39d144ecb053916c463e8f.tar.bz2 trackermap-server-26e3d8eb0c40822e5f39d144ecb053916c463e8f.zip |
Merge branch 'traccar:master' into master
Diffstat (limited to 'src/main')
4 files changed, 37 insertions, 31 deletions
diff --git a/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java b/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java index e882c2378..d509b3ec0 100644 --- a/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java @@ -101,6 +101,10 @@ public class DolphinProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, point.getSatellites()); position.set(Position.KEY_HDOP, point.getHDOP()); + for (int j = 0; j < point.getIOListIDCount(); j++) { + position.set(Position.PREFIX_IO + point.getIOListIDValue(j), point.getIOListValue(j)); + } + positions.add(position); } diff --git a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java index dc558147a..f29fb9850 100644 --- a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java @@ -309,18 +309,17 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { Position position = null; - if (length > 1) { + if (photo == null) { + photo = Unpooled.buffer(); + } - if (photo == null) { - photo = Unpooled.buffer(); - } + buf.readUnsignedByte(); // part number - buf.readUnsignedByte(); // part number - photo.writeBytes(buf, length - 1); + if (length > 1) { - sendResponse(channel, 0x07, buf.readUnsignedShortLE()); + photo.writeBytes(buf, length - 1); - } else if (photo != null) { + } else { DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); String uniqueId = Context.getIdentityManager().getById(deviceSession.getDeviceId()).getUniqueId(); @@ -336,6 +335,8 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { } + sendResponse(channel, 0x07, buf.readUnsignedShortLE()); + return position; } diff --git a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java index 059041d6b..641a45864 100644 --- a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java @@ -124,6 +124,14 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder { } } + private String readTagId(ByteBuf buf) { + StringBuilder tagId = new StringBuilder(); + for (int i = 0; i < 6; i++) { + tagId.insert(0, ByteBufUtil.hexDump(buf.readSlice(1))); + } + return tagId.toString(); + } + @Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { @@ -214,7 +222,7 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder { } break; case 0x23: - position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6))); + position.set("tagId", readTagId(buf)); position.setLatitude(buf.readIntLE() * 0.0000001); position.setLongitude(buf.readIntLE() * 0.0000001); position.setValid(true); @@ -228,9 +236,9 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder { break; case 0x28: int beaconFlags = buf.readUnsignedByte(); - position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6))); - position.set("tagRssi", buf.readUnsignedByte()); - buf.readUnsignedByte(); // 1m rssi + position.set("tagId", readTagId(buf)); + position.set("tagRssi", (int) buf.readByte()); + position.set("tag1mRssi", (int) buf.readByte()); if (BitUtil.check(beaconFlags, 7)) { position.setLatitude(buf.readIntLE() * 0.0000001); position.setLongitude(buf.readIntLE() * 0.0000001); diff --git a/src/main/java/org/traccar/protocol/StbProtocolDecoder.java b/src/main/java/org/traccar/protocol/StbProtocolDecoder.java index bd151c604..cc985d605 100644 --- a/src/main/java/org/traccar/protocol/StbProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/StbProtocolDecoder.java @@ -26,9 +26,7 @@ import org.traccar.Protocol; import org.traccar.model.Position; import javax.json.Json; -import javax.json.JsonNumber; import javax.json.JsonObject; -import javax.json.JsonString; import javax.json.JsonValue; import java.io.StringReader; import java.net.SocketAddress; @@ -97,39 +95,34 @@ public class StbProtocolDecoder extends BaseProtocolDecoder { String id = propertyObject.getString("id"); switch (id) { case "01101001": - locationType = propertyObject.getInt("value"); + locationType = Integer.parseInt(propertyObject.getString("value")); break; case "01102001": - position.setLongitude(propertyObject.getJsonNumber("value").doubleValue()); + position.setLongitude( + Double.parseDouble(propertyObject.getString("value"))); break; case "01103001": - position.setLatitude(propertyObject.getJsonNumber("value").doubleValue()); + position.setLatitude( + Double.parseDouble(propertyObject.getString("value"))); break; case "01118001": - position.set(Position.KEY_DEVICE_TEMP, propertyObject.getJsonNumber("value").doubleValue()); + position.set( + Position.KEY_DEVICE_TEMP, Double.parseDouble(propertyObject.getString("value"))); break; case "01122001": - position.set("batteryControl", propertyObject.getInt("value")); + position.set( + "batteryControl", Integer.parseInt(propertyObject.getString("value"))); break; case "02301001": - position.set("switchCabinetCommand", propertyObject.getInt("value")); + position.set( + "switchCabinetCommand", Integer.parseInt(propertyObject.getString("value"))); break; default: String key = "id" + id; if (propertyObject.containsKey("doorId")) { key += "Door" + propertyObject.getString("doorId"); } - JsonValue value = propertyObject.get("value"); - switch (value.getValueType()) { - case STRING: - position.set(key, ((JsonString) value).getString()); - break; - case NUMBER: - position.set(key, ((JsonNumber) value).doubleValue()); - break; - default: - break; - } + position.set(key, propertyObject.getString("value")); break; } } |