Android library that solves some of Android's Bluetooth Low Energy problems I had.
- This library is still in progress & on testing...
- It solves the common problems one regularly have with BLE on Android, like race conditions, queueing commands, and blocking of binder threads.
CoBle.init(config)
- Configuration
val config = config(context = applicationContext) {}
- an optional way to inject some feature for example
BluetoothUsabilityFeature
which used to handle Bluetooth Permissions checks & Location service.
val config = config(context = applicationContext) {
addFeature(BluetoothUsabilityFeature.Instance)
}
val scanner: BluetoothScanner
scanner.startScanning()
scanner.stopScanning()
- Scanning with configured configuration
val scanningConfiguration = ScanningConfig.Builder()
.setScanSetting(ScanSettings.Builder().build())
.setNamePatterns(listOf(Pattern.compile("")))
.setScanFilters(listOf(ScanFilter.Builder().setDeviceName("").build()))
.build()
scanner.startScanning(scanningConfiguration)
val connector: BluetoothConnector
connector.connect(bluetoothDevice)
val connector: BluetoothConnector
connector.connect(...)
connector.getServices()
connector.getService(...)
connector.discoverServices()
connector.readCharacteristic(...)
connector.writeCharacteristic(...)
connector.writeDescriptor(...)
connector.readDescriptor(...)
connector.setPreferredPhy(...)