apidocs / com.nimmsta.core.android.bluetooth / NIMMSTABLEScanner

NIMMSTABLEScanner

class NIMMSTABLEScanner : ScannerWithScanJobsAndCache

NIMMSTA BLE Scanner which is a separate layer between Android Scanner and UI in order to

It's based on Scan-Jobs, which are delegated to the BLEScanner and then executed until cancelled or reach a timeout. By doing that all scanning within the NIMMSTA App is combined and managed from one place and one place only.

It is able to filter on Scan Codes which means that you show a barcode to the HS 50 in format XXConnectHSD50XX:ABCDE where ABCDE is replaced by a random 5 character string. The HS 50 then provides this string in the BLE advertisement. This class can filter for that String in a ScanJob by setting filterOnCode to that code.

In order to obtain an instance of this, use NIMMSTAConnectionManager.nimmstaDeviceScanner.

Parameters

context - the Android Context

connectionManager - reference to the NIMMSTAConnectionManager

Author
NIMMSTA Team

Copyright
NIMMSTA GmbH & IBPG 2020

License
NIMMSTA GmbH

Properties

requiredPermissions

Permissions needed for this scanner.

val requiredPermissions: Array<String>

Functions

checkSupported

Returns if Bluetooth LE is supported by this device.

fun checkSupported(): Boolean

checkSupportedOrThrow

Checks if it is currently supported to add a new ScanJob. Should throw exceptions if not. Optionally implement this.

fun checkSupportedOrThrow(): Unit

isEnabled

Returns if Bluetooth LE is enabled.

fun isEnabled(): Boolean

isLocationServicesEnabled

returns if location services are enabled. -> if not we need to enable it in settings.

fun isLocationServicesEnabled(): Boolean

startScanning

Starts scanning.

fun startScanning(highPower: Boolean, callback: ScanCallback): Unit

stopScanning

fun stopScanning(): Unit

Companion Object Properties

PERMISSION_RATIONALE

Permission rationale that should be shown to the user. Since we only need location for API levels below 31, we don't ask for them here.

val PERMISSION_RATIONALE: Int

PERMISSIONS_NEEDED

All permissions that are needed for Bluetooth scanning

val PERMISSIONS_NEEDED: Array<String>