diff options
author | Parveen Kumar Yadav <parveenkumardeeva@gmail.com> | 2018-04-13 10:47:42 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-13 10:47:42 +0530 |
commit | d448823edd0e8a7833c79b980cfe9778b849843a (patch) | |
tree | 50ad1ab51b93915cff422a1834baa5a2c579fce8 /src/org/traccar/protocol/KhdProtocolDecoder.java | |
parent | 2c8392a0e16044905d983da56ab0919eadbb3858 (diff) | |
parent | 617393cf9f052298f7fb35f0c58138c87a6dd5c3 (diff) | |
download | trackermap-server-d448823edd0e8a7833c79b980cfe9778b849843a.tar.gz trackermap-server-d448823edd0e8a7833c79b980cfe9778b849843a.tar.bz2 trackermap-server-d448823edd0e8a7833c79b980cfe9778b849843a.zip |
Merge pull request #1 from traccar/master
Bringing Fork Up to Date
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; |