aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java23
-rw-r--r--src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java2
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(