public void SetDoNotDisturb(DoNotDisturbMode mode, TimeSpan timeOut) { if (timeOut.TotalMinutes > 1440) { throw new Exception("Timeout cannot be more than 24 hours"); } Codec.Send("xCommand Conference DoNotDisturb {0}{1}", mode == DoNotDisturbMode.Active ? "Activate" : "Deactivate", mode == DoNotDisturbMode.Active && timeOut.TotalMinutes > 0 ? string.Format("Timeout: {0}", timeOut.TotalMinutes) : string.Empty); }
/// <summary> /// Set Do Not Disturb mode. (Unsubscribe to notifications from phone) /// </summary> /// <param name="dndMode"></param> /// <param name="startHours"></param> /// <param name="startMinutes"></param> /// <param name="endHours"></param> /// <param name="endMinutes"></param> /// <returns></returns> public async Task <bool> DoNotDisturb(DoNotDisturbMode dndMode, byte startHours = 0, byte startMinutes = 0, byte endHours = 0, byte endMinutes = 0) { var characteristic = await Gatt.GetCharacteristicByServiceUuid(MIBAND3_SERVICE, CONFIGURATION_CHARACTERISTIC); byte[] setDnd = null; if (dndMode != DoNotDisturbMode.SCHEDULED) { setDnd = new byte[] { 9, (byte)dndMode } } ; else { setDnd = new byte[] { 9, (byte)dndMode, startHours, startMinutes, endHours, endMinutes } }; return(await characteristic.WriteValueAsync(setDnd.AsBuffer()) == GattCommunicationStatus.Success); }
public void SetDoNotDisturb(DoNotDisturbMode mode) { Codec.Send("xCommand Conference DoNotDisturb {0}", mode == DoNotDisturbMode.Active ? "Activate" : "Deactivate"); }