- Bluetooth API for the browser. Works only over HTTPS (not localhost).
- https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API
- Experimental, see https://caniuse.com/web-bluetooth
Types
Bluetooth = ref object of JsRoot referringDevice*: BluetoothDevice ## https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/referringDevice
- https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth
BluetoothDevice = ref object of JsRoot id*: cstring ## https://developer.mozilla.org/en-US/docs/Web/API/BluetoothDevice/id name*: cstring ## https://developer.mozilla.org/en-US/docs/Web/API/BluetoothDevice/name
- https://developer.mozilla.org/en-US/docs/Web/API/BluetoothDevice
Procs
func canonicalUUID(name: cstring): cstring {. importjs: "(BluetoothUUID.$1(#) || \'\')", ...raises: [], tags: [].}
func getCharacteristic(name: cstring): cstring {. importjs: "(BluetoothUUID.$1(#) || \'\')", ...raises: [], tags: [].}
func getDescriptor(name: cstring): cstring {. importjs: "(BluetoothUUID.$1(#) || \'\')", ...raises: [], tags: [].}
func getService(name: cstring): cstring {. importjs: "(BluetoothUUID.$1(#) || \'\')", ...raises: [], tags: [].}
func requestDevice(self: Bluetooth): BluetoothDevice {. importjs: "(await #.$1())", ...raises: [], tags: [].}
func requestDevice(self: Bluetooth; acceptAllDevices: bool): BluetoothDevice {. importjs: "(await #.$1({acceptAllDevices: #}))", ...raises: [], tags: [].}
func unwatchAdvertisements(self: BluetoothDevice) {.importjs: "#.$1()", discardable, ...raises: [], tags: [].}
func watchAdvertisements(self: BluetoothDevice): bool {. importjs: "((await #.$1()) === undefined || false)", ...raises: [], tags: [].}