diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-30 10:02:26 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-30 10:03:09 +1300 |
commit | a017cdabef201be45e96379b58154163d68fc00f (patch) | |
tree | 608662393ad902a927acba90f9bf9571b12ada0f /src/org/traccar/protocol/MeitrackProtocolDecoder.java | |
parent | dd943e107a9680948747fb0ab2132cc57d027352 (diff) | |
download | trackermap-server-a017cdabef201be45e96379b58154163d68fc00f.tar.gz trackermap-server-a017cdabef201be45e96379b58154163d68fc00f.tar.bz2 trackermap-server-a017cdabef201be45e96379b58154163d68fc00f.zip |
Always pass remote address to identify method
Diffstat (limited to 'src/org/traccar/protocol/MeitrackProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/MeitrackProtocolDecoder.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 4bde5cf75..e0ca01412 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -79,7 +79,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { .text("\r\n").optional() .compile(); - private Position decodeRegularMessage(Channel channel, ChannelBuffer buf) { + private Position decodeRegularMessage(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) { Parser parser = new Parser(PATTERN, buf.toString(Charset.defaultCharset())); if (!parser.matches()) { @@ -89,7 +89,7 @@ public class MeitrackProtocolDecoder 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()); @@ -155,14 +155,14 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { return position; } - private List<Position> decodeBinaryMessage(Channel channel, ChannelBuffer buf) { + private List<Position> decodeBinaryMessage(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) { List<Position> positions = new LinkedList<>(); String flag = buf.toString(2, 1, Charset.defaultCharset()); int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ','); String imei = buf.toString(index + 1, 15, Charset.defaultCharset()); - if (!identify(imei, channel)) { + if (!identify(imei, channel, remoteAddress)) { return null; } @@ -238,9 +238,9 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { String type = buf.toString(index + 1, 3, Charset.defaultCharset()); if (type.equals("CCC")) { - return decodeBinaryMessage(channel, buf); + return decodeBinaryMessage(channel, remoteAddress, buf); } else { - return decodeRegularMessage(channel, buf); + return decodeRegularMessage(channel, remoteAddress, buf); } } |