Skip to content

Instantly share code, notes, and snippets.

@limhenry

limhenry/2.js Secret

Created May 9, 2020 17:57
navigator.bluetooth.addEventListener('advertisementreceived', event => {
console.log('Advertisement received.');
console.log('Device Name: ' + event.device.name);
console.log('Device ID: ' + event.device.id);
console.log('RSSI: ' + event.rssi);
console.log('TX Power: ' + event.txPower);
console.log('UUIDs: ' + event.uuids);
event.manufacturerData.forEach((valueDataView, key) => {
console.log('Manufacturer', key, valueDataView);
});
event.serviceData.forEach((valueDataView, key) => {
console.log('Service', key, valueDataView);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment