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/H02ProtocolDecoder.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/org/traccar/protocol/H02ProtocolDecoder.java') diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index 31bdd9aa9..2b8adda4a 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -70,14 +70,14 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_STATUS, status); } - private Position decodeBinary(ChannelBuffer buf, Channel channel) { + private Position decodeBinary(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) { Position position = new Position(); position.setProtocol(getProtocolName()); buf.readByte(); // marker - if (!identify(ChannelBuffers.hexDump(buf.readBytes(5)), channel)) { + if (!identify(ChannelBuffers.hexDump(buf.readBytes(5)), channel, remoteAddress)) { return null; } position.setDeviceId(getDeviceId()); @@ -141,7 +141,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { .any() .compile(); - private Position decodeText(String sentence, Channel channel) { + private Position decodeText(String sentence, Channel channel, SocketAddress remoteAddress) { Parser parser = new Parser(PATTERN, sentence); if (!parser.matches()) { @@ -151,7 +151,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(); position.setProtocol(getProtocolName()); - if (!identify(parser.next(), channel)) { + if (!identify(parser.next(), channel, remoteAddress)) { return null; } position.setDeviceId(getDeviceId()); @@ -198,9 +198,9 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { // handle X mode? if (marker.equals("*")) { - return decodeText(buf.toString(Charset.defaultCharset()), channel); + return decodeText(buf.toString(Charset.defaultCharset()), channel, remoteAddress); } else if (marker.equals("$")) { - return decodeBinary(buf, channel); + return decodeBinary(buf, channel, remoteAddress); } return null; -- cgit v1.2.3