aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MegastekProtocolDecoder.java
diff options
context:
space:
mode:
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);
}
}