aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/TrackerEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-01-12 00:56:03 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-01-12 00:56:03 +1300
commit900cbdd8b23cf0e9266523b21f2251510fcc1468 (patch)
treeffe824e491bd01a2df1e144a820ec175834d07f8 /src/org/traccar/TrackerEventHandler.java
parentf10f359d0531417b11a2a0fa1862efd6eae742b9 (diff)
downloadtrackermap-server-900cbdd8b23cf0e9266523b21f2251510fcc1468.tar.gz
trackermap-server-900cbdd8b23cf0e9266523b21f2251510fcc1468.tar.bz2
trackermap-server-900cbdd8b23cf0e9266523b21f2251510fcc1468.zip
Integrate new web interface
Diffstat (limited to 'src/org/traccar/TrackerEventHandler.java')
-rw-r--r--src/org/traccar/TrackerEventHandler.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/TrackerEventHandler.java b/src/org/traccar/TrackerEventHandler.java
index 11cf41fad..538e71cdf 100644
--- a/src/org/traccar/TrackerEventHandler.java
+++ b/src/org/traccar/TrackerEventHandler.java
@@ -38,7 +38,7 @@ public class TrackerEventHandler extends IdleStateAwareChannelHandler {
super();
dataManager = newDataManager;
}
-
+
private void processSinglePosition(Position position) {
if (position == null) {
Log.info("null message");
@@ -58,7 +58,10 @@ public class TrackerEventHandler extends IdleStateAwareChannelHandler {
// Write position to database
try {
- dataManager.addPosition(position);
+ Long id = dataManager.addPosition(position);
+ if (id != null) {
+ dataManager.updateLatestPosition(position.getDeviceId(), id);
+ }
} catch (Exception error) {
Log.info("Exception during query execution");
Log.warning(error.getMessage());
@@ -82,7 +85,7 @@ public class TrackerEventHandler extends IdleStateAwareChannelHandler {
Log.info("Closing connection by disconnect");
e.getChannel().close();
}
-
+
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
Log.info("Closing connection by exception");
@@ -94,5 +97,5 @@ public class TrackerEventHandler extends IdleStateAwareChannelHandler {
Log.info("Closing connection by timeout");
e.getChannel().close();
}
-
+
}