I am not completely sure what you are searching for, but please take a look at the Dialog Serial Port Service (DSPS) reference application. The DSPS contains 2 projects :
sps_host : the DA14585 is acting as a Central
sps_device : the DA14585 is acting as a Peripheral
If I misunderstood your question, please try to clarify it as it is little big generic.
This is our English forum and customers post their questions in English. So, please translate your question / comments in English, or post it in our Chinese forums.
According to Bluetooth LE specification, it is not possible to scan ( GAP Central role) and advertise ( GAP Peripheral role) at the same time. Since you are using DA14585, you can perform role switching from Peripheral to Central GAP configuration and vice versa. This can be done by setting the role to GAP_ROLE_ALL, so that you can either advertise or scan. But it’s not possible to do both simultaneously.
Let’s take the ble_app_peripheral example of the SDK as a start point. By default, the DA14585 is configured as a peripheral, so it starts advertising (undirected). You can use an app_easy_timer() and upon its expiration, you should stop advertising. As soon as it stops, you can configure the device as a Central and start scanning. You can either wait for the scan to complete (if you are scanning in GAP_GEN_DISCOVERY) or set an additional timer and cancel the scanning procedure. When the scanning is completed, maybe you can start advertising again. Please check the steps below in order to perform role switching.
- Change the .role member of the user_gapm_conf structure to to GAP_ROLE_ALL , in the user_config.h file.
- Create a user_scan_start() function in order to start scanning:
- In the user_app_adv_start() function there is a timer that starts up in order to stop the advertising after about 30 seconds, so we are going to use that in order to stop the advertising.
- So in the callback of the timer adv_data_update_timer_cb() instead of updating of the advertising string, invoke the app_easy_gap_advertise_stop() function.
- In the user_app_adv_undirect_complete() function invoke the user_scan_start() function, so that when the device stops advertising to start scanning.
- In order to stop scanning, an additional timer won’t be used in order to cancel the command, but the timeout of the scanning itself will be used.
- To start advertising as soon as the scanning ends create a function user_on_scanning_completed() and from that function invoke the user_app_adv_start();
Hi There,
I am not completely sure what you are searching for, but please take a look at the Dialog Serial Port Service (DSPS) reference application. The DSPS contains 2 projects :
sps_host : the DA14585 is acting as a Central
sps_device : the DA14585 is acting as a Peripheral
If I misunderstood your question, please try to clarify it as it is little big generic.
This is our English forum and customers post their questions in English. So, please translate your question / comments in English, or post it in our Chinese forums.
https://support.dialog-semiconductor.com/forums/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software-dialog-%E2%80%9Csmartbond%E2%80%9D%E7%B3%BB%E5%88%97%E4%BD%8E%E5%8A%9F%E8%80%97%E8%93%9D%E7%89%99%E2%80%94%E8%BD%AF%E4%BB%B6
Thanks, PM_Dialog
Thank you for your reply
Master and slave integrated program,It can be either a master or a slave, and the master and slave can be switched through the state.
Hi There
According to Bluetooth LE specification, it is not possible to scan ( GAP Central role) and advertise ( GAP Peripheral role) at the same time. Since you are using DA14585, you can perform role switching from Peripheral to Central GAP configuration and vice versa. This can be done by setting the role to GAP_ROLE_ALL, so that you can either advertise or scan. But it’s not possible to do both simultaneously.
Let’s take the ble_app_peripheral example of the SDK as a start point. By default, the DA14585 is configured as a peripheral, so it starts advertising (undirected). You can use an app_easy_timer() and upon its expiration, you should stop advertising. As soon as it stops, you can configure the device as a Central and start scanning. You can either wait for the scan to complete (if you are scanning in GAP_GEN_DISCOVERY) or set an additional timer and cancel the scanning procedure. When the scanning is completed, maybe you can start advertising again. Please check the steps below in order to perform role switching.
- Change the .role member of the user_gapm_conf structure to to GAP_ROLE_ALL , in the user_config.h file.
- Create a user_scan_start() function in order to start scanning:
- In the user_app_adv_start() function there is a timer that starts up in order to stop the advertising after about 30 seconds, so we are going to use that in order to stop the advertising.
- So in the callback of the timer adv_data_update_timer_cb() instead of updating of the advertising string, invoke the app_easy_gap_advertise_stop() function.
- In the user_app_adv_undirect_complete() function invoke the user_scan_start() function, so that when the device stops advertising to start scanning.
- In order to stop scanning, an additional timer won’t be used in order to cancel the command, but the timeout of the scanning itself will be used.
- To start advertising as soon as the scanning ends create a function user_on_scanning_completed() and from that function invoke the user_app_adv_start();
Thanks, PM_Dialog
Thank you for your reply. I'll try this method