您好,CC2642的SDK没有这个函数吧 GAPRole_SetParameter();
user6193948:
回复 Viki Shi:
还有一个问题请教一下,连接句柄如何获取?
GAP PARAMGAPROLE_CONNHANDLEReturned for each GAP event
这里的Returned for each GAP event 应该怎么实现呢?
Viki Shi:
回复 user6193948:
GAPROLE_CONNHANDLE 这个是GAPRole_SetParameter里的参数, GapAdv_enable()里是handle这个参数: Handle of advertising set to enable
user6193948:
回复 Viki Shi:
可能我的问题没有表述清楚。
在CC2640中使用GAPRole_GetParameter(GAPROLE_CONNHANDLE, &connectionHandle);可以获得连接句柄connectionHandle,
在CC2642中应该怎么去获得这个连接句柄呢。
user6193948:
回复 user6193948:
我需要这个连接句柄去调用HCI_ReadRssiCmd(connectionHandle),来获得RSSI值
user6193948:
回复 user6193948:
获取MAC地址,也需要调用这个函数,GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);
在您发的api中我未找到此函数的替代函数。
Viki Shi:
回复 user6193948:
你可以看一下simple peripheral 里的代码实现:
static void SimplePeripheral_processConnEvt(Gap_ConnEventRpt_t *pReport) {// Get index from handleuint8_t connIndex = SimplePeripheral_getConnIndex(pReport->handle);if (connIndex >= MAX_NUM_BLE_CONNS){Display_printf(dispHandle, SP_ROW_STATUS_1, 0, "Connection handle is not in the connList !!!");return;}// If auto phy change is enabledif (connList[connIndex].isAutoPHYEnable == TRUE){// Read the RSSIHCI_ReadRssiCmd(pReport->handle);} }这里是通过结构体pReport,也就是Gap_ConnEventRpt_t,这个在gap.h里定义,代码如下:typedef struct {GAP_ConnEvtStat_tstatus;//!< status of connection eventuint16_thandle;//!< connection handleuint8_tchannel;//!< BLE RF channel index (0-39)GAP_ConnEvtPhy_tphy;//!< PHY of connection eventint8_tlastRssi; //!< RSSI of last packet received/// Number of packets received for this connection eventuint16_tpackets;/// Total number of CRC errors for the entire connectionuint16_terrors;/// Type of next BLE taskGAP_ConnEvtTaskType_t nextTaskType;/// Time to next BLE task (in us). 0xFFFFFFFF if there is no next task.uint32_tnextTaskTime; } Gap_ConnEventRpt_t;