use of nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.VoiceNotifications in project Gadgetbridge by Freeyourgadget.
the class SonyProtocolImplV1 method handleVoiceNotifications.
public List<? extends GBDeviceEvent> handleVoiceNotifications(final byte[] payload) {
if (payload.length != 4) {
LOG.warn("Unexpected payload length {}", payload.length);
return Collections.emptyList();
}
boolean enabled;
switch(payload[3]) {
case 0x00:
enabled = false;
break;
case 0x01:
enabled = true;
break;
default:
LOG.warn("Unknown voice notifications code {}", String.format("%02x", payload[3]));
return Collections.emptyList();
}
LOG.debug("Voice Notifications: {}", enabled);
final GBDeviceEventUpdatePreferences event = new GBDeviceEventUpdatePreferences().withPreferences(new VoiceNotifications(enabled).toPreferences());
return Collections.singletonList(event);
}
Aggregations