diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-23 15:49:56 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-23 15:49:56 +1200 |
commit | 2a3fad9496decd83f06ae5abf067f8d4337ec741 (patch) | |
tree | 69837f0bf89cf6ff78915d70380118575cc5c47a /src/org/traccar/protocol/OrionProtocolDecoder.java | |
parent | a8d2a0170b7ac891ffe784320ac2d1389f11bf68 (diff) | |
download | trackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.tar.gz trackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.tar.bz2 trackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.zip |
Major code refacroting
Diffstat (limited to 'src/org/traccar/protocol/OrionProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/OrionProtocolDecoder.java | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java index f20bb6d72..3b4b598b1 100644 --- a/src/org/traccar/protocol/OrionProtocolDecoder.java +++ b/src/org/traccar/protocol/OrionProtocolDecoder.java @@ -34,8 +34,8 @@ import org.traccar.model.Position; public class OrionProtocolDecoder extends BaseProtocolDecoder { - public OrionProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { - super(dataManager, protocol, properties); + public OrionProtocolDecoder(String protocol) { + super(protocol); } private static final int TYPE_USERLOG = 0; @@ -74,23 +74,18 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder { if ((header & 0x40) != 0) { sendResponse(channel, buf); } - - String id = String.valueOf(buf.readUnsignedInt()); - long deviceId; - try { - deviceId = getDataManager().getDeviceByImei(id).getId(); - } catch(Exception error) { - Log.warning("Unknown device - " + id); + + if (!identify(String.valueOf(buf.readUnsignedInt()))) { return null; } - + List<Position> positions = new LinkedList<Position>(); for (int i = 0; i < (header & 0x0f); i++) { // Create new position Position position = new Position(); - position.setDeviceId(deviceId); + position.setDeviceId(getDeviceId()); ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); extendedInfo.set("event", buf.readUnsignedByte()); |