From d0536ccbc1b7234784c5e48288bbac00a60ef821 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 7 Jul 2024 07:33:16 -0700 Subject: Update switch statements --- src/main/java/org/traccar/protocol/NiotProtocolDecoder.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/main/java/org/traccar/protocol/NiotProtocolDecoder.java') diff --git a/src/main/java/org/traccar/protocol/NiotProtocolDecoder.java b/src/main/java/org/traccar/protocol/NiotProtocolDecoder.java index 35614ccca..d53271778 100644 --- a/src/main/java/org/traccar/protocol/NiotProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/NiotProtocolDecoder.java @@ -99,14 +99,8 @@ public class NiotProtocolDecoder extends BaseProtocolDecoder { int statusX = buf.readUnsignedByte(); position.setValid(BitUtil.check(statusX, 7)); switch (BitUtil.between(statusX, 3, 5)) { - case 0b10: - position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); - break; - case 0b01: - position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER); - break; - default: - break; + case 0b10 -> position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); + case 0b01 -> position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER); } position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); -- cgit v1.2.3