Skip to content

PAM Native Bluetooth

Every PAM Native product runs on the PAM runtime. Install and verify PAM first, create a Native application, and add this package through PAM Composer:

Terminal window
curl -fsSL https://github.com/push-in/pam/releases/latest/download/install.sh | sh
pam doctor
pam init my-app --template native
cd my-app
pam composer require pushinbr/pam-native-bluetooth
pam doctor
pam native dev
$bluetooth->scan(['180d'], fn (bool $ok, ?string $error) => null);
$bluetooth->poll(function (array $events) use ($bluetooth): void {
foreach ($events as $event) {
if ($event->kind === BluetoothEventKind::DeviceFound) {
$bluetooth->connect($event->deviceId, fn () => null);
}
}
});

Bluetooth owns scan, connection, discovery, characteristic reads/writes, subscriptions, and polling. BluetoothEvent, BluetoothEventKind, and BluetoothState normalize native lifecycle without exposing MAC-address assumptions.

The queue holds 256 events and drops the oldest under sustained backpressure; poll regularly and stop scans promptly. Android 12+ requires Nearby Devices; older Android may require location for discovery. iOS uses the supplied Bluetooth purpose description. Protocol framing, authentication, bounded retry, and firmware validation remain application responsibilities.

Support: PAM Native 0.6.x, Android API 26+, iOS 15+, physical BLE certification.

BluetoothPluginProvider registers the native module automatically.