Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Discovering all Peripherals #7

Closed
jaret32 opened this issue Oct 29, 2018 · 20 comments
Closed

Not Discovering all Peripherals #7

jaret32 opened this issue Oct 29, 2018 · 20 comments

Comments

@jaret32
Copy link

jaret32 commented Oct 29, 2018

I have an Adafruit Feather 32u4 Bluefruit LE board that I am trying to connect to. Before upgrading to MacOS Mojave and using the original noble branch, the peripheral could be discovered. After upgrading, noble was unable to discover any peripherals. Since then I have tried using this repository instead, and it does detect some peripherals, but not the board I am trying to connect to. I am not sure what the issue is, please let me know if you have any suggestions.

@s524797336
Copy link

s524797336 commented Oct 30, 2018

Try it and see if it works.

npm install @s524797336/noble-mac@prerelease

@jaret32
Copy link
Author

jaret32 commented Oct 30, 2018

Yes, it worked. Thank you! Can I ask what exactly that does to make it work?

@s524797336
Copy link

s524797336 commented Oct 31, 2018

It actually scans out all the hardware, but when it outputs to node, the thread is blocked, so your hardware is randomly output by chance, since there is so much hardware, the chance is very low.
I don't known about C so i just remove all the nameless hardware in the C code to reduce output.
I will upgrade this package to improve thread block issue by NOT remove nameless hardware in the future.
Or maybe it is deep issue...
I'm not good at English, hope i make my self clear.

@StephaneJuban
Copy link

For it to work I installed it with npm install @s524797336/noble-mac otherwise I was getting error during the node install.js

After that, with var noble = require('@s524797336/noble-mac'); it worked and I am now able to see peripherals.

@geovie
Copy link
Collaborator

geovie commented Nov 1, 2018

@s524797336 Thanks for investigating this issue!
Unfortunately I can't reproduce the issue (not that many ble devices around...)
How many devices do you get in a single scan?

Could you check if all devices are delivered to the callback by logging the uuid of the devices (printf("%s\n", uuid.c_str());) in the Emit::Scan method (this line https://github.com/Timeular/noble-mac/blob/master/src/callbacks.cc#L89)

@akinyema
Copy link

akinyema commented Nov 1, 2018

Hi,
using that i get Segmentation fault: 11 error at random. Sometimes it works and sometimes it doesn't, Is there a way to stop this?

@s524797336
Copy link

@geovie
I don't known how to run C code, even you don't have many devices, you can start a thread to simulation a lot of callback and see if some of them are not emit or delay a lot of time to emit.
I'm not sure this issue is problem, but reduce emit dose output what i want.

@geovie
Copy link
Collaborator

geovie commented Nov 6, 2018

I tested it and the simulation works for me (the library we are use has a testcase for this problem).
If your peripherals are advertising their service uuids you could filter by that.
Which node version are you using?

@s524797336
Copy link

@geovie
node 10.10.0

@geovie
Copy link
Collaborator

geovie commented Nov 8, 2018

@s524797336 Could you check out branch test/not-discovered, run the following two commands yarn build and yarn repro and then post the output here.

@s524797336
Copy link

@geovie
I'm in hospital, i'll do that when i got the chance.

@geovie
Copy link
Collaborator

geovie commented Nov 12, 2018

Another thing to try is to set allowDuplicates to true

noble.startScanning([], true); // any service UUID, allow duplicates

Could someone try that and report back? Thanks!

@ReinierH
Copy link

ReinierH commented Dec 5, 2018

@geovie
That doesn't fix it

@geovie
Copy link
Collaborator

geovie commented Dec 5, 2018

@ReinierH Can you try the test/not-discovered branch and post the results here?

@ReinierH
Copy link

@geovie
Sorry for not getting back to you earlier.
I tested it and It now can discover peripherals but the localName stays empty.
I'm running it on nodejs v8.11.3

@geovie
Copy link
Collaborator

geovie commented Dec 13, 2018

@ReinierH Have you tried the latest version (0.0.3)? It was released yesterday and had some changes regarding advertiment handling...

@ReinierH
Copy link

@geovie
Just tried discovering devices with 0.0.3, it seems that some of the properties in "advertisement" are missing.

I've included the console.log of a peripheral below
_events: { warning: [Function: bound ], newListener: [Function: bound ], stateChange: [Function], discover: [AsyncFunction] }, _eventsCount: 4, _allowDuplicates: undefined }, id: '3b298bc874144c2cad1bcac3905ed5c0', uuid: '3b298bc874144c2cad1bcac3905ed5c0', address: '', addressType: 'unknown', connectable: true, advertisement: { manufacturerData: <Buffer 57 01 00 29 1c 9c 59 10 7c b5 fc eb 3a fa fe 39 48 1d fc 01 d0 46 82 41 5a 79> }, rssi: -87, services: null, state: 'disconnected' }

@geovie
Copy link
Collaborator

geovie commented Dec 14, 2018

@ReinierH Yes that's expected, apparently they are not delivered by the OS on every discover event. #17 changed the behavior so that we only update advertisement properties which have changed, as noble would override the previous property if we set the property to a default value (see also #16 ).
So the advertisement will be updated once we get the advertisement info from the OS.

Maybe wait a few seconds and check the device then...

@s524797336
Copy link

@geovie i tested new 0.0.3 and everything work perfect

@geovie
Copy link
Collaborator

geovie commented Dec 18, 2018

@s524797336 Great, thanks for testing!

Fixed in 0.0.3

@jaret32 @ReinierH I'll close this issue, if you're still having problems please open a new one, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants