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

BLE Central Implementation #2

Open
BigCorvus opened this issue Sep 2, 2022 · 3 comments
Open

BLE Central Implementation #2

BigCorvus opened this issue Sep 2, 2022 · 3 comments

Comments

@BigCorvus
Copy link

Hi,
is there a way of implementing BLE central functionality ideally concurrently with peripheral role on your core? I have a use case that requres a connection to multiple BLE peripherals while acting as a peripheral at the same time. I'd love to see how the WB55 performs on this task.
Keep up the great work!
Best,
Arthur

@nguyenmanhthao996tn
Copy link

I have the same question! I just need to scan the available devices and get their ID.
I tried to use examples from BLE folder with following steps:

  • Set the role to GAP_PERIPHERAL_ROLE | GAP_CENTRAL_ROLE
  • Enable these event masks: ACI_GAP_PROC_COMPLETE_EVENT, HCI_LE_ADVERTISING_REPORT_EVENT, HCI_LE_EXTENDED_ADVERTISING_REPORT_EVENT
  • Call the function named aci_gap_start_general_discovery_proc to trigger the scan

The aci_gap_start_general_discovery_proc function seems to work. Because it's always return BLE_STATUS_NOT_ALLOWED before the scan timeout (10.24 seconds) and BLE_STATUS_SUCCESS after the scan!

However, the events that used to retrieve data are never called! Don't know if I miss something. Tried to check with the stack from STM32 but they always use polling + switch/case.

@GrumpyOldPizza
Copy link
Owner

I need to add that hopefully soon than later. There are a few issues though. Main one is the API ... ArduinoBLE uses (I think) ::available() ... That just feels wrong. Scanned devices get discovered async, so how to allocate the backing object ...

The BLE class itself uses a switch statement to process it's events (BLELocalDevice::process()). So hooking in the ST style callback functions is not supported. I'd think it should be possible to write some small piece of code to bypass the whole BLE class and use ST's stack directly (raw event-callback and raw request functions).

@BigCorvus
Copy link
Author

Cool!
Meh, BLE code without callbacks is like soldering without heat. Who needs the ArduinoBLE library anyway? ;)

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

3 participants