diff options
author | namo <namo@gurtam.com> | 2017-10-19 18:00:30 +0300 |
---|---|---|
committer | namo <namo@gurtam.com> | 2017-10-19 18:00:30 +0300 |
commit | fb82a8167b99f706cb25d828bf1d72424ba98a75 (patch) | |
tree | acd231c96a125bb82eb9e9d758be8c4fe34e5b52 /src/org/traccar/BaseProtocolDecoder.java | |
parent | da4fce0da7be92b381c6cdc1069486bc83a2974d (diff) | |
download | trackermap-server-fb82a8167b99f706cb25d828bf1d72424ba98a75.tar.gz trackermap-server-fb82a8167b99f706cb25d828bf1d72424ba98a75.tar.bz2 trackermap-server-fb82a8167b99f706cb25d828bf1d72424ba98a75.zip |
flespi integration: listening messages
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) { |