aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index e9c678930..f8abdcc85 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -46,7 +46,7 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
Device device = Context.getIdentityManager().getDeviceByUniqueId(uniqueId);
if (device != null) {
deviceId = device.getId();
- Context.getConnectionManager().setActiveDevice(deviceId, protocol, channel, remoteAddress);
+ Context.getConnectionManager().addActiveDevice(deviceId, protocol, channel, remoteAddress);
return true;
} else {
deviceId = 0;
@@ -95,4 +95,11 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
}
}
+ @Override
+ protected void onMessageEvent(Channel channel, SocketAddress remoteAddress, Object msg) {
+ if (hasDeviceId()) {
+ Context.getConnectionManager().updateDevice(deviceId, Device.STATUS_ONLINE, new Date());
+ }
+ }
+
}