aboutsummaryrefslogtreecommitdiff
path: root/src/net/sourceforge/opentracking/TrackerEventHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/sourceforge/opentracking/TrackerEventHandler.java')
-rw-r--r--src/net/sourceforge/opentracking/TrackerEventHandler.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/net/sourceforge/opentracking/TrackerEventHandler.java b/src/net/sourceforge/opentracking/TrackerEventHandler.java
index b47f3be5a..d052cb86e 100644
--- a/src/net/sourceforge/opentracking/TrackerEventHandler.java
+++ b/src/net/sourceforge/opentracking/TrackerEventHandler.java
@@ -40,21 +40,23 @@ public class TrackerEventHandler extends SimpleChannelHandler {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
- //System.out.println("message recieved");
-
if (e.getMessage() instanceof Position) {
+
+ Position position = (Position) e.getMessage();
+
+ System.out.println("id: " + position.getDeviceId() + ", lat: " + position.getLatitude() + ", lon: " + position.getLongitude() );
// Write position to database
try {
- dataManager.setPosition((Position) e.getMessage());
+ dataManager.setPosition(position);
} catch (Exception error) {
+ System.out.println(error.getMessage());
}
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
- //System.out.println("error: " + e.getCause().getMessage());
e.getChannel().close();
}