aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Tlt2hProtocolDecoder.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/Tlt2hProtocolDecoder.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/Tlt2hProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 0e17fc70c..01c1ac2aa 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -34,8 +34,8 @@ import org.traccar.model.Position;
public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
- public Tlt2hProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
- super(dataManager, protocol, properties);
+ public Tlt2hProtocolDecoder(String protocol) {
+ super(protocol);
}
private static final Pattern patternHeader = Pattern.compile(
@@ -75,15 +75,10 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
}
// Get device identifier
- String imei = parser.group(1);
- long deviceId;
- try {
- deviceId = getDataManager().getDeviceByImei(imei).getId();
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
+ if (!identify(parser.group(1))) {
return null;
}
-
+
// Get status
String status = parser.group(2);
@@ -95,7 +90,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
if (parser.matches()) {
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
- position.setDeviceId(deviceId);
+ position.setDeviceId(getDeviceId());
Integer index = 1;