aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/Gl200BinaryProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol/Gl200BinaryProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/Gl200BinaryProtocolDecoder.java63
1 files changed, 23 insertions, 40 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200BinaryProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200BinaryProtocolDecoder.java
index ecd1f5bfa..359af8e5a 100644
--- a/src/main/java/org/traccar/protocol/Gl200BinaryProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200BinaryProtocolDecoder.java
@@ -230,52 +230,39 @@ public class Gl200BinaryProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
switch (type) {
- case MSG_EVT_BPL:
- buf.readUnsignedShort(); // backup battery voltage
- break;
- case MSG_EVT_VGN:
- case MSG_EVT_VGF:
+ case MSG_EVT_BPL -> buf.readUnsignedShort(); // backup battery voltage
+ case MSG_EVT_VGN, MSG_EVT_VGF -> {
buf.readUnsignedShort(); // reserved
buf.readUnsignedByte(); // report type
buf.readUnsignedInt(); // ignition duration
- break;
- case MSG_EVT_UPD:
+ }
+ case MSG_EVT_UPD -> {
buf.readUnsignedShort(); // code
buf.readUnsignedByte(); // retry
- break;
- case MSG_EVT_IDF:
- buf.readUnsignedInt(); // idling duration
- break;
- case MSG_EVT_GSS:
+ }
+ case MSG_EVT_IDF -> buf.readUnsignedInt(); // idling duration
+ case MSG_EVT_GSS -> {
buf.readUnsignedByte(); // gps signal status
buf.readUnsignedInt(); // reserved
- break;
- case MSG_EVT_GES:
+ }
+ case MSG_EVT_GES -> {
buf.readUnsignedShort(); // trigger geo id
buf.readUnsignedByte(); // trigger geo enable
buf.readUnsignedByte(); // trigger mode
buf.readUnsignedInt(); // radius
buf.readUnsignedInt(); // check interval
- break;
- case MSG_EVT_GPJ:
+ }
+ case MSG_EVT_GPJ -> {
buf.readUnsignedByte(); // cw jamming value
buf.readUnsignedByte(); // gps jamming state
- break;
- case MSG_EVT_RMD:
- buf.readUnsignedByte(); // roaming state
- break;
- case MSG_EVT_JDS:
- buf.readUnsignedByte(); // jamming state
- break;
- case MSG_EVT_CRA:
- buf.readUnsignedByte(); // crash counter
- break;
- case MSG_EVT_UPC:
+ }
+ case MSG_EVT_RMD -> buf.readUnsignedByte(); // roaming state
+ case MSG_EVT_JDS -> buf.readUnsignedByte(); // jamming state
+ case MSG_EVT_CRA -> buf.readUnsignedByte(); // crash counter
+ case MSG_EVT_UPC -> {
buf.readUnsignedByte(); // command id
buf.readUnsignedShort(); // result
- break;
- default:
- break;
+ }
}
buf.readUnsignedByte(); // count
@@ -388,16 +375,12 @@ public class Gl200BinaryProtocolDecoder extends BaseProtocolDecoder {
ByteBuf buf = (ByteBuf) msg;
- switch (buf.readSlice(4).toString(StandardCharsets.US_ASCII)) {
- case "+RSP":
- return decodeLocation(channel, remoteAddress, buf);
- case "+INF":
- return decodeInformation(channel, remoteAddress, buf);
- case "+EVT":
- return decodeEvent(channel, remoteAddress, buf);
- default:
- return null;
- }
+ return switch (buf.readSlice(4).toString(StandardCharsets.US_ASCII)) {
+ case "+RSP" -> decodeLocation(channel, remoteAddress, buf);
+ case "+INF" -> decodeInformation(channel, remoteAddress, buf);
+ case "+EVT" -> decodeEvent(channel, remoteAddress, buf);
+ default -> null;
+ };
}
}