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/MegastekProtocolDecoder.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/org/traccar/protocol/MegastekProtocolDecoder.java') diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index dc9e6056e..e28bf6c1d 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -99,7 +99,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { return true; } - private Position decodeOld(Channel channel, String sentence) { + private Position decodeOld(Channel channel, SocketAddress remoteAddress, String sentence) { // Detect type boolean simple = sentence.charAt(3) == ',' || sentence.charAt(6) == ','; @@ -157,7 +157,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_ALARM, parser.next()); - if (!identify(parser.next(), channel, null, false) && !identify(id, channel)) { + if (!identify(parser.next(), channel, remoteAddress, false) && !identify(id, channel, remoteAddress)) { return null; } position.setDeviceId(getDeviceId()); @@ -182,7 +182,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { } else { - if (!identify(id, channel)) { + if (!identify(id, channel, remoteAddress)) { return null; } position.setDeviceId(getDeviceId()); @@ -194,7 +194,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { Parser parser = new Parser(PATTERN_ALTERNATIVE, status); if (parser.matches()) { - if (!identify(id, channel)) { + if (!identify(id, channel, remoteAddress)) { return null; } position.setDeviceId(getDeviceId()); @@ -264,7 +264,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { .any() .compile(); - private Position decodeNew(Channel channel, String sentence) { + private Position decodeNew(Channel channel, SocketAddress remoteAddress, String sentence) { Parser parser = new Parser(PATTERN_NEW, sentence); if (!parser.matches()) { @@ -274,7 +274,7 @@ public class MegastekProtocolDecoder 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()); @@ -343,9 +343,9 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { String sentence = (String) msg; if (sentence.startsWith("$MG")) { - return decodeNew(channel, sentence); + return decodeNew(channel, remoteAddress, sentence); } else { - return decodeOld(channel, sentence); + return decodeOld(channel, remoteAddress, sentence); } } -- cgit v1.2.3