aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-29 22:04:58 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-29 22:04:58 +1200
commit2cb4c8c48fc01b7fadccbedecafe672853b22639 (patch)
treeae0e558b6bbe19bbdd3e19dbd808309ff164cdf3 /src/org/traccar/protocol
parent26fb8427ce8465cd3560f9357eb7ae1920bdcbd2 (diff)
downloadtraccar-server-2cb4c8c48fc01b7fadccbedecafe672853b22639.tar.gz
traccar-server-2cb4c8c48fc01b7fadccbedecafe672853b22639.tar.bz2
traccar-server-2cb4c8c48fc01b7fadccbedecafe672853b22639.zip
Fix device id issues
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/TopflytechProtocolDecoder.java6
2 files changed, 7 insertions, 12 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 0cd3a9c73..7ca670fb3 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2013 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,18 +30,15 @@ import org.traccar.model.Position;
public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
- private long deviceId;
-
public TeltonikaProtocolDecoder(String protocol) {
super(protocol);
}
private void parseIdentification(Channel channel, ChannelBuffer buf) {
- boolean result = false;
int length = buf.readUnsignedShort();
String imei = buf.toString(buf.readerIndex(), length, Charset.defaultCharset());
- result = identify(imei);
+ boolean result = identify(imei);
if (channel != null) {
ChannelBuffer response = ChannelBuffers.directBuffer(1);
@@ -77,7 +74,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocol());
- position.setDeviceId(deviceId);
+ position.setDeviceId(getDeviceId());
int globalMask = 0x0f;
@@ -95,8 +92,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
int locationMask = buf.readUnsignedByte();
if (checkBit(locationMask, 0)) {
- position.setLatitude(Double.valueOf(buf.readFloat()));
- position.setLongitude(Double.valueOf(buf.readFloat()));
+ position.setLatitude(buf.readFloat());
+ position.setLongitude(buf.readFloat());
}
if (checkBit(locationMask, 1)) {
diff --git a/src/org/traccar/protocol/TopflytechProtocolDecoder.java b/src/org/traccar/protocol/TopflytechProtocolDecoder.java
index 0d97f112a..b0edb0276 100644
--- a/src/org/traccar/protocol/TopflytechProtocolDecoder.java
+++ b/src/org/traccar/protocol/TopflytechProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2013 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,13 +28,11 @@ import org.traccar.model.Position;
public class TopflytechProtocolDecoder extends BaseProtocolDecoder {
- private Long deviceId;
-
public TopflytechProtocolDecoder(String protocol) {
super(protocol);
}
- static private Pattern pattern = Pattern.compile(
+ static private final Pattern pattern = Pattern.compile(
"\\(" +
"(\\d+)" + // IMEI
".*" +