Skip to content

Commit

Permalink
Fix #1420 - Part 2 - update characteristic signatures for async
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Feb 28, 2024
1 parent 421cf47 commit 0d7831f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Shiny.BluetoothLE/Extensions_Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ public static Task<BleServiceInfo> GetServiceAsync(this IPeripheral peripheral,
.GetService(serviceUuid)
.ToTask(cancelToken);

public static Task<IReadOnlyList<BleCharacteristicInfo>> GetCharacteristicsAsync(this IPeripheral peripheral, string serviceUuid, CancellationToken cancelToken = default, TimeSpan? timeout = null)
public static Task<IReadOnlyList<BleCharacteristicInfo>> GetAllCharacteristicsAsync(this IPeripheral peripheral, CancellationToken cancelToken = default, TimeSpan? timeout = null)
=> peripheral
.GetAllCharacteristics()
.Timeout(timeout ?? TimeSpan.FromSeconds(10))
.ToTask(cancelToken);


public static Task<IReadOnlyList<BleCharacteristicInfo>> 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<BleCharacteristicInfo> GetCharacteristicAsync(this IPeripheral peripheral, string serviceUuid, string characteristicUuid, CancellationToken cancelToken = default)
=> peripheral
.GetCharacteristic(serviceUuid, characteristicUuid)
Expand Down

0 comments on commit 0d7831f

Please sign in to comment.