aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gl200ProtocolDecoder.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-10-05 14:20:59 +0500
committerAbyss777 <abyss@fox5.ru>2016-10-05 14:20:59 +0500
commit664cc129f1a5ad13fab966d3c293e7aa6ce12ab6 (patch)
tree13c7e8eb020ad36f67c0c74161b7c9550558d08b /src/org/traccar/protocol/Gl200ProtocolDecoder.java
parent44d36f3adea94b98c88b6e491d22f4466678ad6d (diff)
downloadtrackermap-server-664cc129f1a5ad13fab966d3c293e7aa6ce12ab6.tar.gz
trackermap-server-664cc129f1a5ad13fab966d3c293e7aa6ce12ab6.tar.bz2
trackermap-server-664cc129f1a5ad13fab966d3c293e7aa6ce12ab6.zip
- Remove hardcoded password from commands
- Authenticate device on heardbeat stage
Diffstat (limited to 'src/org/traccar/protocol/Gl200ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java9
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..362e3fb38 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;
}