admin管理员组文章数量:1550690
从机给主机发送数据有两种方式: 第一种:通过GATT_Notification()这个函数来通知主机。 第二种:通过GATTServApp_ProcessCharCfg()这个函数通知主机。 简介这两种方式, 一、GATT_Notification(): 在从机代码中使用,由从机主动通知,且不需要主机发出请求和回应。 例如,在需要从机给主机发送数据的地方,直接使用这个函数即可。 void GUA_SimpleGATTprofile_Char1_Notify(uint16 nGUA_ConnHandle, uint8 *pGUA_Value, uint8 nGUA_Len) { attHandleValueNoti_t stGUA_Noti; //填充数据 stGUA_Noti.handle = simpleProfileAttrTbl[3].handle; //读取notification对应的handle stGUA_Noti.len = nGUA_Len; //数据长度 osal_memcpy(stGUA_Noti.value, pGUA_Value, nGUA_Len); //赋值 //发送数据 GATT_Notification(nGUA_ConnHandle, &stGUA_Noti, FALSE); } 注意:在这里函数GATT_Notification()直接把通知发送给主机,不管是否通知是否使能。即无论notify开关是否打开,从机都能把数据发送给主机。 二、GATTServApp_
本文标签: Notification
版权声明:本文标题:cc2541之Notification 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1727248483a1104931.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论