我正在使用SDK的BLE_EXAMPLES \ BLE_APP_PERITELAL项目
我通过发送gattm_add_svc_req消息来添加新服务,如下所示:
step0 struct gattm_add_svc_req * req = ke_msg_alloc(gattm_add_svc_req,task_attm,task_app,gattm_add_svc_req);req-> task_id = task_app;req-> total_size = 36;// 16 + 19 +1 req-> nb_att_uuid_16 = 2;req-> nb_att_uuuid_32 = 0;req-> nb_att_uuid_128 = 1;req-> start_hdl = 0;KE_MSG_SEND(REQ);
我在user_catch_rest_hndl(...)函数中有一个gattm_add_svc_rsp响应
但是,当我在user_catch_rest_hndl(...)中执行以下代码step2时,程序将死亡:
案例gattm_add_svc_rsp:{struct gattm_add_svc_rsp const * msg_param =(struct gattm_add_svc_rsp const *)(param);if(msg_param-> status == att_err_no_error){arch_printf(“gattm_add_svc_rsp成功%d \ n”,msg_param-> start_hdl);} arch_printf_process();svc_handle = msg_param-> start_hdl;step1 // add svc delp属性struct gattm_add_attribute_req * addreq = ke_msg_alloc(gattm_add_attribute_req,task_attm,task_app,gattm_add_attribute_req);addreq - > start_hdl = svc_handle;//填充来自SVC成功RSP for上面的addReq - > perm = perm(rd,启用);addReq - > UUID_LEN = ATT_UUID_16_LEN;addreq - > max_data_size = att_uuid_128_len;UINT16_T ATT_DECL_SVC = ATT_DECL_PRIMARY_SERVICE; memcpy(addreq ->uuid, &att_decl_svc, sizeof(att_decl_svc)); ke_msg_send(addreq ); step2 //Set svc uuid value struct gattm_att_set_value_req * setreq = KE_MSG_ALLOC(GATTM_ATT_SET_VALUE_REQ,TASK_ATTM,TASK_APP,gattm_att_set_value_req); setreq ->handle =svc_handle; setreq ->length = ATT_UUID_128_LEN; uint8_t svc_uuid[16]={1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6}; memcpy(setreq ->value, svc_uuid, sizeof(svc_uuid)); ke_msg_send(setreq); } break;
仅执行Step1的代码不会杀死程序
你认为step2或step0的思考是什么?
设备:
嗨tm_dialog.
我正在使用SDK的BLE_EXAMPLES \ BLE_APP_PERITELAL项目
嗨Chenpenglai,
你跟着你教程3:构建自定义配置文件来自我们的支持网站?你是什么意思“不会杀死这个程序”吗?你在调试模式下运行吗?确实粘在任何地方?
谢谢,PM_DIALOG.