diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-12 17:08:14 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-12 17:08:14 +1200 |
commit | f1ae2d73584d4ddded6f727c665d97f03ecf9c25 (patch) | |
tree | a8058c0a02ab212692951d47bf9904d4f0539c76 /src/org/traccar/MainEventHandler.java | |
parent | f304021d16e433b261226a8293f03e7de30a08a4 (diff) | |
download | trackermap-server-f1ae2d73584d4ddded6f727c665d97f03ecf9c25.tar.gz trackermap-server-f1ae2d73584d4ddded6f727c665d97f03ecf9c25.tar.bz2 trackermap-server-f1ae2d73584d4ddded6f727c665d97f03ecf9c25.zip |
Implement web data handler
Diffstat (limited to 'src/org/traccar/MainEventHandler.java')
-rw-r--r-- | src/org/traccar/MainEventHandler.java | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/org/traccar/MainEventHandler.java b/src/org/traccar/MainEventHandler.java index 30ec75f58..b32d577de 100644 --- a/src/org/traccar/MainEventHandler.java +++ b/src/org/traccar/MainEventHandler.java @@ -31,27 +31,18 @@ public class MainEventHandler extends IdleStateAwareChannelHandler { public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) { if (e.getMessage() != null) { - if (e.getMessage() instanceof Position) { Position position = (Position) e.getMessage(); // Log position StringBuilder s = new StringBuilder(); - s.append("device: ").append(position.getDeviceId()).append(", "); + s.append(formatChannel(e.getChannel())).append(" "); + s.append("id: ").append(position.getDeviceId()).append(", "); s.append("time: ").append(position.getFixTime()).append(", "); s.append("lat: ").append(position.getLatitude()).append(", "); s.append("lon: ").append(position.getLongitude()); Log.info(s.toString()); - - try { - Context.getDataManager().addPosition(position); - Context.getDataManager().updateLatestPosition(position); - Context.getConnectionManager().update(position); - } catch (Exception error) { - Log.warning(error); - } - } } } |