aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-05-10 14:49:06 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-05-10 14:49:06 +1200
commit426611e0fd6aaad5e882b2661a66f8c2e48a6af0 (patch)
tree4159a3b47f5f001d977d8d45786b4faa7eaf4824 /src/org/traccar/BaseProtocolDecoder.java
parentf4a4fafb5c6eb6cdd2d219a3b31c7e232bcd0807 (diff)
downloadtrackermap-server-426611e0fd6aaad5e882b2661a66f8c2e48a6af0.tar.gz
trackermap-server-426611e0fd6aaad5e882b2661a66f8c2e48a6af0.tar.bz2
trackermap-server-426611e0fd6aaad5e882b2661a66f8c2e48a6af0.zip
Add option to save empty messages
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index 53297c2bc..3429f41f0 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2012 - 2016 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.
@@ -105,4 +105,17 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
}
}
+ @Override
+ protected Object handleEmptyMessage(Channel channel, SocketAddress remoteAddress, Object msg) {
+ if (Context.getConfig().getBoolean("database.saveEmpty") && hasDeviceId()) {
+ Position position = new Position();
+ position.setProtocol(getProtocolName());
+ position.setDeviceId(getDeviceId());
+ getLastLocation(position, null);
+ return position;
+ } else {
+ return null;
+ }
+ }
+
}