diff options
Diffstat (limited to 'src/org/traccar/MainEventHandler.java')
-rw-r--r-- | src/org/traccar/MainEventHandler.java | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/org/traccar/MainEventHandler.java b/src/org/traccar/MainEventHandler.java index 933d0d975..8b94a68c9 100644 --- a/src/org/traccar/MainEventHandler.java +++ b/src/org/traccar/MainEventHandler.java @@ -30,24 +30,22 @@ public class MainEventHandler extends IdleStateAwareChannelHandler { @Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) { - if (e.getMessage() != null) { - if (e.getMessage() instanceof Position) { + if (e.getMessage() != null && e.getMessage() instanceof Position) { - Position position = (Position) e.getMessage(); + Position position = (Position) e.getMessage(); - // Log position - StringBuilder s = new StringBuilder(); - 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()).append(", "); - s.append("speed: ").append(position.getSpeed()).append(", "); - s.append("course: ").append(position.getCourse()); - Log.info(s.toString()); + // Log position + StringBuilder s = new StringBuilder(); + 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()).append(", "); + s.append("speed: ").append(position.getSpeed()).append(", "); + s.append("course: ").append(position.getCourse()); + Log.info(s.toString()); - Context.getConnectionManager().update(position); - } + Context.getConnectionManager().update(position); } } |