diff options
Diffstat (limited to 'src/org/traccar/protocol/H02ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/H02ProtocolDecoder.java | 12 |
1 files changed, 6 insertions, 6 deletions
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; |