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/T622IridiumProtocolDecoder.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/T622IridiumProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/T622IridiumProtocolDecoder.java | 74 |
1 files changed, 18 insertions, 56 deletions
diff --git a/src/main/java/org/traccar/protocol/T622IridiumProtocolDecoder.java b/src/main/java/org/traccar/protocol/T622IridiumProtocolDecoder.java index 9e64ec9be..c58960ab5 100644 --- a/src/main/java/org/traccar/protocol/T622IridiumProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/T622IridiumProtocolDecoder.java @@ -84,62 +84,24 @@ public class T622IridiumProtocolDecoder extends BaseProtocolDecoder { for (int parameter : parameters) { switch (parameter) { - case 0x01: - position.set(Position.KEY_EVENT, buf.readUnsignedByte()); - break; - case 0x02: - position.setLatitude(buf.readIntLE() / 1000000.0); - break; - case 0x03: - position.setLongitude(buf.readIntLE() / 1000000.0); - break; - case 0x04: - position.setTime(new Date((buf.readUnsignedIntLE() + 946684800) * 1000)); - break; - case 0x05: - position.setValid(buf.readUnsignedByte() > 0); - break; - case 0x06: - position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); - break; - case 0x07: - position.set(Position.KEY_RSSI, buf.readUnsignedByte()); - break; - case 0x08: - position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE())); - break; - case 0x09: - position.setCourse(buf.readUnsignedShortLE()); - break; - case 0x0A: - position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1); - break; - case 0x0B: - position.setAltitude(buf.readShortLE()); - break; - case 0x0C: - position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE()); - break; - case 0x0D: - position.set(Position.KEY_HOURS, buf.readUnsignedIntLE() * 1000); - break; - case 0x14: - position.set(Position.KEY_OUTPUT, buf.readUnsignedByte()); - break; - case 0x15: - position.set(Position.KEY_INPUT, buf.readUnsignedByte()); - break; - case 0x19: - position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.01); - break; - case 0x1A: - position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.01); - break; - case 0x1B: - buf.readUnsignedByte(); // geofence - break; - default: - break; + case 0x01 -> position.set(Position.KEY_EVENT, buf.readUnsignedByte()); + case 0x02 -> position.setLatitude(buf.readIntLE() / 1000000.0); + case 0x03 -> position.setLongitude(buf.readIntLE() / 1000000.0); + case 0x04 -> position.setTime(new Date((buf.readUnsignedIntLE() + 946684800) * 1000)); + case 0x05 -> position.setValid(buf.readUnsignedByte() > 0); + case 0x06 -> position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); + case 0x07 -> position.set(Position.KEY_RSSI, buf.readUnsignedByte()); + case 0x08 -> position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE())); + case 0x09 -> position.setCourse(buf.readUnsignedShortLE()); + case 0x0A -> position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1); + case 0x0B -> position.setAltitude(buf.readShortLE()); + case 0x0C -> position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE()); + case 0x0D -> position.set(Position.KEY_HOURS, buf.readUnsignedIntLE() * 1000); + case 0x14 -> position.set(Position.KEY_OUTPUT, buf.readUnsignedByte()); + case 0x15 -> position.set(Position.KEY_INPUT, buf.readUnsignedByte()); + case 0x19 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.01); + case 0x1A -> position.set(Position.KEY_POWER, buf.readUnsignedShortLE() * 0.01); + case 0x1B -> buf.readUnsignedByte(); // geofence } } |