aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Jt600ProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/Jt600ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 197b4103a..80c584d21 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -35,8 +35,8 @@ import org.traccar.model.Position;
public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
- public Jt600ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
- super(dataManager, protocol, properties);
+ public Jt600ProtocolDecoder(String protocol) {
+ super(protocol);
}
private Position decodeNormalMessage(ChannelBuffer buf) throws Exception {
@@ -48,12 +48,10 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
// Get device by identifier
String id = Long.valueOf(ChannelBufferTools.readHexString(buf, 10)).toString();
- try {
- position.setDeviceId(getDataManager().getDeviceByImei(id).getId());
- } catch(Exception error) {
- Log.warning("Unknown device - " + id);
- //return null;
+ if (!identify(id)) {
+ return null;
}
+ position.setDeviceId(getDeviceId());
// Protocol and type
int version = ChannelBufferTools.readHexInteger(buf, 1);
@@ -166,13 +164,10 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
Integer index = 1;
// Get device by identifier
- String id = parser.group(index++);
- try {
- position.setDeviceId(getDataManager().getDeviceByImei(id).getId());
- } catch(Exception error) {
- Log.warning("Unknown device - " + id);
+ if (!identify(parser.group(index++))) {
return null;
}
+ position.setDeviceId(getDeviceId());
// Longitude
Double longitude = Double.valueOf(parser.group(index++));