Skip to content

Commit 61bfcb8

Browse files
authored
Provide Peripheral(Identifier) builder function (#803)
1 parent c2915bb commit 61bfcb8

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

kable-core/api/android/kable-core.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,10 @@ public final class com/juul/kable/PeripheralBuilder {
350350
public final class com/juul/kable/PeripheralKt {
351351
public static final fun Peripheral (Landroid/bluetooth/BluetoothDevice;Lkotlin/jvm/functions/Function1;)Lcom/juul/kable/Peripheral;
352352
public static final fun Peripheral (Lcom/juul/kable/Advertisement;Lkotlin/jvm/functions/Function1;)Lcom/juul/kable/Peripheral;
353+
public static final fun Peripheral (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lcom/juul/kable/Peripheral;
353354
public static synthetic fun Peripheral$default (Landroid/bluetooth/BluetoothDevice;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/juul/kable/Peripheral;
354355
public static synthetic fun Peripheral$default (Lcom/juul/kable/Advertisement;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/juul/kable/Peripheral;
356+
public static synthetic fun Peripheral$default (Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/juul/kable/Peripheral;
355357
}
356358

357359
public final class com/juul/kable/Peripheral_deprecatedKt {

kable-core/src/androidMain/kotlin/Peripheral.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ public actual fun Peripheral(
1010
return Peripheral(advertisement.bluetoothDevice, builderAction)
1111
}
1212

13+
/** @throws IllegalStateException If bluetooth is not supported. */
14+
public fun Peripheral(
15+
identifier: Identifier,
16+
builderAction: PeripheralBuilderAction = {},
17+
): Peripheral = Peripheral(getBluetoothAdapter().getRemoteDevice(identifier), builderAction)
18+
1319
public fun Peripheral(
1420
bluetoothDevice: BluetoothDevice,
1521
builderAction: PeripheralBuilderAction = {},

0 commit comments

Comments
 (0)