diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-29 11:01:41 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-29 11:01:41 +1200 |
commit | 33773135d333605059f0cb78282edd3a9438440e (patch) | |
tree | 488001305d35d1747b8fdd2a16c448da1db7694a /src/org/traccar/protocol/Gps103ProtocolDecoder.java | |
parent | 55448d82b2971bc16c67bfa2b2e996d81c4c702e (diff) | |
download | trackermap-server-33773135d333605059f0cb78282edd3a9438440e.tar.gz trackermap-server-33773135d333605059f0cb78282edd3a9438440e.tar.bz2 trackermap-server-33773135d333605059f0cb78282edd3a9438440e.zip |
Improved gps103 protocol identification (fix #1272)
Diffstat (limited to 'src/org/traccar/protocol/Gps103ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 6 |
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; } |