diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-09 10:47:43 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-09 10:47:43 +1300 |
commit | 9ec7166889b9b0492a18a338e6dc5352743209b8 (patch) | |
tree | 455782947763d7d6e4828276b8b7843222356ef3 /src/org/traccar/BaseProtocolDecoder.java | |
parent | f727af19cb994517ca3685239e506ff6beeaaa76 (diff) | |
download | trackermap-server-9ec7166889b9b0492a18a338e6dc5352743209b8.tar.gz trackermap-server-9ec7166889b9b0492a18a338e6dc5352743209b8.tar.bz2 trackermap-server-9ec7166889b9b0492a18a338e6dc5352743209b8.zip |
Add initial code for device status
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/BaseProtocolDecoder.java | 9 |
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()); + } + } + } |