aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/MainEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-12 17:08:14 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-12 17:08:14 +1200
commitf1ae2d73584d4ddded6f727c665d97f03ecf9c25 (patch)
treea8058c0a02ab212692951d47bf9904d4f0539c76 /src/org/traccar/MainEventHandler.java
parentf304021d16e433b261226a8293f03e7de30a08a4 (diff)
downloadtrackermap-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.java13
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);
- }
-
}
}
}