diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-06 15:58:35 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-06 15:58:35 +1300 |
commit | e60ecc5f2bc8bb6c53e95c4db2e68cbca79c6e54 (patch) | |
tree | ab64a642ff7a3bd66ae9cdb57d5d347bc2b47bf1 /src/org/traccar/protocol/CityeasyProtocolDecoder.java | |
parent | c8ad5cc5c45ab47abe35e3ad2e4f607d520e627d (diff) | |
download | trackermap-server-e60ecc5f2bc8bb6c53e95c4db2e68cbca79c6e54.tar.gz trackermap-server-e60ecc5f2bc8bb6c53e95c4db2e68cbca79c6e54.tar.bz2 trackermap-server-e60ecc5f2bc8bb6c53e95c4db2e68cbca79c6e54.zip |
Implement Cityeasy protocol commands
Diffstat (limited to 'src/org/traccar/protocol/CityeasyProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/CityeasyProtocolDecoder.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java index 4cb0562a6..457ba9c5d 100644 --- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java +++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java @@ -25,7 +25,7 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.helper.ChannelBufferTools; -import org.traccar.helper.Crc; +import org.traccar.helper.Checksum; import org.traccar.model.Event; import org.traccar.model.Position; @@ -51,8 +51,14 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder { "(\\d+)" + // Cell ".*"); - private static final int MSG_LOCATION_REPORT = 0x0003; - private static final int MSG_LOCATION_INQUIRY_RESPONSE = 0x0004; + public static final int MSG_ADDRESS_REQUEST = 0x0001; + public static final int MSG_STATUS = 0x0002; + public static final int MSG_LOCATION_REPORT = 0x0003; + public static final int MSG_LOCATION_REQUEST = 0x0004; + public static final int MSG_LOCATION_INTERVAL = 0x0005; + public static final int MSG_PHONE_NUMBER = 0x0006; + public static final int MSG_MONITORING = 0x0007; + public static final int MSG_TIMEZONE = 0x0008; @Override protected Object decode( @@ -66,14 +72,14 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder { String imei = ChannelBufferTools.readHexString(buf, 14); if (!identify(imei, channel, null, false)) { - if (!identify(imei + Crc.luhnChecksum(Long.parseLong(imei)), channel)) { + if (!identify(imei + Checksum.luhnChecksum(Long.parseLong(imei)), channel)) { return null; } } int type = buf.readUnsignedShort(); - if (type == MSG_LOCATION_REPORT || type == MSG_LOCATION_INQUIRY_RESPONSE) { + if (type == MSG_LOCATION_REPORT || type == MSG_LOCATION_REQUEST) { String sentence = buf.toString(buf.readerIndex(), buf.readableBytes() - 8, Charset.defaultCharset()); Matcher parser = pattern.matcher(sentence); |