aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TeltonikaProtocolDecoder.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/TeltonikaProtocolDecoder.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/TeltonikaProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 961d4e73b..f39a81fbc 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -36,8 +36,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
private long deviceId;
- public TeltonikaProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
- super(dataManager, protocol, properties);
+ public TeltonikaProtocolDecoder(String protocol) {
+ super(protocol);
}
private void parseIdentification(Channel channel, ChannelBuffer buf) {
@@ -45,13 +45,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
int length = buf.readUnsignedShort();
String imei = buf.toString(buf.readerIndex(), length, Charset.defaultCharset());
- try {
- deviceId = getDataManager().getDeviceByImei(imei).getId();
- result = true;
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
- }
-
+ result = identify(imei);
+
if (channel != null) {
ChannelBuffer response = ChannelBuffers.directBuffer(1);
response.writeByte(result ? 1 : 0);