rt
Alvin Chen:
CC2652R没有这个函数了,你要做什么?
user5758795:
回复 Alvin Chen:
想要获得连接句柄,但是不知道怎么获得
Alvin Chen:
回复 user5758795:
central 还是peripheral?
user5758795:
回复 Alvin Chen:
是peripheral
Alvin Chen:
回复 user5758795:
参考我下面的程序:
bStatus_t ServApp_SendNotiInd( uint8_t *nvalue,uint16_t nlen) {attHandleValueNoti_t noti;uint16_t slen;bStatus_t status;slen= nlen;gattCharCfg_t *pItem = simpleProfileChar4Config;if( pItem->connHandle != LINKDB_CONNHANDLE_INVALID ){noti.pValue = (uint8 *)GATT_bm_alloc( pItem->connHandle, ATT_HANDLE_VALUE_NOTI,slen,&slen); //if ( noti.pValue != NULL ){noti.handle =simpleProfileAttrTbl[11].handle;noti.len = slen;memcpy(noti.pValue, nvalue, slen);status = GATT_Notification( pItem->connHandle, ¬i, FALSE );if ( status != SUCCESS ){GATT_bm_free( (gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI );}}else{GATT_bm_free( (gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI );status = bleNoResources;}}return ( status ); }
user5758795:
回复 Alvin Chen:
嗯嗯,大佬,我能再问一个问题吗,notify连接失败可能的原因有哪些,谢谢谢谢
Alvin Chen:
回复 user5758795:
* @return@ref INVALIDPARAMETER* @return@ref MSG_BUFFER_NOT_AVAIL* @return@ref bleNotConnected* @return@ref bleMemAllocError* @return@ref bleInvalidMtuSize : Packet length is larger than connection's MTU size.* @return@ref bleTimeout : Previous transaction timed out.
常见的一般为内存分配问题,请参照我写的那个有malloc 和free 不要搞野指针,还有就是信号不好之类的,最常见的就是内存问题。