aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/AutoFonProtocolDecoder.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/AutoFonProtocolDecoder.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/AutoFonProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index fbc142846..2c563d6d2 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -30,16 +30,14 @@ import java.util.*;
public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
- public AutoFonProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
- super(dataManager, protocol, properties);
+ public AutoFonProtocolDecoder(String protocol) {
+ super(protocol);
}
private static final int MSG_LOGIN = 0x10;
private static final int MSG_LOCATION = 0x11;
private static final int MSG_HISTORY = 0x12;
- private long deviceId;
-
private static double convertCoordinate(int raw) {
double result = raw / 1000000;
result += (raw % 1000000) / 600000.0;
@@ -51,7 +49,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
- position.setDeviceId(deviceId);
+ position.setDeviceId(getDeviceId());
if (!history) {
buf.readUnsignedByte(); // interval
@@ -127,10 +125,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // software version
String imei = ChannelBufferTools.readHexString(buf, 16).substring(1);
- try {
- deviceId = getDataManager().getDeviceByImei(imei).getId();
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
+ if (!identify(imei)) {
return null;
}