我想向指定的一组数据发送通知(不一定是特征中的数据)。
这是发送通知的正确方法吗?似乎没有正常工作。当我使用prf_server_send_event时,通知是有效的,但如果我正在快速更新字符,我得到相同数据的倍数,而不是具有唯一数据的单个通知。
void sendeventdata(prf_env_struct * p_env,bool指示,uint16_t句柄,uint8_t长度,uint8_t * pdata)
{
//分配gatt通知消息
struct gattc_event_ind * req = ke_msg_alloc(gattc_event_ind,
KE_BUILD_ID(task_gattc,p_env-> con_info.conidx),p_env-> con_info.prf_id,
sizeof(struct gattc_event_ind)+长度);
if(req!= null)
{
//填写参数结构
req-> type =((指示)?gattc_indicate:gattc_notify);
req-> handle = handle;
req->长度=长度;
memcpy(req->值,pdata,长度);
//发送活动
KE_MSG_SEND(REQ);
}
}
设备:
嗨本,
您可以检查如何在SDK 5中从App_ble_Peripheral示例发送通知。
谢谢mt_dialog.