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

Add support for passive scans #283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BartTK
Copy link

@BartTK BartTK commented Jan 6, 2023

Add support for passive scans. In my case (crowded BLE environment), a passive scan detects devices a lot faster and more reliably. In additional, a passive scan consumes less power as the BLE radio is not transmitting.

Also added the ability to retrieve the devices for which only advertise data is available. That's what you are typically interested in when doing a passive scan.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jan 6, 2023
@iKK001
Copy link

iKK001 commented Apr 6, 2023

@BartTK : You describe passive scans with your PR (i.e. improvement in crowded BLE environments).

If I want to use the passive scan mode in crowded BLE environments, can you please tell me the best way ?

  1. Do I call BLE.scanForUuid(MY_BLE_UUID_SERVICE, true, false); ??

(i.e. withDuplicates = true and activeScan = false)

or do I call BLE.scanForUuid(MY_BLE_UUID_SERVICE, false, false); ??

(i.e. withDuplicates = false and activeScan = false)

  1. Can you please confirm that in any case, if I use your PR-chage with activeScan = false, then I have to call BLE.available(true) in any case ?

  2. Do you use BLE.poll(); right in front of BLE.available(true); ?? (some people seem to recommend this). Is it necessary with your PR-change anymore ?

  3. I realized that using your activeScan = false, then I cannot use peripheral.localName() anymore to check whether my sender-peripheral has the correct name. Can you confirm that with your PR-change there is no longer the possibility to use peripheral.localName() ?

  4. Are you aware of the fact that if you use your PR-change that the problematic of freezing receive-centrals still exists ?
    See this issue for more information - it is still not solved.
    What I mean by freezing receive-central is that with the ArduinoBLE, there is a problem when the receiver-central is on 24/7. And the sender-pheripheral is turned off (cut from battery) and turned on again after hours. This is an issue that is still not solved. Also not with your PR-change.

Thank you for your clarifications on this.

@BartTK
Copy link
Author

BartTK commented Apr 13, 2023

I use BLE.scanForAddress(DEVICE_ADDRESS, true, false); myself. Followed by a for-loop that keeps calling BLE.available(true); until it returns a device; that must be the correct device as I was scanning very specifically for the address. There is no BLE.poll(); in there, the BLE.available(true); takes care of that itself.

When doing a passive scan, you get less information from a device compared to an active scan. I think it is device dependent what it returns exactly. Local names are typically not included, so you shouldn't assume that those are present. It has been a while since I played around with it, but I think the service UUID is included. My guess would be that your BLE.scanForUuid(..); should work.

I've only added support for passive scans and haven't done anything about that issue you mentioned, so it wasn't my intent to solve that problem here.

@facchinm All checks succeeded, the review was OK and there are no conflicts. Is there anything I still need to do to have this PR merged?

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


BartTK seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants