Package-level declarations

The entry point for common BLE scanner.

This package contains the main entry point for the BLE scanner, including the ScannerScreen composable and the ScanFilterState for managing its state. It also defines the result types returned when a device is selected or the process is canceled.

Types

Link copied to clipboard
data class DeviceSelected(val scanResult: ScanResult) : ScannerScreenResult

Represents the selection of a device from the scan results.

Link copied to clipboard

Represents the state of the scanner, including available filters and sorting options.

Link copied to clipboard
sealed interface ScannerScreenResult

Represents the result of the scanner screen interaction. This sealed interface defines the possible outcomes when the user interacts with the scanner screen.

Link copied to clipboard

Represents the cancellation of the scanning process. This object is used to indicate that the user has cancelled the scanning operation.

Functions

Link copied to clipboard
fun rememberFilterState(filter: ConjunctionFilterScope.() -> Unit = {}, scanResultFilter: (ScanResult) -> Boolean = { it.isConnectable }, dynamicFilters: List<Filter> = listOf( OnlyNearby(), OnlyWithNames(isInitiallySelected = true), ), sortingOptions: List<SortingOption> = listOf( SortByRssi(), SortByName() )): ScanFilterState

Creates a ScanFilterState that can be used to manage the state of the scanner.

Link copied to clipboard
fun ScannerScreen(cancellable: Boolean, onResultSelected: (ScannerScreenResult) -> Unit, modifier: Modifier = Modifier, state: ScanFilterState = rememberFilterState(), timeout: Duration = Duration.INFINITE, title: @Composable () -> Unit = { Text(stringResource(id = R.string.scanner_screen)) }, verticalArrangement: Arrangement.Vertical = Arrangement.spacedBy(8.dp), deviceItem: @Composable (ScanResult) -> Unit = { scanResult -> DeviceListItem(scanResult) })

A scanner screen with an AppBar and a list of devices.