Hi Dialog Team,
我正在自定义BLE_APP_PERITELAL以实现以下要求。
1) Device should scan for BLE packets in the GAP_OBSERVER_SCA mode.
2)在接收到第一BLE分组时,必须尽快重新发送该数据包。
3) After retransmission of the packet, the device should switch back to scanning mode.
We have to continue this process (steps 1 - 3) throughout the life of the device.
Please let us know if this (role switch) is supported by SDK 6.0.2.
谢谢in advance,
Wisilica
Device:
Hi wisillica,
Yes its possible to switch the roles of the device the same way that the 580 does, just send a GAPM_RESET_CMD and set up the device in the corresponding role.
谢谢MT_dialog
Hi,
We have tried issuing the reset command for role switching purpose. But, the time required for this was observed to be around 5ms. Please suggest the reasons for the same and techniques to reduce this time.
谢谢
Wisilica
嗨Wisilica,
你发送一个重置命令堆栈,和then you go through the entire configuration, we haven't estimated a maximum or a minimum time for this change but i suppose that it is quite reasonable, there are no techniques to reduce this time as far as i am aware. But since this is a 585, if you are worried about the timing that it takes to switch between two roles you can set the role in GAP_ROLE_ALL and advertise or scan (you can not do both at the same time) but you can advertise and set a timer, as soon as the timer elapses, stop the advertising procedure and as soon as it stops you can start scanning and 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) so as soon as the scanning completes start the advertising again.
谢谢MT_dialog
Hi,
Could you please provide a sample code which demonstrates this kind of advertisement and scan switch by using GAP_ROLE_ALL.
谢谢
Wisilica
嗨Wisilica,
I will provide the changes in order to perform this, using the ble_app_peripheral example:
void user_scan_start(void)
{
struct gapm_start_scan_cmd* cmd = KE_MSG_ALLOC(GAPM_START_SCAN_CMD,
TASK_GAPM, TASK_APP,
gapm_start_scan_cmd);
cmd->op.code = GAPM_SCAN_PASSIVE;
cmd->op.addr_src = GAPM_STATIC_ADDR;
cmd->interval = 16384;
cmd->window = 16384;
cmd-> mode = gap_gen_discovery;
cmd->filt_policy = SCAN_ALLOW_ADV_ALL;
cmd-> filter_duplic = scan_filt_duplic_en;
// Send the message
ke_msg_send(cmd);
// We are now connectable
ke_state_set(TASK_APP, APP_CONNECTABLE);
}
在上面的指令之后,您应该能够创建一个宣传和扫描固定间隔的演示,而无需在585上切换角色。
谢谢MT_dialog
Hello Dialog_Support,
I have read above all post and i want to perform exact functionality as mentioned above. But i have DA14580 board which doesn't support GAP_ALL_ROLE so what changes i need to perform if i use DA14580 board? Can you provide me steps like you have posted above for Da14585 or you can provide or suggest me any example code.
谢谢and Regards,
Ruchi Patel
Hi Ruchi Patel,
The DA14580 doesn’t support dual role by default, so it can operate either as central (scanning operation) or as peripheral (advertising operation). In order to do this, you will have switch between roles override some functionalities. So, you should issue a gapm reset command in order to reset BLE stack and re-configure the device as peripheral or as central depending on your application. Please check the following past posts in which the steps for that configuration are referred.
https://support.dialog-semicondiondiondum/forums/post/dialog-smartbond-bl ...
https://support.dialog-semicondiondiondum/forums/post/dialog-smartbond-bl ...
谢谢pm_dialog.