雷竞技电竞平台Dialog Semiconductor客户支持-外设角色 https://support.dialog-semiconductor.com/resource-keywords/peripheral-role 角色转换 https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/role-switching < div class = "字段field-name-taxonomy-forums field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >论坛:,< / div > < div class = "字段条目" > < div class =”field-item甚至“rel = " sioc: has_container " > < a href = " /论坛/ dialog-smartbond-bluetooth-low-energy - % E2 % 80% 93 -软件”“=“sioc:容器sioc:论坛”属性= " rdfs: label skos: prefLabel”数据类型= " " >对话框Smartbond蓝牙低能量-软件< / > < / div > < / div > < / div > < div class =”字段field-name-body field-type-text-with-summary field-label-hidden”> < div class = "字段条目" > < div class =”field-item甚至“财产=“内容:编码”> < p >你好Dialog_support, < / p > < p >我已经配置角色切换使用ble_app_peripheral example and DSPS project. Default mode of operation is peripheral and as i press push button, current role is switched to central. Along with role switch, it also performs operations like connect to other peripheral and send data. Now next role switch is happened only when push button is pressed. The role switch part is smoothly working but after changing role when connection with respective central and peripheral is taking place, i am facing issue. I have created custom client profile with the help of DSPS project named as custc1.c and custc1_task.c. In this file, i have declared two constant structures.

1.if i declare GATTC_CMP_EVT in the below structure then in peripheral mode, its smoothly connects to mobile App but during central mode it is not able to connect to peripheral.
const struct ke_msg_handler custc1_connected[] =
{
{CUSTC1_DATA_WRITE_REQ, (ke_msg_func_t)custc1_data_write_req_handler},
{GATTC_CMP_EVT, (ke_msg_func_t)gattc_cmp_evt_handler},
};

2. if i declare GATTC_CMP_EVT in the below structure then in central mode, it is able to connects to other peripheral but during peripheral mode, when we try to connects to mobile App then it goes into hardfault_handler.
const struct ke_msg_handler custc1_default_state[] =
{
{CUSTC1_ENABLE_REQ, (ke_msg_func_t)custc1_enable_req_handler},
{GAPC_DISCONNECT_IND, (ke_msg_func_t)gapc_disconnect_ind_handler},
{GATTC_CMP_EVT, (ke_msg_func_t)gattc_cmp_evt_handler},
};

The above gattc_cmp_evt_handler is defined in custs1_task.c and custc1_task.c. But that handler is declared as static. Can you help me out to find out what could be the reason?

I have uploaded image of custc1_task.c file's structures which i have used.

Thanks and Regards,
Ruchi Patel

Device: 
星期二,2018年1月23日12:05:43 +0000 前腿帕特尔 140468年https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/role-switching#comments