/// <summary> /// Initialize the list of all characteristics in this service. /// </summary> public void InitializeCharacteristics() { // Don't need to initialize multiple times. if (CharacteristicModels != null && CharacteristicModels.Count > 0) { return; } // Get characteristics. try { if (CharacteristicModels == null) { CharacteristicModels = new List <BECharacteristicModel>(); } var characteristics = _service.GetAllCharacteristics(); foreach (var characteristic in characteristics) { var characteristicM = new BECharacteristicModel(); characteristicM.Initialize(this, characteristic); CharacteristicModels.Add(characteristicM); } } catch (Exception ex) { // GetAllCharacteristics can fail with E_ACCESS_DENIED if another app is holding a // reference to the BTLE service. It can be an active background task, or in the // backstack. // Utilities.OnExceptionWithMessage(ex, "This exception may be encountered if a another app holds a reference to the BTLE service."); Debug.WriteLine( "This exception may be encountered if a another app holds a reference to the BTLE service. {0}", ex.Message); } }
/// <summary> /// Test for equality /// </summary> /// <param name="model"></param> /// <returns></returns> public bool ToastEquals(BECharacteristicModel model) { return(_toastName.Equals(model._toastName)); }