use of nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl in project Gadgetbridge by Freeyourgadget.
the class HuamiSupport method handleMediaButton.
private void handleMediaButton(String MediaAction) {
if (MediaAction.equals(PREF_DEVICE_ACTION_SELECTION_OFF)) {
return;
}
GBDeviceEventMusicControl deviceEventMusicControl = new GBDeviceEventMusicControl();
deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.valueOf(MediaAction);
evaluateGBDeviceEvent(deviceEventMusicControl);
}
use of nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl in project Gadgetbridge by Freeyourgadget.
the class FitProDeviceSupport method handleMediaButton.
public void handleMediaButton(byte command) {
GBDeviceEventMusicControl deviceEventMusicControl = new GBDeviceEventMusicControl();
if (command == RX_MEDIA_PLAY_PAUSE) {
deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PLAYPAUSE;
evaluateGBDeviceEvent(deviceEventMusicControl);
} else if (command == RX_MEDIA_FORW) {
deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.NEXT;
evaluateGBDeviceEvent(deviceEventMusicControl);
} else if (command == RX_MEDIA_BACK) {
deviceEventMusicControl.event = GBDeviceEventMusicControl.Event.PREVIOUS;
evaluateGBDeviceEvent(deviceEventMusicControl);
}
}
use of nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl in project Gadgetbridge by Freeyourgadget.
the class CasioGB6900DeviceSupport method onCharacteristicWriteRequest.
@Override
public boolean onCharacteristicWriteRequest(BluetoothDevice device, int requestId, BluetoothGattCharacteristic characteristic, boolean preparedWrite, boolean responseNeeded, int offset, byte[] value) {
GBDeviceEventMusicControl musicCmd = new GBDeviceEventMusicControl();
if (!characteristic.getUuid().equals(CasioConstants.KEY_CONTAINER_CHARACTERISTIC_UUID)) {
LOG.warn("unexpected write request");
return false;
}
if ((value[0] & 0x03) == 0) {
int button = value[1] & 0x0f;
LOG.info("Button pressed: " + button);
switch(getModel()) {
case MODEL_CASIO_5600B:
musicCmd.event = parse2Button(button);
break;
case MODEL_CASIO_6900B:
case MODEL_CASIO_GENERIC:
musicCmd.event = parse3Button(button);
break;
case MODEL_CASIO_STB1000:
musicCmd.event = parse5Button(button);
break;
default:
LOG.warn("Unhandled device");
return false;
}
evaluateGBDeviceEvent(musicCmd);
} else {
LOG.info("received from device: " + value.toString());
}
return true;
}
Aggregations