Bluetooth (Beta)
Bluetooth.requestDevice()
Usage example
async function scan() {
const device = await Bluetooth.requestDevice({acceptAllDevices: true});
// To establish a connection to the device, use `device.gatt.connect()`
// Note: In many cases, no device name will be reported. We use this
// as a filter just to reduce noise for the example.
if (device.name) {
device.gatt.connect().then(() => {
console.log('Connected to ', device.name);
notification.info('Connected to: ' + device.name);
}).catch(err => {
console.error('Failed to connect to', device.name, err);
notification.error('Failed to connect to: ' + device.name);
});
}
}Bluetooth.requestLEScan()
Usage example
Last updated
