From 0d7831f4aa88411e85db9e0f86ebc2834b12d430 Mon Sep 17 00:00:00 2001 From: Allan Ritchie Date: Wed, 28 Feb 2024 17:59:01 -0500 Subject: [PATCH] Fix #1420 - Part 2 - update characteristic signatures for async --- src/Shiny.BluetoothLE/Extensions_Async.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Shiny.BluetoothLE/Extensions_Async.cs b/src/Shiny.BluetoothLE/Extensions_Async.cs index b22638114..ba6311584 100644 --- a/src/Shiny.BluetoothLE/Extensions_Async.cs +++ b/src/Shiny.BluetoothLE/Extensions_Async.cs @@ -49,13 +49,18 @@ public static Task GetServiceAsync(this IPeripheral peripheral, .GetService(serviceUuid) .ToTask(cancelToken); - public static Task> GetCharacteristicsAsync(this IPeripheral peripheral, string serviceUuid, CancellationToken cancelToken = default, TimeSpan? timeout = null) + public static Task> GetAllCharacteristicsAsync(this IPeripheral peripheral, CancellationToken cancelToken = default, TimeSpan? timeout = null) => peripheral .GetAllCharacteristics() .Timeout(timeout ?? TimeSpan.FromSeconds(10)) .ToTask(cancelToken); - + public static Task> GetCharacteristicsAsync(this IPeripheral peripheral, string serviceUuid, CancellationToken cancelToken = default, TimeSpan? timeout = null) + => peripheral + .GetCharacteristics(serviceUuid) + .Timeout(timeout ?? TimeSpan.FromSeconds(10)) + .ToTask(cancelToken); + public static Task GetCharacteristicAsync(this IPeripheral peripheral, string serviceUuid, string characteristicUuid, CancellationToken cancelToken = default) => peripheral .GetCharacteristic(serviceUuid, characteristicUuid)