aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/AplicomProtocolDecoder.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/AplicomProtocolDecoder.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/AplicomProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index c47731759..aee1517e4 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -23,6 +23,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.Context;
import org.traccar.database.DataManager;
import org.traccar.helper.Log;
import org.traccar.model.ExtendedInfoFormatter;
@@ -30,8 +31,8 @@ import org.traccar.model.Position;
public class AplicomProtocolDecoder extends BaseProtocolDecoder {
- public AplicomProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
- super(dataManager, protocol, properties);
+ public AplicomProtocolDecoder(String protocol) {
+ super(protocol);
}
private static final long IMEI_BASE_TC65_V20 = 0x1437207000000L;
@@ -128,13 +129,12 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
- try {
- position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
+ if (!identify(imei)) {
return null;
}
+ position.setDeviceId(getDeviceId());
+
// Event
extendedInfo.set("event", buf.readUnsignedByte());
buf.readUnsignedByte();