aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-03-20 23:28:20 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-03-20 23:28:20 +1300
commit34f61800a807370383df1cafd0d442d69325c648 (patch)
treec6d28747f77f5a876c8bdef41abefeb768dec66a /src/org/traccar
parent1a0a34acfb775385fe37de4992215a2e328cc6f6 (diff)
downloadtrackermap-server-34f61800a807370383df1cafd0d442d69325c648.tar.gz
trackermap-server-34f61800a807370383df1cafd0d442d69325c648.tar.bz2
trackermap-server-34f61800a807370383df1cafd0d442d69325c648.zip
Another Galileo protocol fix
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java
index ac820b587..62669eb1c 100644
--- a/src/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -84,6 +84,8 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
}
}
+ private Long deviceId;
+
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, Object msg)
@@ -106,10 +108,9 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
String imei = buf.toString(buf.readerIndex(), 15, Charset.defaultCharset());
buf.skipBytes(imei.length());
try {
- position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
+ deviceId = getDataManager().getDeviceByImei(imei).getId();
} catch(Exception error) {
Log.warning("Unknown device - " + imei);
- return null;
}
break;
@@ -161,20 +162,22 @@ 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");
+ if (deviceId == null) {
+ Log.warning("Unknown device");
return null;
}
+ position.setDeviceId(deviceId);
+ sendReply(channel, buf.readUnsignedShort());
+
+ if (position.getValid() == null || position.getTime() == null || position.getSpeed() == null) {
+ return null;
+ }
+
if (position.getAltitude() == null) {
position.setAltitude(0.0);
}
- sendReply(channel, buf.readUnsignedShort());
-
position.setExtendedInfo(extendedInfo.toString());
return position;
}