aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/NyitechProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol/NyitechProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/NyitechProtocolDecoder.java35
1 files changed, 11 insertions, 24 deletions
diff --git a/src/main/java/org/traccar/protocol/NyitechProtocolDecoder.java b/src/main/java/org/traccar/protocol/NyitechProtocolDecoder.java
index 49bc5b824..0366cffcd 100644
--- a/src/main/java/org/traccar/protocol/NyitechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/NyitechProtocolDecoder.java
@@ -63,18 +63,13 @@ public class NyitechProtocolDecoder extends BaseProtocolDecoder {
}
private String decodeAlarm(int type) {
- switch (type) {
- case 0x09:
- return Position.ALARM_ACCELERATION;
- case 0x0a:
- return Position.ALARM_BRAKING;
- case 0x0b:
- return Position.ALARM_CORNERING;
- case 0x0e:
- return Position.ALARM_SOS;
- default:
- return null;
- }
+ return switch (type) {
+ case 0x09 -> Position.ALARM_ACCELERATION;
+ case 0x0a -> Position.ALARM_BRAKING;
+ case 0x0b -> Position.ALARM_CORNERING;
+ case 0x0e -> Position.ALARM_SOS;
+ default -> null;
+ };
}
@Override
@@ -121,18 +116,10 @@ public class NyitechProtocolDecoder extends BaseProtocolDecoder {
int pid = buf.readUnsignedShortLE();
int length = buf.readUnsignedByte();
switch (length) {
- case 1:
- position.add(ObdDecoder.decodeData(pid, buf.readByte(), true));
- break;
- case 2:
- position.add(ObdDecoder.decodeData(pid, buf.readShortLE(), true));
- break;
- case 4:
- position.add(ObdDecoder.decodeData(pid, buf.readIntLE(), true));
- break;
- default:
- buf.skipBytes(length);
- break;
+ case 1 -> position.add(ObdDecoder.decodeData(pid, buf.readByte(), true));
+ case 2 -> position.add(ObdDecoder.decodeData(pid, buf.readShortLE(), true));
+ case 4 -> position.add(ObdDecoder.decodeData(pid, buf.readIntLE(), true));
+ default -> buf.skipBytes(length);
}
}
}