diff options
author | Anton Tananaev <anton@traccar.org> | 2023-01-23 16:34:40 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-01-23 16:34:40 -0800 |
commit | 4722f9b6b6489ea7e9dea0c01ae1d7d3044310b5 (patch) | |
tree | 01c5551f6b979b4fd8b2e440575b6e3821a01417 /src | |
parent | b77131f4be38295cb643e343613597a6d1ec6562 (diff) | |
download | trackermap-server-4722f9b6b6489ea7e9dea0c01ae1d7d3044310b5.tar.gz trackermap-server-4722f9b6b6489ea7e9dea0c01ae1d7d3044310b5.tar.bz2 trackermap-server-4722f9b6b6489ea7e9dea0c01ae1d7d3044310b5.zip |
Update Iridium decoding
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java | 23 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java | 2 |
2 files changed, 16 insertions, 9 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; } diff --git a/src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java index 8c08fee14..df7f37903 100644 --- a/src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java @@ -10,7 +10,7 @@ public class GalileoProtocolDecoderTest extends ProtocolTest { var decoder = inject(new GalileoProtocolDecoder(null)); - verifyNotNull(decoder, binary( + verifyPosition(decoder, binary( "01004e01001c0747ea59333030323334303639363034353930000012000063c85e6903000b0321a8f846aba50000000202001e205f5ec863300c4643fdfdbbe6c8fb330000000034e7013505d400000000")); verifyNotNull(decoder, binary( |