diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-28 02:49:55 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-28 02:49:55 +1300 |
commit | 85c43a28405deab09a15ffbc8fcaa38570b69cf8 (patch) | |
tree | dbe1e1c91dbdb512b88a0b5788c068c8ae83d5a0 /src/org/traccar/protocol/KhdProtocolDecoder.java | |
parent | 96f2d637d35fafa6226855eea6e39919848e1e80 (diff) | |
download | trackermap-server-85c43a28405deab09a15ffbc8fcaa38570b69cf8.tar.gz trackermap-server-85c43a28405deab09a15ffbc8fcaa38570b69cf8.tar.bz2 trackermap-server-85c43a28405deab09a15ffbc8fcaa38570b69cf8.zip |
Add terminal id to KHD commands
Diffstat (limited to 'src/org/traccar/protocol/KhdProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/KhdProtocolDecoder.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java index d1b5413e5..2f29a16f8 100644 --- a/src/org/traccar/protocol/KhdProtocolDecoder.java +++ b/src/org/traccar/protocol/KhdProtocolDecoder.java @@ -36,17 +36,10 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder { private String readSerialNumber(ChannelBuffer buf) { int b1 = buf.readUnsignedByte(); - int b2 = buf.readUnsignedByte(); - if (b2 > 0x80) { - b2 -= 0x80; - } - int b3 = buf.readUnsignedByte(); - if (b3 > 0x80) { - b3 -= 0x80; - } + int b2 = buf.readUnsignedByte() - 0x80; + int b3 = buf.readUnsignedByte() - 0x80; int b4 = buf.readUnsignedByte(); - String serialNumber = String.format("%02d%02d%02d%02d", b1, b2, b3, b4); - return String.valueOf(Long.parseLong(serialNumber)); + return String.format("%02d%02d%02d%02d", b1, b2, b3, b4); } public static final int MSG_LOGIN = 0xB1; |