SimpleBLE
SimpleCBLE

Platform Notes

SimpleCBLE notes on native backends, the advanced platform functions available from C, local peripheral hosting on Android, and Dongl and Linux pairing.

The SimpleBLE platform notes also apply to the C API, including permission requirements, address formats, and connection behavior. Backend enumeration lets you select an implementation explicitly; it does not bypass OS permissions.

Advanced APIs

Include <simplecble/advanced.h> or the umbrella header. Native advanced functions are declared for their target platform and implemented when that native backend is built.

Backend/platformC API
DonglPasskey-entry, passkey-display, and numeric-comparison callback setters
macOSsimpleble_advanced_macos_set_advertisement_local_name() and simpleble_advanced_macos_retrieve_cached_peripheral()
iOSsimpleble_advanced_ios_set_advertisement_local_name() and simpleble_advanced_ios_retrieve_cached_peripheral()
Linuxsimpleble_advanced_linux_set_advertisement_local_name() and the passkey-request, passkey-display, numeric-comparison, and pairing-authorization callback setters
Androidsimpleble_advanced_android_get_jvm(), simpleble_advanced_android_set_jvm(), and simpleble_advanced_android_set_context()

Apple cached-peripheral lookup accepts one CoreBluetooth identifier. It requires a powered-on adapter, does not scan, and does not guarantee reachability. An invalid or unknown identifier returns NULL without an error. Release a returned peripheral handle normally.

The advertised-name setters take a local peripheral handle. Configure the name before starting the host; NULL removes the override. They change the advertisement, not the system Bluetooth name.

Linux pairing

How SimpleBLE takes part in BlueZ pairing is described in Pairing. Call simpleble_config_simplebluez_set_interactive_pairing(true) before retrieving adapters so that passkey and numeric comparison requests reach the callbacks.

The Linux callback setters take an adapter handle and cover the peripherals it connects to and the clients of its local peripherals. Each callback receives the peer's address as a borrowed string. Passkey entry writes six decimal digits plus a NUL terminator into the supplied seven-byte buffer and returns true; return false to reject pairing. Display and comparison callbacks receive a borrowed six-digit string, and the authorization callback returns true to accept Just Works pairing. A missing entry or comparison callback rejects that request. The callbacks run on SimpleBLE's BlueZ event thread, which waits for them to return.

Android local hosting

Provide the application's Java VM and application context before creating a local peripheral. Use the application context rather than an Activity context. The context setter retains a global JNI reference; get_jvm() returns a borrowed pointer. Each of these functions takes an error slot.

Dongl pairing

How the Dongl pairs and stores bonds is described in Pairing and bonding. Register pairing callbacks before connecting. Passkey entry writes six decimal digits plus a NUL terminator into the supplied seven-byte buffer and returns true; return false to reject pairing. Preserve leading zeroes.

Display and comparison callbacks receive a borrowed six-digit string. Numeric comparison returns true only when the user confirms the peer shows the same number. A missing entry or comparison callback rejects that request. These callbacks run on an internal worker thread and can obtain user input there.

The Dongl callback setters accept NULL to unregister and retain an error argument because a non-Dongl peripheral cannot accept these registrations.

On this page