aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/UlbotechProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-23 15:49:56 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-23 15:49:56 +1200
commit2a3fad9496decd83f06ae5abf067f8d4337ec741 (patch)
tree69837f0bf89cf6ff78915d70380118575cc5c47a /src/org/traccar/protocol/UlbotechProtocolDecoder.java
parenta8d2a0170b7ac891ffe784320ac2d1389f11bf68 (diff)
downloadtrackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.tar.gz
trackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.tar.bz2
trackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.zip
Major code refacroting
Diffstat (limited to 'src/org/traccar/protocol/UlbotechProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index c5f63812e..48122a8f3 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -30,8 +30,8 @@ import java.util.Properties;
public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
- public UlbotechProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
- super(dataManager, protocol, properties);
+ public UlbotechProtocolDecoder(String protocol) {
+ super(protocol);
}
private static final short DATA_GPS = 0x01;
@@ -63,11 +63,10 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
// Get device id
String imei = ChannelBufferTools.readHexString(buf, 16).substring(1);
- try {
- position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
+ if (!identify(imei)) {
+ return null;
}
+ position.setDeviceId(getDeviceId());
// Time
long seconds = buf.readUnsignedInt() & 0x7fffffffl;
@@ -82,7 +81,6 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
switch (type) {
case DATA_GPS:
-
position.setValid(true);
position.setLatitude(buf.readInt() / 1000000.0);
position.setLongitude(buf.readInt() / 1000000.0);
@@ -90,10 +88,8 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readUnsignedShort() * 0.539957);
position.setCourse((double) buf.readUnsignedShort());
extendedInfo.set("hdop", buf.readUnsignedShort());
-
break;
-
default:
buf.skipBytes(length);
break;