diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/GalileoProtocolDecoder.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index e4b80777e..ac820b587 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -92,7 +92,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { ChannelBuffer buf = (ChannelBuffer) msg; buf.readUnsignedByte(); // header - int length = buf.readUnsignedShort() & 0x7fff + 3; + int length = (buf.readUnsignedShort() & 0x7fff) + 3; // Create new position Position position = new Position(); @@ -109,6 +109,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDataManager().getDeviceByImei(imei).getId()); } catch(Exception error) { Log.warning("Unknown device - " + imei); + return null; } break; @@ -159,6 +160,18 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { } } + + if (position.getDeviceId() == null || + position.getValid() == null || + position.getTime() == null || + position.getSpeed() == null) { + Log.warning("Identifier or location information missing"); + return null; + } + + if (position.getAltitude() == null) { + position.setAltitude(0.0); + } sendReply(channel, buf.readUnsignedShort()); |