aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 5dadd10e4..3f21beea8 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -59,6 +59,8 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
"([^,;]+)?,?" +
".*");
+ private static final Pattern handshakePattern = Pattern.compile("##,imei:(\\d+),A");
+
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, SocketAddress remoteAddress, Object msg)
@@ -70,6 +72,10 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
if (sentence.contains("##")) {
if (channel != null) {
channel.write("LOAD", remoteAddress);
+ Matcher handshakeMatcher = handshakePattern.matcher(sentence);
+ if(handshakeMatcher.matches()) {
+ identify(handshakeMatcher.group(1), channel);
+ }
}
return null;
}