Exemplo n.º 1
0
 /// <summary>
 /// Will discover all services/characteristics when connected state occurs
 /// </summary>
 /// <param name="peripheral"></param>
 /// <returns></returns>
 public static IObservable <IList <IGattCharacteristic> > GetAllCharacteristics(this IPeripheral peripheral) =>
 peripheral
 .GetServices()
 .SelectMany(x => x.Select(y => y.GetCharacteristics()))
 .Merge();
Exemplo n.º 2
0
 public static Task <IList <IGattService> > GetServicesAsync(this IPeripheral peripheral, CancellationToken?cancelToken = null)
 => peripheral
 .GetServices()
 .ToTask(cancelToken ?? CancellationToken.None);
Exemplo n.º 3
0
 public static Task <IList <IGattService> > GetServicesAsync(this IPeripheral peripheral, CancellationToken cancelToken = default)
 => peripheral
 .GetServices()
 .ToTask(cancelToken);