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/ExtendedObjectDecoder.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/ExtendedObjectDecoder.java')
-rw-r--r-- | src/org/traccar/ExtendedObjectDecoder.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/ExtendedObjectDecoder.java b/src/org/traccar/ExtendedObjectDecoder.java index 268e6f688..a9b3a1053 100644 --- a/src/org/traccar/ExtendedObjectDecoder.java +++ b/src/org/traccar/ExtendedObjectDecoder.java @@ -29,6 +29,9 @@ import javax.xml.bind.DatatypeConverter; import java.net.SocketAddress; import java.nio.charset.StandardCharsets; import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; public abstract class ExtendedObjectDecoder implements ChannelUpstreamHandler { @@ -69,6 +72,16 @@ public abstract class ExtendedObjectDecoder implements ChannelUpstreamHandler { saveOriginal(o, originalMessage); Channels.fireMessageReceived(ctx, o, e.getRemoteAddress()); } + } else if (decodedMessage instanceof Map) { + Iterator it = ((Map) decodedMessage).entrySet().iterator(); + while (it.hasNext()) { + Map.Entry pair = (Map.Entry) it.next(); + List<Position> positions = (List<Position>) pair.getValue(); + for (Position position : positions) { + saveOriginal(position, originalMessage); + Channels.fireMessageReceived(ctx, position, e.getRemoteAddress()); + } + } } else { saveOriginal(decodedMessage, originalMessage); Channels.fireMessageReceived(ctx, decodedMessage, e.getRemoteAddress()); |