- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am considering the following BLE modules for development. My use case is I want the module to sense/scan identify the presence of another broadcaster module with a specific name/identifier. In case it does not identify one, then this one (the one currently scanning) should start broadcasting. To meet this requirement, I want to know if I can swap between BROADCASTER and OBSERVER during runtime.
In short, Scan for broadcaster -> If no broadcaster with specific name identified -> Start broadcasting. This is the algorithm.
Please guide. Thanks in advance.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to set a timeout for the scan. When the time out happens, switch to broadcast.
To get the scan result, please refer to (CYBLE_GAPC_ADV_REPORT_T *) eventParam; in the CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT event.
When switch to broadcast, use the API CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
What profile / GAP role should I prefer to set for the nodes on the "Configure BLE" GUI of PSoC creator IDE?
Peripheral / Central / Broadcaster / Observer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please set the BLE component to Client and Sever(GATT Client and Sever).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I will give a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot for sharing the project. I will give it a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Gyan,
Referring to the snippet below, are you turning on the peripheral mode advertisement as soon as the stack is ON and then starting central mode discovery? I want all of my nodes to scan for any other advertising node. In case they dont find one, then the scanning node will start advertising. Can you please spare your valuable time and explain this snippet?
case CYBLE_EVT_STACK_ON: /*BLE stack ON*/
printf("Bluetooth ON:\r\n");
cyBle_discoveryInfo.discProcedure=CYBLE_GAPC_OBSER_PROCEDURE;
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
CyBle_GapcStartDiscovery(&cyBle_discoveryInfo);
break;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello rajvignesh_3582366 ,
Based on your application, you can modify the logic as below.
-> On Stack On just start scanning.
case CYBLE_EVT_STACK_ON: /*BLE stack ON*/
printf("Bluetooth ON:\r\n");
cyBle_discoveryInfo.discProcedure=CYBLE_GAPC_OBSER_PROCEDURE;
CyBle_GapcStartDiscovery(&cyBle_discoveryInfo);
In the event CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT , you are viewing all the nearby advertising nodes.
If you do not find a particular node , you can stop the scanning (CyBle_GapcStopDiscovery()) and start advertising (CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST)) .
In the shared code example, the device will do both observer scanning and advertising concurrently.
-Gyan