diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-08-11 10:59:06 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-08-11 10:59:06 -0700 |
commit | 34588a82377708f8664427cae0bd4dea8a582764 (patch) | |
tree | 16b97e587c28d091d7ac3de1c084b1d15ebb4d8d /src/main/java/org/traccar/protocol/T800xProtocolDecoder.java | |
parent | b1d7e4d00072e8293051d502311a5f826eb95287 (diff) | |
download | traccar-server-34588a82377708f8664427cae0bd4dea8a582764.tar.gz traccar-server-34588a82377708f8664427cae0bd4dea8a582764.tar.bz2 traccar-server-34588a82377708f8664427cae0bd4dea8a582764.zip |
Use correct header
Diffstat (limited to 'src/main/java/org/traccar/protocol/T800xProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/T800xProtocolDecoder.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java index 5c2c26da7..4351a14bf 100644 --- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java @@ -37,10 +37,18 @@ import java.util.Date; public class T800xProtocolDecoder extends BaseProtocolDecoder { + private short header = DEFAULT_HEADER; + + public short getHeader() { + return header; + } + public T800xProtocolDecoder(Protocol protocol) { super(protocol); } + public static final short DEFAULT_HEADER = 0x2323; + public static final int MSG_LOGIN = 0x01; public static final int MSG_GPS = 0x02; public static final int MSG_HEARTBEAT = 0x03; @@ -110,7 +118,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { ByteBuf buf = (ByteBuf) msg; - short header = buf.readShort(); + header = buf.readShort(); int type = buf.readUnsignedByte(); buf.readUnsignedShort(); // length int index = buf.readUnsignedShort(); @@ -128,7 +136,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { if (type == MSG_GPS || type == MSG_ALARM) { - return decodePosition(channel, deviceSession, buf, header, type, index, imei); + return decodePosition(channel, deviceSession, buf, type, index, imei); } else if (type == MSG_NETWORK) { @@ -169,7 +177,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { private Position decodePosition( Channel channel, DeviceSession deviceSession, - ByteBuf buf, short header, int type, int index, ByteBuf imei) { + ByteBuf buf, int type, int index, ByteBuf imei) { Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); |