aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-04-19 11:31:12 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-04-19 11:31:12 +1200
commit4af79323eff0aa57c44e4069bcb46cb8388c9524 (patch)
tree306f28f2d76ec6f092b74c5b80751154e034635b /src
parentd882668353819880970fa889d89705da2c93c02b (diff)
downloadtraccar-server-4af79323eff0aa57c44e4069bcb46cb8388c9524.tar.gz
traccar-server-4af79323eff0aa57c44e4069bcb46cb8388c9524.tar.bz2
traccar-server-4af79323eff0aa57c44e4069bcb46cb8388c9524.zip
Improve support for Ulbotech protocol
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index a5c608dd3..efa63bee2 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2015 - 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -120,7 +120,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
long seconds = buf.readUnsignedInt() & 0x7fffffffL;
seconds += 946684800L; // 2000-01-01 00:00
seconds -= timeZone;
- position.setTime(new Date(seconds * 1000));
+ Date time = new Date(seconds * 1000);
boolean hasLocation = false;
@@ -143,10 +143,17 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
case DATA_LBS:
position.set(Event.KEY_MCC, buf.readUnsignedShort());
- position.set(Event.KEY_MNC, buf.readUnsignedByte());
+ position.set(Event.KEY_MNC, buf.readUnsignedShort());
position.set(Event.KEY_LAC, buf.readUnsignedShort());
- position.set(Event.KEY_CID, buf.readUnsignedShort());
+ if (length == 11) {
+ position.set(Event.KEY_CID, buf.readUnsignedInt());
+ } else {
+ position.set(Event.KEY_CID, buf.readUnsignedShort());
+ }
position.set(Event.KEY_GSM, -buf.readUnsignedByte());
+ if (length > 9 && length != 11) {
+ buf.skipBytes(length - 9);
+ }
break;
case DATA_STATUS:
@@ -218,11 +225,13 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
}
}
- if (hasLocation) {
- return position;
+ if (!hasLocation) {
+ getLastLocation(position, time);
+ } else {
+ position.setTime(time);
}
- return null;
+ return position;
}
}