use of nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder in project Gadgetbridge by Freeyourgadget.
the class MiBand2Support method onEnableHeartRateSleepSupport.
@Override
public void onEnableHeartRateSleepSupport(boolean enable) {
try {
TransactionBuilder builder = performInitialized("enable heart rate sleep support: " + enable);
setHeartrateSleepSupport(builder);
builder.queue(getQueue());
} catch (IOException e) {
GB.toast(getContext(), "Error toggling heart rate sleep support: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
}
}
use of nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder in project Gadgetbridge by Freeyourgadget.
the class MiBand2Support method performDefaultNotification.
private void performDefaultNotification(String task, SimpleNotification simpleNotification, short repeat, BtLEAction extraAction) {
try {
TransactionBuilder builder = performInitialized(task);
sendDefaultNotification(builder, simpleNotification, repeat, extraAction);
builder.queue(getQueue());
} catch (IOException ex) {
LOG.error("Unable to send notification to MI device", ex);
}
}
use of nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder in project Gadgetbridge by Freeyourgadget.
the class AbstractBleProfile method performInitialized.
/**
* Delegates to the DeviceSupport instance and additionally sets this instance as the Gatt
* callback for the transaction.
*
* @param taskName
* @return
* @throws IOException
*/
public TransactionBuilder performInitialized(String taskName) throws IOException {
TransactionBuilder builder = mSupport.performInitialized(taskName);
builder.setGattCallback(this);
return builder;
}
use of nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder in project Gadgetbridge by Freeyourgadget.
the class HPlusHandlerThread method requestNextSleepData.
/**
* Issue a message requesting the next batch of sleep data
*/
private void requestNextSleepData() {
TransactionBuilder builder = new TransactionBuilder("requestSleepStats");
builder.write(mHPlusSupport.ctrlCharacteristic, new byte[] { HPlusConstants.CMD_GET_SLEEP });
builder.queue(mHPlusSupport.getQueue());
mGetSleepTime = GregorianCalendar.getInstance();
mGetSleepTime.add(GregorianCalendar.SECOND, SLEEP_SYNC_RETRY_PERIOD);
}
use of nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder in project Gadgetbridge by Freeyourgadget.
the class MiBandSupport method onEnableRealtimeSteps.
@Override
public void onEnableRealtimeSteps(boolean enable) {
try {
BluetoothGattCharacteristic controlPoint = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT);
if (enable) {
TransactionBuilder builder = performInitialized("Read realtime steps");
builder.read(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_REALTIME_STEPS)).queue(getQueue());
}
performInitialized(enable ? "Enabling realtime steps notifications" : "Disabling realtime steps notifications").write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_LE_PARAMS), enable ? getLowLatency() : getHighLatency()).write(controlPoint, enable ? startRealTimeStepsNotifications : stopRealTimeStepsNotifications).queue(getQueue());
enableRealtimeSamplesTimer(enable);
} catch (IOException e) {
LOG.error("Unable to change realtime steps notification to: " + enable, e);
}
}
Aggregations