From a017cdabef201be45e96379b58154163d68fc00f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 30 Nov 2015 10:02:26 +1300 Subject: Always pass remote address to identify method --- src/org/traccar/protocol/Jt600ProtocolDecoder.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/org/traccar/protocol/Jt600ProtocolDecoder.java') diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index b576b063d..7c6ab8a4d 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -42,7 +42,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { return degrees + minutes / 60; } - private Position decodeNormalMessage(ChannelBuffer buf, Channel channel) { + private Position decodeNormalMessage(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) { Position position = new Position(); position.setProtocol(getProtocolName()); @@ -50,7 +50,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { buf.readByte(); // header String id = String.valueOf(Long.parseLong(ChannelBuffers.hexDump(buf.readBytes(5)))); - if (!identify(id, channel)) { + if (!identify(id, channel, remoteAddress)) { return null; } position.setDeviceId(getDeviceId()); @@ -139,7 +139,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { .text(")") .compile(); - private Position decodeAlertMessage(ChannelBuffer buf, Channel channel) { + private Position decodeAlertMessage(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) { Parser parser = new Parser(PATTERN, buf.toString(Charset.defaultCharset())); if (!parser.matches()) { @@ -151,7 +151,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_ALARM, true); - if (!identify(parser.next(), channel)) { + if (!identify(parser.next(), channel, remoteAddress)) { return null; } position.setDeviceId(getDeviceId()); @@ -181,9 +181,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { char first = (char) buf.getByte(0); if (first == '$') { - return decodeNormalMessage(buf, channel); + return decodeNormalMessage(buf, channel, remoteAddress); } else if (first == '(') { - return decodeAlertMessage(buf, channel); + return decodeAlertMessage(buf, channel, remoteAddress); } return null; -- cgit v1.2.3