Skip to content

Commit

Permalink
Provide Peripheral(Identifier) builder function (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
twyatt authored Dec 2, 2024
1 parent c2915bb commit 61bfcb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kable-core/api/android/kable-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,10 @@ public final class com/juul/kable/PeripheralBuilder {
public final class com/juul/kable/PeripheralKt {
public static final fun Peripheral (Landroid/bluetooth/BluetoothDevice;Lkotlin/jvm/functions/Function1;)Lcom/juul/kable/Peripheral;
public static final fun Peripheral (Lcom/juul/kable/Advertisement;Lkotlin/jvm/functions/Function1;)Lcom/juul/kable/Peripheral;
public static final fun Peripheral (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lcom/juul/kable/Peripheral;
public static synthetic fun Peripheral$default (Landroid/bluetooth/BluetoothDevice;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/juul/kable/Peripheral;
public static synthetic fun Peripheral$default (Lcom/juul/kable/Advertisement;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/juul/kable/Peripheral;
public static synthetic fun Peripheral$default (Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/juul/kable/Peripheral;
}

public final class com/juul/kable/Peripheral_deprecatedKt {
Expand Down
6 changes: 6 additions & 0 deletions kable-core/src/androidMain/kotlin/Peripheral.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ public actual fun Peripheral(
return Peripheral(advertisement.bluetoothDevice, builderAction)
}

/** @throws IllegalStateException If bluetooth is not supported. */
public fun Peripheral(
identifier: Identifier,
builderAction: PeripheralBuilderAction = {},
): Peripheral = Peripheral(getBluetoothAdapter().getRemoteDevice(identifier), builderAction)

public fun Peripheral(
bluetoothDevice: BluetoothDevice,
builderAction: PeripheralBuilderAction = {},
Expand Down

0 comments on commit 61bfcb8

Please sign in to comment.