aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/V680ProtocolDecoder.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/V680ProtocolDecoder.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/V680ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index 95f4e101c..6e85640c0 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -32,10 +32,8 @@ import org.traccar.model.Position;
public class V680ProtocolDecoder extends BaseProtocolDecoder {
- private Long deviceId;
-
- public V680ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
- super(dataManager, protocol, properties);
+ public V680ProtocolDecoder(String protocol) {
+ super(protocol);
}
private static final Pattern pattern = Pattern.compile(
@@ -68,11 +66,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
// Detect device ID
if (sentence.length() == 16) {
String imei = sentence.substring(1, sentence.length());
- try {
- deviceId = getDataManager().getDeviceByImei(imei).getId();
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
- }
+ identify(imei);
} else {
// Parse message
@@ -89,17 +83,12 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
// Get device by IMEI
String imei = parser.group(index++);
if (imei != null) {
- try {
- deviceId = getDataManager().getDeviceByImei(imei).getId();
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
- return null;
- }
+ identify(imei);
}
- if (deviceId == null) {
+ if (!hasDeviceId()) {
return null;
}
- position.setDeviceId(deviceId);
+ position.setDeviceId(getDeviceId());
// User
extendedInfo.set("user", parser.group(index++));