diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-10-05 22:44:01 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-05 22:44:01 +1300 |
commit | 273a1b8faba5894d83c7feb64fce6351817be769 (patch) | |
tree | 439ab219a1facfd5f289c22076c3d13a5fbab3d0 /src/org/traccar/protocol/Gl200ProtocolDecoder.java | |
parent | 44d36f3adea94b98c88b6e491d22f4466678ad6d (diff) | |
parent | 1160c79fa59518f70183aea4b58b12755bdf6475 (diff) | |
download | trackermap-server-273a1b8faba5894d83c7feb64fce6351817be769.tar.gz trackermap-server-273a1b8faba5894d83c7feb64fce6351817be769.tar.bz2 trackermap-server-273a1b8faba5894d83c7feb64fce6351817be769.zip |
Merge pull request #2407 from Abyss777/gl200
GL200 Password for commands and heartbeat authentication
Diffstat (limited to 'src/org/traccar/protocol/Gl200ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 385039399..b55f4e606 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -39,7 +39,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN_HBD = new PatternBuilder() .text("+ACK:GTHBD,") - .number("([0-9A-Z]{2}xxxx),") + .number("([0-9A-Z]{2}xxxx),") // protocol version + .number("(d{15}),") // imei .any().text(",") .number("(xxxx)") .text("$").optional() @@ -245,7 +246,11 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { private Object decodeHbd(Channel channel, SocketAddress remoteAddress, String sentence) { Parser parser = new Parser(PATTERN_HBD, sentence); if (parser.matches() && channel != null) { - channel.write("+SACK:GTHBD," + parser.next() + "," + parser.next() + "$", remoteAddress); + String protocolVersion = parser.next(); + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); + if (deviceSession != null) { + channel.write("+SACK:GTHBD," + protocolVersion + "," + parser.next() + "$", remoteAddress); + } } return null; } |