diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-23 21:42:43 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-23 21:42:43 +1300 |
commit | ac2f547aa7799e471a8f4a71812fe8efdf5505c5 (patch) | |
tree | 163b16ca93714fb18be5c432324433177bff8f41 /src/org/traccar/protocol | |
parent | 23086613c6e88aa768afa795340fe9ac0ac3a7db (diff) | |
download | trackermap-server-ac2f547aa7799e471a8f4a71812fe8efdf5505c5.tar.gz trackermap-server-ac2f547aa7799e471a8f4a71812fe8efdf5505c5.tar.bz2 trackermap-server-ac2f547aa7799e471a8f4a71812fe8efdf5505c5.zip |
Fix Norad decoder (fix #610)
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/NoranProtocolDecoder.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java index 7fecf18e1..fc4654016 100644 --- a/src/org/traccar/protocol/NoranProtocolDecoder.java +++ b/src/org/traccar/protocol/NoranProtocolDecoder.java @@ -15,6 +15,7 @@ */ package org.traccar.protocol; +import java.net.SocketAddress; import java.nio.ByteOrder; import java.nio.charset.Charset; import java.util.Calendar; @@ -45,11 +46,11 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder { @Override protected Object decode( - ChannelHandlerContext ctx, Channel channel, Object msg) + ChannelHandlerContext ctx, Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { ChannelBuffer buf = (ChannelBuffer) msg; - + buf.readUnsignedShort(); // length int type = buf.readUnsignedShort(); @@ -63,7 +64,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder { response.writeByte(1); // status response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n", Charset.defaultCharset())); - channel.write(response); + channel.write(response, remoteAddress); } else if (type == MSG_UPLOAD_POSITION || @@ -111,6 +112,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); } catch(Exception error) { Log.warning("Unknown device - " + id); + return null; } // IO status |