Search in sources :

Example 1 with MUSIC_WATCH_REQUEST

use of nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest.MUSIC_WATCH_REQUEST in project Gadgetbridge by Freeyourgadget.

the class FossilHRWatchAdapter method handleMusicRequest.

private void handleMusicRequest(byte[] value) {
    byte command = value[3];
    LOG.info("got music command: " + command);
    MUSIC_WATCH_REQUEST request = MUSIC_WATCH_REQUEST.fromCommandByte(command);
    GBDeviceEventMusicControl deviceEventMusicControl = new GBDeviceEventMusicControl();
    deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PLAY;
    switch(request) {
        case MUSIC_REQUEST_PLAY_PAUSE:
            {
                queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_PLAY_PAUSE));
                deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PLAYPAUSE;
                break;
            }
        case MUSIC_REQUEST_NEXT:
            {
                queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_NEXT));
                deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.NEXT;
                break;
            }
        case MUSIC_REQUEST_PREVIOUS:
            {
                queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_PREVIOUS));
                deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PREVIOUS;
                break;
            }
        case MUSIC_REQUEST_LOUDER:
            {
                queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_LOUDER));
                deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.VOLUMEUP;
                break;
            }
        case MUSIC_REQUEST_QUITER:
            {
                queueWrite(new MusicControlRequest(MUSIC_PHONE_REQUEST.MUSIC_REQUEST_QUITER));
                deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.VOLUMEDOWN;
                break;
            }
    }
    getDeviceSupport().evaluateGBDeviceEvent(deviceEventMusicControl);
}
Also used : MUSIC_WATCH_REQUEST(nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest.MUSIC_WATCH_REQUEST) MusicControlRequest(nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest) GBDeviceEventMusicControl(nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl)

Aggregations

GBDeviceEventMusicControl (nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl)1 MusicControlRequest (nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest)1 MUSIC_WATCH_REQUEST (nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest.MUSIC_WATCH_REQUEST)1