aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/NyitechProtocolDecoder.java
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2024-08-03 20:52:00 -0600
committerIván Ávalos <avalos@disroot.org>2024-08-03 20:52:00 -0600
commit55f6d92c09a5b1d8566b53633d07be3d31010d3b (patch)
treeb86bed801b0bbadb72c7e839296dae1d28b12bbb /src/main/java/org/traccar/protocol/NyitechProtocolDecoder.java
parentc04ad7d48331253c095fc123ded1b00f6ff871d3 (diff)
parent2788174193def918a3a1a5be3bbed24c9613323f (diff)
downloadtrackermap-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/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);
}
}
}