diff options
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/BaseProtocolDecoder.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java index 2d6286bf8..b0fb72225 100644 --- a/src/org/traccar/BaseProtocolDecoder.java +++ b/src/org/traccar/BaseProtocolDecoder.java @@ -29,6 +29,8 @@ import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.Set; +import java.util.Iterator; import java.sql.SQLException; public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { @@ -205,6 +207,13 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { if (!positions.isEmpty()) { position = (Position) positions.iterator().next(); } + } else if (decodedMessage instanceof Map) { + Set<Long> deviceIds = ((HashMap) decodedMessage).keySet(); + Iterator<Long> deviceIdsIterator = deviceIds.iterator(); + while (deviceIdsIterator.hasNext()) { + Context.getConnectionManager().updateDevice( + deviceIdsIterator.next(), Device.STATUS_ONLINE, new Date()); + } } } if (position != null) { |