diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-20 11:09:39 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-20 11:09:39 +1200 |
commit | 396a395ba7da5c5c6787fd14626642853b353087 (patch) | |
tree | 8cf755e1d192fac1f8a2a625233c0faa9a25a470 | |
parent | 3f74cffe385b9aebdc5f0d8b54e9e18f5392d783 (diff) | |
download | trackermap-server-396a395ba7da5c5c6787fd14626642853b353087.tar.gz trackermap-server-396a395ba7da5c5c6787fd14626642853b353087.tar.bz2 trackermap-server-396a395ba7da5c5c6787fd14626642853b353087.zip |
Add mask config to SkyPatrol
-rw-r--r-- | src/org/traccar/protocol/SkypatrolProtocolDecoder.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 55efc48c6..39aa5c562 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -15,23 +15,26 @@ */ package org.traccar.protocol; -import java.nio.charset.Charset; import java.net.SocketAddress; +import java.nio.charset.Charset; import java.util.Calendar; import java.util.TimeZone; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; +import org.traccar.Context; import org.traccar.helper.BitUtil; import org.traccar.helper.Log; import org.traccar.model.Event; import org.traccar.model.Position; public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { + + private long defaultMask; public SkypatrolProtocolDecoder(SkypatrolProtocol protocol) { super(protocol); + defaultMask = Context.getConfig().getInteger(getProtocolName() + ".mask"); } private static double convertCoordinate(long coordinate) { @@ -59,7 +62,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { int commandType = buf.readUnsignedByte(); int messageType = buf.getUnsignedByte(buf.readerIndex()) >> 4; boolean needAck = (buf.readUnsignedByte() & 0xf) == 1; - long mask = 0; + long mask = defaultMask; if (buf.readUnsignedByte() == 4) { mask = buf.readUnsignedInt(); } |