use of com.eveningoutpost.dexdrip.watch.miband.message.DisplayControllMessageMiband3_4 in project xDrip-plus by jamorham.
the class MiBandService method setNightMode.
private void setNightMode() {
if (d)
UserError.Log.d(TAG, "Restore night mode");
Date start = null, end = null;
DisplayControllMessageMiband3_4.NightMode nightMode = DisplayControllMessageMiband3_4.NightMode.Off;
if (MiBandEntry.isNightModeEnabled()) {
nightMode = DisplayControllMessageMiband3_4.NightMode.Sheduled;
start = MiBandEntry.getNightModeStart();
end = MiBandEntry.getNightModeEnd();
}
RxBleConnection connection = I.connection;
DisplayControllMessageMiband3_4 dispControl = new DisplayControllMessageMiband3_4();
connection.writeCharacteristic(dispControl.getCharacteristicUUID(), dispControl.setNightModeCmd(nightMode, start, end)).subscribe(valB -> {
if (d)
UserError.Log.d(TAG, "Wrote nightmode");
isNeedToRestoreNightMode = false;
}, throwable -> {
if (d)
UserError.Log.e(TAG, "Could not write nightmode: " + throwable);
});
}
Aggregations