mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
oppo: add handler for DeviceInfoType.GAME_MODE
This commit is contained in:
+13
-2
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user