oppo: add handler for DeviceInfoType.GAME_MODE

This commit is contained in:
NTeditor
2026-06-20 11:52:54 +03:00
parent 19933192d3
commit 45cd3c2a2c
@@ -345,10 +345,11 @@ public class OppoHeadphonesProtocol extends GBDeviceProtocol {
final int typeCode = payload[0] & 0xff; final int typeCode = payload[0] & 0xff;
final DeviceInfoType type = DeviceInfoType.fromCode(typeCode); final DeviceInfoType type = DeviceInfoType.fromCode(typeCode);
if (type == null) { if (type == null) {
LOG.warn("Unknown device info {}", payload[0]); LOG.warn("Unknown device info {}", String.format(Locale.ROOT, "0x%02x", typeCode));
return events; return events;
} }
final GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences();
switch (type) { switch (type) {
case BATTERY: { case BATTERY: {
events.addAll(parseBattery(payload)); events.addAll(parseBattery(payload));
@@ -359,8 +360,18 @@ public class OppoHeadphonesProtocol extends GBDeviceProtocol {
// TODO handle // TODO handle
break; break;
} }
case GAME_MODE: {
final boolean isEnabled = ((payload[1] & 0xFF) == 0x01);
LOG.debug("Got misc config for GAME_MODE = {}", isEnabled);
eventUpdatePreferences.withPreference(
OppoHeadphonesPreferences.GAME_MODE,
isEnabled
);
events.add(eventUpdatePreferences);
break;
}
default: { default: {
LOG.warn("Unknown device info {}", payload[0]); LOG.warn("Unhandled device info type {}", type);
break; break;
} }
} }