use of nodomain.freeyourgadget.gadgetbridge.service.btle.actions.WriteAction in project Gadgetbridge by Freeyourgadget.
the class MiBandSupport method sendUserInfo.
/**
* Part of device initialization process. Do not call manually.
*
* @param builder
* @return
*/
private MiBandSupport sendUserInfo(TransactionBuilder builder) {
LOG.debug("Writing User Info!");
// Use a custom action instead of just builder.write() because mDeviceInfo
// is set by handleDeviceInfo *after* this action is created.
builder.add(new BtLEAction(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_USER_INFO)) {
@Override
public boolean expectsResult() {
return true;
}
@Override
public boolean run(BluetoothGatt gatt) {
// at this point, mDeviceInfo should be set
return new WriteAction(getCharacteristic(), MiBandCoordinator.getAnyUserInfo(getDevice().getAddress()).getData(mDeviceInfo)).run(gatt);
}
});
return this;
}
Aggregations