aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-01-23 16:34:40 -0800
committerAnton Tananaev <anton@traccar.org>2023-01-23 16:34:40 -0800
commit4722f9b6b6489ea7e9dea0c01ae1d7d3044310b5 (patch)
tree01c5551f6b979b4fd8b2e440575b6e3821a01417 /src/main
parentb77131f4be38295cb643e343613597a6d1ec6562 (diff)
downloadtrackermap-server-4722f9b6b6489ea7e9dea0c01ae1d7d3044310b5.tar.gz
trackermap-server-4722f9b6b6489ea7e9dea0c01ae1d7d3044310b5.tar.bz2
trackermap-server-4722f9b6b6489ea7e9dea0c01ae1d7d3044310b5.zip
Update Iridium decoding
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java
index b5c6f77ef..d4bd45c4f 100644
--- a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -272,10 +272,10 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
private Position decodeIridiumPosition(Channel channel, SocketAddress remoteAddress, ByteBuf buf) {
- buf.readUnsignedShortLE(); // length
+ buf.readUnsignedShort(); // length
buf.skipBytes(3); // identification header
- buf.readUnsignedIntLE(); // index
+ buf.readUnsignedInt(); // index
DeviceSession deviceSession = getDeviceSession(
channel, remoteAddress, buf.readSlice(15).toString(StandardCharsets.US_ASCII));
@@ -288,12 +288,19 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // session status
buf.skipBytes(4); // reserved
- buf.readUnsignedIntLE(); // date and time
-
- buf.skipBytes(23); // coordinates block
-
- buf.skipBytes(3); // data tag header
- decodeMinimalDataSet(position, buf);
+ position.setTime(new Date(buf.readUnsignedInt() * 1000));
+
+ buf.skipBytes(3); // coordinates header
+ int flags = buf.readUnsignedByte();
+ double latitude = buf.readUnsignedByte() + buf.readUnsignedShort() / 60000.0;
+ double longitude = buf.readUnsignedByte() + buf.readUnsignedShort() / 60000.0;
+ position.setLatitude(BitUtil.check(flags, 1) ? -latitude : latitude);
+ position.setLongitude(BitUtil.check(flags, 0) ? -longitude : longitude);
+ buf.readUnsignedInt(); // accuracy
+
+ buf.readUnsignedByte(); // data tag header
+ // ByteBuf data = buf.readSlice(buf.readUnsignedShort());
+ // decodeMinimalDataSet(position, data);
return position;
}