aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorNikolay Vlahovski <nvlahovski@gmail.com>2023-05-17 12:10:17 +0300
committerNikolay Vlahovski <nvlahovski@gmail.com>2023-05-17 12:10:17 +0300
commit34f6dfbf1d2c48ae932fa7565dd30d2817d2c1f9 (patch)
tree47d4e935c1aacd4f6d201fa1c4810de9459c8090 /src/main/java/org/traccar
parentb7d46d78adc763eea3aae838f4e056e12e2dc487 (diff)
downloadtrackermap-server-34f6dfbf1d2c48ae932fa7565dd30d2817d2c1f9.tar.gz
trackermap-server-34f6dfbf1d2c48ae932fa7565dd30d2817d2c1f9.tar.bz2
trackermap-server-34f6dfbf1d2c48ae932fa7565dd30d2817d2c1f9.zip
remove extra empty lines
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java b/src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java
index 759c012b8..acb46ec48 100644
--- a/src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TranSyncProtocolDecoder.java
@@ -131,7 +131,9 @@ public class TranSyncProtocolDecoder extends BaseProtocolDecoder {
@Override
protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+
ByteBuf buf = (ByteBuf) msg;
+
if (Arrays.equals(ByteBufUtil.getBytes(buf, 0, 2), STX)) {
buf.readUnsignedShort();
}
@@ -183,14 +185,14 @@ public class TranSyncProtocolDecoder extends BaseProtocolDecoder {
position.setNetwork(new Network(cellTower));
- if (buf.readableBytes() > 2) {
+ if (buf.readableBytes() > 5) {
buf.readUnsignedByte(); // odometerIndex
int odometerLength = buf.readUnsignedByte();
if (odometerLength > 0) {
int odometer = buf.readBytes(odometerLength).readInt();
position.set(Position.KEY_ODOMETER, odometer);
}
- if ((buf.readableBytes() > 2)) {
+ if ((buf.readableBytes() > 5)) {
buf.readUnsignedByte(); // tagIndex
int tagLength = buf.readUnsignedByte();
if (tagLength > 0) {
@@ -205,7 +207,7 @@ public class TranSyncProtocolDecoder extends BaseProtocolDecoder {
}
}
if ((buf.readableBytes() > 5)) {
- buf.readUnsignedByte(); // adc2Index
+ buf.readUnsignedByte(); // adc3Index
int adc2Length = buf.readUnsignedByte();
if (adc2Length > 0 && adc2Length <= buf.readableBytes() - 2) {
position.set(Position.PREFIX_ADC + 3, buf.readUnsignedShort());