diff options
author | Anton Tananaev <anton@traccar.org> | 2024-07-07 07:33:16 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-07-07 07:33:16 -0700 |
commit | d0536ccbc1b7234784c5e48288bbac00a60ef821 (patch) | |
tree | 29ba8e1349eb9a5990f564edad7ddc7b5e24d7f7 /src/main/java/org/traccar/protocol/TramigoProtocolDecoder.java | |
parent | 864872b2df3e26c94d3a5826f4df504de3cf6c62 (diff) | |
download | trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.gz trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.bz2 trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.zip |
Update switch statements
Diffstat (limited to 'src/main/java/org/traccar/protocol/TramigoProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/TramigoProtocolDecoder.java | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/src/main/java/org/traccar/protocol/TramigoProtocolDecoder.java b/src/main/java/org/traccar/protocol/TramigoProtocolDecoder.java index 4a9a9a58f..f12211f81 100644 --- a/src/main/java/org/traccar/protocol/TramigoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/TramigoProtocolDecoder.java @@ -167,7 +167,7 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder { while (buf.isReadable()) { int type = buf.readUnsignedByte(); switch (type) { - case 0: + case 0 -> { position.set(Position.KEY_EVENT, buf.readUnsignedShortLE()); buf.readUnsignedIntLE(); // event data @@ -193,34 +193,19 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder { position.setFixTime(new Date(buf.readUnsignedIntLE() * 1000)); buf.readUnsignedByte(); // reserved - break; - case 1: - buf.skipBytes(buf.readUnsignedShortLE() - 3); // landmark - break; - case 4: - buf.skipBytes(53); // trip - break; - case 20: - buf.skipBytes(32); // extended - break; - case 22: + } + case 1 -> buf.skipBytes(buf.readUnsignedShortLE() - 3); // landmark + case 4 -> buf.skipBytes(53); // trip + case 20 -> buf.skipBytes(32); // extended + case 22 -> { buf.readUnsignedByte(); // zone flag buf.skipBytes(buf.readUnsignedShortLE()); // zone name - break; - case 30: - buf.skipBytes(79); // system status - break; - case 40: - buf.skipBytes(40); // analog - break; - case 50: - buf.skipBytes(buf.readUnsignedShortLE() - 3); // console - break; - case 255: - buf.skipBytes(4); // acknowledgement - break; - default: - throw new IllegalArgumentException(String.format("Unknown type %d", type)); + } + case 30 -> buf.skipBytes(79); // system status + case 40 -> buf.skipBytes(40); // analog + case 50 -> buf.skipBytes(buf.readUnsignedShortLE() - 3); // console + case 255 -> buf.skipBytes(4); // acknowledgement + default -> throw new IllegalArgumentException(String.format("Unknown type %d", type)); } } |