aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/SyrusProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/SyrusProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/SyrusProtocolDecoder.java15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/SyrusProtocolDecoder.java b/src/org/traccar/protocol/SyrusProtocolDecoder.java
index ee11b35ef..5b7440bf9 100644
--- a/src/org/traccar/protocol/SyrusProtocolDecoder.java
+++ b/src/org/traccar/protocol/SyrusProtocolDecoder.java
@@ -35,9 +35,8 @@ public class SyrusProtocolDecoder extends BaseProtocolDecoder {
boolean sendResponse;
-
- public SyrusProtocolDecoder(DataManager dataManager, String protocol, Properties properties, boolean sendResponse) {
- super(dataManager, protocol, properties);
+ public SyrusProtocolDecoder(String protocol, boolean sendResponse) {
+ super(protocol);
this.sendResponse = sendResponse;
}
@@ -102,7 +101,6 @@ public class SyrusProtocolDecoder extends BaseProtocolDecoder {
}
// Find device ID
- Long deviceId = null;
beginIndex = sentence.indexOf(";ID=");
if (beginIndex != -1) {
beginIndex += 4;
@@ -113,13 +111,10 @@ public class SyrusProtocolDecoder extends BaseProtocolDecoder {
// Find device in database
String id = sentence.substring(beginIndex, endIndex);
- try {
- deviceId = getDataManager().getDeviceByImei(id).getId();
- } catch(Exception error) {
- Log.warning("Unknown device - " + id);
+ if (!identify(id)) {
return null;
}
-
+
// Send response
if (sendResponse && channel != null) {
channel.write(id);
@@ -137,7 +132,7 @@ public class SyrusProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
- position.setDeviceId(deviceId);
+ position.setDeviceId(getDeviceId());
Integer index = 1;