diff options
author | Iván Ávalos <avalos@disroot.org> | 2024-08-03 20:52:00 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2024-08-03 20:52:00 -0600 |
commit | 55f6d92c09a5b1d8566b53633d07be3d31010d3b (patch) | |
tree | b86bed801b0bbadb72c7e839296dae1d28b12bbb /src/main/java/org/traccar/protocol/TramigoProtocolDecoder.java | |
parent | c04ad7d48331253c095fc123ded1b00f6ff871d3 (diff) | |
parent | 2788174193def918a3a1a5be3bbed24c9613323f (diff) | |
download | trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.gz trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.bz2 trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.zip |
Merge tag 'tags/v6.3'
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)); } } |