private async Task GetAllDescriptors()

in BluetoothLEExplorer/BluetoothLEExplorer/Models/ObservableGattCharacteristics.cs [456:495]


        private async Task GetAllDescriptors()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("ObservableGattCharacteristics::getAllDescriptors: ");
            sb.Append(Name);

            try
            {
                GattDescriptorsResult result = await characteristic.GetDescriptorsAsync(Services.SettingsServices.SettingsService.Instance.UseCaching ? BluetoothCacheMode.Cached : BluetoothCacheMode.Uncached);

                if (result.Status == GattCommunicationStatus.Success)
                {
                    sb.Append(" - found ");
                    sb.Append(result.Descriptors.Count);
                    sb.Append(" descriptors");
                    Debug.WriteLine(sb);
                    foreach (GattDescriptor descriptor in result.Descriptors)
                    {
                        ObservableGattDescriptors temp = new ObservableGattDescriptors(descriptor, this);
                        await temp.Initialize();
                        Descriptors.Add(temp);
                    }
                }
                else if (result.Status == GattCommunicationStatus.Unreachable)
                {
                    sb.Append(" - failed with Unreachable");
                    Debug.WriteLine(sb.ToString());
                }
                else if (result.Status == GattCommunicationStatus.ProtocolError)
                {
                    sb.Append(" - failed with ProtocolError");
                    Debug.WriteLine(sb.ToString());
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(" - Exception: {0}" + ex.Message);
                Value = "Unknown (exception: " + ex.Message + ")";
            }
        }