Search in sources :

Example 1 with MusicControlRequest

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

the class FossilHRWatchAdapter method setMusicState.

@Override
public void setMusicState(MusicStateSpec stateSpec) {
    super.setMusicState(stateSpec);
    queueWrite(new MusicControlRequest(stateSpec.state == MusicStateSpec.STATE_PLAYING ? MUSIC_PHONE_REQUEST.MUSIC_REQUEST_SET_PLAYING : MUSIC_PHONE_REQUEST.MUSIC_REQUEST_SET_PAUSED));
}
Also used : MusicControlRequest(nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest)

Example 2 with MusicControlRequest

use of nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest 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

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