1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 18:45:49 +01:00

Core: added device update reason DEVICE_STATE

This commit is contained in:
Daniel Dakhno 2022-09-25 01:27:26 +02:00 committed by Gitea
parent dfc1f164b4
commit ec161be66e
4 changed files with 6 additions and 4 deletions

View File

@ -103,7 +103,8 @@ public class GBDevice implements Parcelable {
public static enum DeviceUbdateSubject { public static enum DeviceUbdateSubject {
UNKNOWN, UNKNOWN,
NOTHING, NOTHING,
CONNECTION_STATE CONNECTION_STATE,
DEVICE_STATE,
} }
public GBDevice(String address, String name, String alias, String parentFolder, DeviceType deviceType) { public GBDevice(String address, String name, String alias, String parentFolder, DeviceType deviceType) {

View File

@ -439,7 +439,8 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
GBDevice.DeviceUbdateSubject subject = (GBDevice.DeviceUbdateSubject) intent.getSerializableExtra(GBDevice.EXTRA_UPDATE_SUBJECT); GBDevice.DeviceUbdateSubject subject = (GBDevice.DeviceUbdateSubject) intent.getSerializableExtra(GBDevice.EXTRA_UPDATE_SUBJECT);
if(subject == GBDevice.DeviceUbdateSubject.CONNECTION_STATE && device.isInitialized()){ if(subject == GBDevice.DeviceUbdateSubject.DEVICE_STATE && device.isInitialized()){
LOG.debug("device state update reason");
sendDeviceConnectedBroadcast(device.getAddress()); sendDeviceConnectedBroadcast(device.getAddress());
} }
} }

View File

@ -37,7 +37,7 @@ public class SetDeviceStateAction extends PlainAction {
@Override @Override
public boolean run(BluetoothGatt gatt) { public boolean run(BluetoothGatt gatt) {
device.setState(deviceState); device.setState(deviceState);
device.sendDeviceUpdateIntent(getContext()); device.sendDeviceUpdateIntent(getContext(), GBDevice.DeviceUbdateSubject.DEVICE_STATE);
return true; return true;
} }

View File

@ -828,7 +828,7 @@ public class FossilWatchAdapter extends WatchAdapter {
private void setDeviceState(GBDevice.State state) { private void setDeviceState(GBDevice.State state) {
getDeviceSupport().getDevice().setState(state); getDeviceSupport().getDevice().setState(state);
getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext()); getDeviceSupport().getDevice().sendDeviceUpdateIntent(getContext(), GBDevice.DeviceUbdateSubject.DEVICE_STATE);
} }
public void queueWrite(FossilRequest request, boolean priorise) { public void queueWrite(FossilRequest request, boolean priorise) {