aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/Pt3000ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Pt3000ProtocolDecoder.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
index 86c438f6c..513fdbb4b 100644
--- a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
@@ -32,8 +32,8 @@ import org.traccar.model.Position;
public class Pt3000ProtocolDecoder extends BaseProtocolDecoder {
- public Pt3000ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
- super(dataManager, protocol, properties);
+ public Pt3000ProtocolDecoder(String protocol) {
+ super(protocol);
}
static private Pattern pattern = Pattern.compile(
@@ -70,12 +70,10 @@ public class Pt3000ProtocolDecoder extends BaseProtocolDecoder {
Integer index = 1;
// Identifier
- String imei = parser.group(index++);
- try {
- position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
- }
+ if (!identify(parser.group(index++))) {
+ return null;
+ }
+ position.setDeviceId(getDeviceId());
// Time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
@@ -85,7 +83,7 @@ public class Pt3000ProtocolDecoder extends BaseProtocolDecoder {
time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++)));
// Validity
- position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false);
+ position.setValid(parser.group(index++).compareTo("A") == 0);
// Latitude
Double latitude = Double.valueOf(parser.group(index++));