/// <summary> /// Will discover all services/characteristics/descriptors when connected state occurs /// </summary> /// <param name="peripheral"></param> /// <returns></returns> public static IObservable <IList <IGattDescriptor> > GetAllDescriptors(this IPeripheral peripheral) => peripheral .GetAllCharacteristics() .SelectMany(x => x.Select(y => y.GetDescriptors())) .Switch();
public static Task <IList <IGattCharacteristic> > GetAllCharacteristicsAsync(this IPeripheral peripheral, CancellationToken?cancelToken = null) => peripheral .GetAllCharacteristics() .ToTask(cancelToken ?? CancellationToken.None);
public static Task <IList <IGattCharacteristic> > GetAllCharacteristicsAsync(this IPeripheral peripheral, CancellationToken cancelToken = default) => peripheral .GetAllCharacteristics() .ToTask(cancelToken);