3 posts / 0 new
Last post
comprends
Offline
Last seen:2 days 23 hours ago
加入:2019-06-21 07:31
DA14531indicate问题

请问DA14531 indicate发送数据应该怎么用呢?

DA14580是这样的:

attmdb_att_set_value((custs1_env.shdl+CUST1_IDX_INDICATEABLE_VAL), SendData_Param_length, (uint8_t*)value);
prf_server_send_event (prf_env_struct *)&(custs1_env.con_info), false, (custs1_env.shdl+CUST1_IDX_INDICATEABLE_VAL));

在DA14531里好像没有prf_server_send_event函数了。参考sdk例程custs1_val_ind_req_handler函数时,发现这个函数在编译DA14531的时候是注释掉的,那正确的通过indicate发送数据的流程是怎么样的呢

期待回复 谢谢

Device:
CYibin
Offline
Last seen:5 months 2 weeks ago
工作人员
加入:2017-12-14 02:48
你好,

你好,

参考sdk 中 ble_app_perpheral 工程发送 ntf 的做法,将其改成 indication 即可:

void app_adcval1_timer_cb_handler() { struct custs1_val_ntf_ind_req *req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_IND_REQ, // ycai indication event prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_ntf_ind_req, DEF_SVC1_ADC_VAL_1_CHAR_LEN); // ADC value to be sampled static uint16_t sample __SECTION_ZERO("retention_mem_area0"); sample = (sample <= 0xffff) ? (sample + 1) : 0; //req->conhdl = app_env->conhdl; req->handle = SVC1_IDX_ADC_VAL_1_VAL; req->length = DEF_SVC1_ADC_VAL_1_CHAR_LEN; req->notification = false; // ycai: false for indication, true for notification memcpy(req->value, &sample, DEF_SVC1_ADC_VAL_1_CHAR_LEN); ke_msg_send(req); if (ke_state_get(TASK_APP) == APP_CONNECTED) { // Set it once again until Stop command is received in Control Characteristic timer_used = app_easy_timer(APP_PERIPHERAL_CTRL_TIMER_DELAY, app_adcval1_timer_cb_handler); } }

comprends
Offline
Last seen:2 days 23 hours ago
加入:2019-06-21 07:31
谢谢,搞定了

谢谢,搞定了