diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-08-26 20:09:00 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-08-26 20:09:08 -0700 |
commit | 6c3c6c5ead98e38b152685dd3528c0f70cdcac50 (patch) | |
tree | e13955a13e858e1826bec734229e5cbabcb6e537 /src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | |
parent | 8c20ee9f2eb3e321204c524ce4fd013d175bb674 (diff) | |
download | traccar-server-6c3c6c5ead98e38b152685dd3528c0f70cdcac50.tar.gz traccar-server-6c3c6c5ead98e38b152685dd3528c0f70cdcac50.tar.bz2 traccar-server-6c3c6c5ead98e38b152685dd3528c0f70cdcac50.zip |
Fix code style issue
Diffstat (limited to 'src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index a8524808c..7b510639a 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -1039,25 +1039,6 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { return position; - } else if (type == MSG_SERIAL) { - - getLastLocation(position, null); - - buf.readUnsignedByte(); // external device type code - int length = buf.readableBytes() - 9; // line break + checksum + index + checksum + footer - if (length < 8) { - position.set( - Position.PREFIX_TEMP + 1, - Double.parseDouble(buf.readCharSequence(length - 1, StandardCharsets.US_ASCII).toString())); - } else { - buf.readUnsignedByte(); // card type - position.set( - Position.KEY_DRIVER_UNIQUE_ID, - buf.readCharSequence(length - 1, StandardCharsets.US_ASCII).toString()); - } - - return position; - } else if (type == MSG_GPS_MODULAR) { return decodeExtendedModular(buf, deviceSession); @@ -1225,6 +1206,27 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { return position; + } else if (type == MSG_SERIAL) { + + position = new Position(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + getLastLocation(position, null); + + buf.readUnsignedByte(); // external device type code + int length = buf.readableBytes() - 9; // line break + checksum + index + checksum + footer + if (length < 8) { + position.set( + Position.PREFIX_TEMP + 1, + Double.parseDouble(buf.readCharSequence(length - 1, StandardCharsets.US_ASCII).toString())); + } else { + buf.readUnsignedByte(); // card type + position.set( + Position.KEY_DRIVER_UNIQUE_ID, + buf.readCharSequence(length - 1, StandardCharsets.US_ASCII).toString()); + } + + return position; + } return null; |