aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-03-20 21:42:05 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-03-20 21:42:05 +1300
commit1a0a34acfb775385fe37de4992215a2e328cc6f6 (patch)
treed718dccd2ab30b3910c3b2e9e729e1c32607cda1 /src/org
parent572dfddfb64f99dbfde60fda628bba327c245465 (diff)
downloadtraccar-server-1a0a34acfb775385fe37de4992215a2e328cc6f6.tar.gz
traccar-server-1a0a34acfb775385fe37de4992215a2e328cc6f6.tar.bz2
traccar-server-1a0a34acfb775385fe37de4992215a2e328cc6f6.zip
Fix Galileo protocol
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java15
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());