From 1bc13e97012570e617856ee15e399ec6b24b86d2 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 20 May 2016 21:30:38 +0500 Subject: Small optimization and style fix --- src/org/traccar/protocol/WondexFrameDecoder.java | 2 +- src/org/traccar/protocol/WondexProtocolDecoder.java | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/WondexFrameDecoder.java b/src/org/traccar/protocol/WondexFrameDecoder.java index 7502c3320..c5309db71 100644 --- a/src/org/traccar/protocol/WondexFrameDecoder.java +++ b/src/org/traccar/protocol/WondexFrameDecoder.java @@ -44,7 +44,7 @@ public class WondexFrameDecoder extends FrameDecoder { } // Pass deviceId to protocol decoder long deviceId = ((Long.reverseBytes((frame.getLong(0)))) >> 32) & 0xFFFFFFFFL; - return ChannelBuffers.copiedBuffer("$ID:"+String.valueOf(deviceId), StandardCharsets.US_ASCII); + return ChannelBuffers.copiedBuffer("$ID:" + String.valueOf(deviceId), StandardCharsets.US_ASCII); } else { diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java index d35d1d930..d5c325037 100644 --- a/src/org/traccar/protocol/WondexProtocolDecoder.java +++ b/src/org/traccar/protocol/WondexProtocolDecoder.java @@ -60,17 +60,14 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder { Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { if (((String) msg).startsWith("$ID:")) { - identify(((String) msg).substring(4), channel, remoteAddress); + identify(((String) msg).substring(4), channel, remoteAddress); return null; - } - - else if (((String) msg).startsWith("$OK:") || ((String) msg).startsWith("$ERR:")) { + } else if (((String) msg).startsWith("$OK:") || ((String) msg).startsWith("$ERR:")) { Position position = new Position(); position.setProtocol(getProtocolName()); position.setDeviceId(getDeviceId()); - getLastLocation(position, null); - position.setTime(new Date()); + getLastLocation(position, new Date()); position.setValid(false); position.set(Event.KEY_RESULT, (String) msg); -- cgit v1.2.3