nothing returned from device.discoverAllServicesAndCharacteristics()
See original GitHub issueI have a raspBerry Pi zero W running node with bleno. I have a service for writing to the PI. I used lightblue to connect to the pi over bluetooth and write hex values which I am able to see logging from the pi. (<< just to confirm the pi is working as expected)
So I am sure I have a service working but when I call device.discoverAllServicesAndCharacteristics() from the “Connecting and discovering services and characteristics” section in the documents, the device object, when I console.log from the second .then() looks like – id:“B8:27:EB:E4:EF:C5” isConnectable:null localName:null manufacturerData:null name:“raspberrypi” overflowServiceUUIDs:null rssi:null serviceData:null serviceUUIDs:null solicitedServiceUUIDs:null txPowerLevel:null
to me it seems there are no services coming from the device? what might I be doing incorrectly? I have also confirmed the deviced id matches that coming from the pi.
the code im having issues with is - `
scanAndConnect() { this.manager.startDeviceScan(null, null, (error, device) => { if (error) { // Handle error (scanning will be stopped automatically) return } // Check if it is a device you are looking for based on advertisement data // or other criteria. if (device.name === ‘raspberrypi’) { this.manager.stopDeviceScan(); device.connect() .then((device) => { return device.discoverAllServicesAndCharacteristics(device.id) }) .then((device) => { console.log(“device connected!”); console.log(device); // <--------- this is the console.log() I am referring to // Do work on device with services and characteristics }) .catch((error) => { // Handle errors console.log(error); }); } }); } `
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:5 (3 by maintainers)
Top GitHub Comments
There is
services()
function which returns Array of currently discovered services.Fixed previous comment to not mislead anybody.