bluetooth#
A Bluetooth Low Energy (BLE) host stack in pure OCaml.
The radio is a separate controller (an external chip) reached over HCI. This
package implements everything above the HCI wire, as a set of I/O-free
sublibraries built on the wire
codec DSL:
bluetooth.types-- shared value types: 16/32/128-bit UUIDs, 48-bit device addresses (BD_ADDR), and the AD/EIR advertising-data codec.
The HCI, L2CAP, ATT, GATT, SMP, and GAP layers land as further sublibraries; a
separate bluetooth-eio package binds the stack to a transport.
Example#
$ opam install bluetooth
A 16-bit UUID expands to a full 128-bit value through the Bluetooth Base UUID:
# let u = Bluetooth_types.Uuid.of_uuid16 0x180F in
String.length (Bluetooth_types.Uuid.to_uuid128 u)
- : int = 16
Scope#
BLE only, both roles (Central and Peripheral). Classic Bluetooth (SDP, RFCOMM, audio profiles) is out of scope.