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.

CC2640R2F: Bonding complete callback triggering on second time connection

Part Number: CC2640R2F


Hi All,

I am usnig Ble stack version v3.0.1 (C:\ti\simplelink_cc2640r2_sdk_1_00_00_22) along with cc2640R2F chipset.

Example Project used : C:\ti\simplelink_cc2640r2_sdk_1_00_00_22\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral


uint32_t passkey = 0; // passkey "000000"
uint8_t pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
uint8_t mitm = TRUE;
uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
uint8_t bonding = TRUE;

GAPBondMgr_SetParameter(GAPBOND_DEFAULT_PASSCODE, sizeof(uint32_t),
&passkey);
GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);

Registered the call back for pairing and Bonding state callback

// GAP Bond Manager Callbacks
static gapBondCBs_t simpleBLEPeripheral_BondMgrCBs =
{
  NULL, // Passcode callback (not used by application)
  pairStateCB  // Pairing / Bonding state Callback (not used by application)
};

 

static void pairStateCB(uint16_t connHandle, uint8_t state, uint8_t status)
{
   

    if (GAPBOND_PAIRING_STATE_BONDED == state)
    {
      enqueue the event();
       
    }

}

So i am expecting the callback pairStateCB with the state GAPBOND_PAIRING_STATE_BONDED after the pairing and bonding completed up on the first connection.


But for the first connection the state is coming as "GAPBOND_PAIRING_STATE_STARTED" and then if we disconnect and connect again then only getting the state "GAPBOND_PAIRING_STATE_BONDED". in the call back pairStateCB.

but i need that call back with the state "GAPBOND_PAIRING_STATE_BONDED"  in the first connection after bonding success

please provide your suggestions.