aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/H02ProtocolDecoder.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/H02ProtocolDecoder.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/H02ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java12
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;