1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-09 09:25:49 +01:00
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/SetDeviceStateAction.java
2015-06-13 00:32:48 +02:00

31 lines
866 B
Java

package nodomain.freeyourgadget.gadgetbridge.miband;
import android.bluetooth.BluetoothGatt;
import android.content.Context;
import nodomain.freeyourgadget.gadgetbridge.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.btle.PlainAction;
public class SetDeviceStateAction extends PlainAction {
private final GBDevice device;
private final GBDevice.State deviceState;
private final Context context;
public SetDeviceStateAction(GBDevice device, GBDevice.State deviceState, Context context) {
this.device = device;
this.deviceState = deviceState;
this.context = context;
}
@Override
public boolean run(BluetoothGatt gatt) {
device.setState(deviceState);
device.sendDeviceUpdateIntent(getContext());
return true;
}
public Context getContext() {
return context;
}
}