thanks for all the responses.
@gordon, yes, you're right just for prototyping..
Are you saying if I filter for a certain Ble device it should work? Which type of filter should I use?
Here are some filter options from google's bluetooth examples....
let filterService = document.querySelector('#service').value; if (filterService.startsWith('0x')) { filterService = parseInt(filterService); } if (filterService) { filters.push({services: [filterService]}); } let filterName = document.querySelector('#name').value; if (filterName) { filters.push({name: filterName}); } let filterNamePrefix = document.querySelector('#namePrefix').value; if (filterNamePrefix) { filters.push({namePrefix: filterNamePrefix}); } let options = {}; if (document.querySelector('#allDevices').checked) { options.acceptAllDevices = true; } else { options.filters = filters; } log('Requesting Bluetooth Device...'); log('with ' + JSON.stringify(options)); navigator.bluetooth.requestDevice(options) .then(device => { log('> Name: ' + device.name); log('> Id: ' + device.id); log('> Connected: ' + device.gatt.connected); }) .catch(error => { log('Argh! ' + error); });
@hydronics started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
thanks for all the responses.
@gordon, yes, you're right just for prototyping..
Are you saying if I filter for a certain Ble device it should work? Which type of filter should I use?
Here are some filter options from google's bluetooth examples....