CC2540 在POWER SAVING模式下无法获取handle
主机正常通电,从机开启低功耗模式。若主机先上电,从机再上电(自动连接情况下),可以获取特征值的handle。
此时复位从机,则无法获取特征值handle。
若从机先上电,主机再上电自动连接从机,也无法获取特征值handle。
附上程序
else if ( simpleBLEDiscState == BLE_DISC_STATE_CHAR_TEMP )
{
// Characteristic found, store handle
if ( pMsg->method == ATT_READ_BY_TYPE_RSP &&
pMsg->msg.readByTypeRsp.numPairs > 0 )
{
TempCharHdl = BUILD_UINT16( pMsg->msg.readByTypeRsp.dataList[0],
pMsg->msg.readByTypeRsp.dataList[1] );
NPI_WriteTransport( "Temp handle Found\n", 19 );
simpleBLEProcedureInProgress = FALSE;
}
else // pMsg->msg.readByTypeRsp.numPairs is 0.
{
simpleBLEDiscState = BLE_DISC_STATE_CHAR_HUM;
req.startHandle = simpleBLESvcStartHdl;
req.endHandle = simpleBLESvcEndHdl;
req.type.len = ATT_BT_UUID_SIZE;
req.type.uuid[0] = LO_UINT16(TEMP_HUM_HUMIDITY_UUID);
req.type.uuid[1] = HI_UINT16(TEMP_HUM_HUMIDITY_UUID);
GATT_ReadUsingCharUUID( Temp_HumConnHandle, &req, simpleBLETaskId );
}
}
else if ( simpleBLEDiscState == BLE_DISC_STATE_CHAR_HUM )
{
// Characteristic found, store handle
if ( pMsg->method == ATT_READ_BY_TYPE_RSP &&
pMsg->msg.readByTypeRsp.numPairs > 0 )
{
HumCharHdl = BUILD_UINT16( pMsg->msg.readByTypeRsp.dataList[0],
pMsg->msg.readByTypeRsp.dataList[1] );
NPI_WriteTransport( "Hum handle Found\n", 19 );
simpleBLEProcedureInProgress = FALSE;
}
simpleBLEDiscState = BLE_DISC_STATE_IDLE;
}