aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/RuptelaProtocolDecoder.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/RuptelaProtocolDecoder.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/RuptelaProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/RuptelaProtocolDecoder.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
index 0574aa2d8..b83d9f721 100644
--- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -33,8 +33,8 @@ import org.traccar.model.Position;
public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
- public RuptelaProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
- super(dataManager, protocol, properties);
+ public RuptelaProtocolDecoder(String protocol) {
+ super(protocol);
}
private static final int COMMAND_RECORDS = 0x01;
@@ -49,14 +49,10 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
// Identify device
String imei = String.format("%015d", buf.readLong());
- long deviceId;
- try {
- deviceId = getDataManager().getDeviceByImei(imei).getId();
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
+ if (!identify(imei)) {
return null;
}
-
+
int type = buf.readUnsignedByte();
if (type == COMMAND_RECORDS) {
@@ -68,7 +64,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
for (int i = 0; i < count; i++) {
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
- position.setDeviceId(deviceId);
+ position.setDeviceId(getDeviceId());
// Time
position.setTime(new Date(buf.readUnsignedInt() * 1000));