bare-bluetooth-apple
Reference overview for bare-bluetooth-apple: Apple CoreBluetooth bindings for Bare, covering both the peripheral and central roles.
bare-bluetooth-apple provides CoreBluetooth bindings for Bare on Apple platforms (iOS and macOS). It's a native addon—on Android use bare-bluetooth-android. This page is an overview; see the repository README for the full API.
npm i bare-bluetooth-appleUsage
const bluetooth = require('bare-bluetooth-apple')
const manager = new bluetooth.PeripheralManager()
manager.on('stateChange', (state) => {
if (state !== 'poweredOn') return
const char = new bluetooth.Characteristic('01230001-0000-1000-8000-00805F9B34FB', {
write: true,
notify: true
})
const service = new bluetooth.Service('01230000-0000-1000-8000-00805F9B34FB', [char])
manager.addService(service)
})API overview
PeripheralManager— the peripheral (advertiser/server) role: publish services and advertise to centrals, observing adapter state via thestateChangeevent.Service— a GATT service identified by a UUID, holding a set of characteristics.Characteristic— a GATT characteristic with a UUID and properties such aswriteandnotify.
The module also exposes the central (scanner/client) role and a Constants table; it builds on bare-events and bare-stream. Refer to the repository for the complete surface.
See also
bare-bluetooth-android—the Android counterpart.- Bare modules—the full
bare-*catalog. - One core, many platforms—using platform bindings from a native shell.