This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BLE RSSI reading event

Dear All, I am using a cc2540dk central to go through the codes,

I found that in gapCentralRole_ProcessOSALMsg(),  a timer is used to periodly generate GAPCENTRALROLE_RSSI_MSG_EVT event to perform "HCI_ReadRssiCmd( pRssi->connHandle )", however I can not find when the events: HCI_GAP_EVENT_EVENT and HCI_READ_RSSI are generated.

I guess that each time when HCI_ReadRssiCmd command has completed, a HCI_GAPEVENT_EVENT event shall be generated, am I right?

Many thanks

arm

static void gapCentralRole_ProcessOSALMsg( osal_event_hdr_t *pMsg )
{
  switch ( pMsg->event )
  {
    case HCI_GAP_EVENT_EVENT:
      if ( pMsg->status == HCI_COMMAND_COMPLETE_EVENT_CODE )
      {
        hciEvt_CmdComplete_t *pPkt = (hciEvt_CmdComplete_t *) pMsg;

        if ( pPkt->cmdOpcode == HCI_READ_RSSI ) //It may be invoked by HCI_ReadRssiCmd
        {
          uint16 connHandle = BUILD_UINT16( pPkt->pReturnParam[1], pPkt->pReturnParam[2] );
          int8 rssi = (int8) pPkt->pReturnParam[3];

          // Report RSSI to app
          if ( pGapCentralRoleCB && pGapCentralRoleCB->rssiCB )
          {
            pGapCentralRoleCB->rssiCB( connHandle, rssi );
          }
        }
      }
      break;

    case GAP_MSG_EVENT:
      gapCentralRole_ProcessGAPMsg( (gapEventHdr_t *) pMsg );
      break;

    case GAPCENTRALROLE_RSSI_MSG_EVT:
      {
        gapCentralRoleRssi_t *pRssi = ((gapCentralRoleRssiEvent_t *) pMsg)->pRssi;

        // If link is up and RSSI reads active
        if (pRssi->connHandle != GAP_CONNHANDLE_ALL &&
            linkDB_Up(pRssi->connHandle))
        {
          // Restart timer
          osal_CbTimerStart( gapCentralRole_timerCB, (uint8 *) pRssi,
                             pRssi->period, &pRssi->timerId );

          // Read RSSI
          VOID HCI_ReadRssiCmd( pRssi->connHandle ); //HCI_READ_RSSI ? I hope so.
        }
      }
      break;

    default:
      break;
  }
}