1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15: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 {
UNKNOWN,
NOTHING,
CONNECTION_STATE
CONNECTION_STATE,
DEVICE_STATE,
}
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);
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());
}
}

View File

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

View File

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