Moyoung: Add music and volume control

This commit is contained in:
Arjan Schrijver 2024-09-03 16:47:06 +02:00
parent b3d09f3209
commit 59cb0ee70f
2 changed files with 53 additions and 0 deletions

View File

@ -197,6 +197,9 @@ public class MoyoungConstants {
public static final byte ARG_OPERATION_PREV_SONG = 1;
public static final byte ARG_OPERATION_NEXT_SONG = 2;
public static final byte ARG_OPERATION_DROP_INCOMING_CALL = 3;
public static final byte ARG_OPERATION_VOLUME_UP = 4;
public static final byte ARG_OPERATION_VOLUME_DOWN = 5;
public static final byte ARG_OPERATION_PLAY = 6;
public static final byte CMD_QUERY_ALARM_CLOCK = 33; // (?) {} -> a list of entries like below
public static final byte CMD_SET_ALARM_CLOCK = 17; // (?) {id, enable ? 1 : 0, repeat, hour, minute, i >> 8, i, repeatMode}, repeatMode is 0(SINGLE), 127(EVERYDAY), or bitmask of 1,2,4,8,16,32,64(SUNDAY-SATURDAY) is 0,1,2, i is ((year << 12) + (month << 8) + day) where year is 2015-based, month and day start at 1 for repeatMode=SINGLE and 0 otherwise, repeat is 0(SINGLE),1(EVERYDAY),2(OTHER)

View File

@ -86,12 +86,16 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser;
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec;
import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.model.RecordedDataTypes;
import nodomain.freeyourgadget.gadgetbridge.model.Weather;
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
import nodomain.freeyourgadget.gadgetbridge.model.WorldClock;
import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService;
@ -371,6 +375,27 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
evaluateGBDeviceEvent(callCmd);
return true;
}
if (operation == MoyoungConstants.ARG_OPERATION_VOLUME_UP)
{
GBDeviceEventMusicControl musicCmd = new GBDeviceEventMusicControl();
musicCmd.event = GBDeviceEventMusicControl.Event.VOLUMEUP;
evaluateGBDeviceEvent(musicCmd);
return true;
}
if (operation == MoyoungConstants.ARG_OPERATION_VOLUME_DOWN)
{
GBDeviceEventMusicControl musicCmd = new GBDeviceEventMusicControl();
musicCmd.event = GBDeviceEventMusicControl.Event.VOLUMEDOWN;
evaluateGBDeviceEvent(musicCmd);
return true;
}
if (operation == MoyoungConstants.ARG_OPERATION_PLAY)
{
GBDeviceEventMusicControl musicCmd = new GBDeviceEventMusicControl();
musicCmd.event = GBDeviceEventMusicControl.Event.PLAYPAUSE;
evaluateGBDeviceEvent(musicCmd);
return true;
}
}
if (packetType == MoyoungConstants.CMD_SWITCH_CAMERA_VIEW)
@ -645,6 +670,31 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
}
}
@Override
public void onSetMusicState(MusicStateSpec stateSpec) {
// TODO
}
@Override
public void onSetMusicInfo(MusicSpec musicSpec) {
// TODO
}
@Override
public void onSetWorldClocks(ArrayList<? extends WorldClock> clocks) {
// TODO
}
@Override
public void onAddCalendarEvent(CalendarEventSpec calendarEventSpec) {
// TODO
}
@Override
public void onDeleteCalendarEvent(byte type, long id) {
// TODO
}
@Override
public void onFetchRecordedData(int dataTypes) {
if ((dataTypes & RecordedDataTypes.TYPE_ACTIVITY) != 0)