aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MegastekProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-30 10:02:26 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-30 10:03:09 +1300
commita017cdabef201be45e96379b58154163d68fc00f (patch)
tree608662393ad902a927acba90f9bf9571b12ada0f /src/org/traccar/protocol/MegastekProtocolDecoder.java
parentdd943e107a9680948747fb0ab2132cc57d027352 (diff)
downloadtrackermap-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/MegastekProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java16
1 files changed, 8 insertions, 8 deletions
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);
}
}