Search in sources :

Example 1 with SurroundMode

use of nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.SurroundMode in project Gadgetbridge by Freeyourgadget.

the class SonyProtocolImplV1 method handleSurroundMode.

public List<? extends GBDeviceEvent> handleSurroundMode(final byte[] payload) {
    if (payload.length != 3) {
        LOG.warn("Unexpected payload length {}", payload.length);
        return Collections.emptyList();
    }
    SurroundMode mode = null;
    for (SurroundMode value : SurroundMode.values()) {
        if (value.getCode() == payload[2]) {
            mode = value;
            break;
        }
    }
    if (mode == null) {
        LOG.warn("Unknown surround mode code {}", String.format("%02x", payload[2]));
        return Collections.emptyList();
    }
    LOG.debug("Surround Mode: {}", mode);
    final GBDeviceEventUpdatePreferences event = new GBDeviceEventUpdatePreferences().withPreferences(mode.toPreferences());
    return Collections.singletonList(event);
}
Also used : SurroundMode(nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.SurroundMode) GBDeviceEventUpdatePreferences(nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences)

Aggregations

GBDeviceEventUpdatePreferences (nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences)1 SurroundMode (nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.SurroundMode)1