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: Bond manager in Multirole example

Part Number: CC2640R2F


Hello,

For the multi-role example which is available as part of SDK3.0, my customer would only like to enable pairing / bonding in the peripheral role - What is the best way to accomplish this ? Would it suffice to just comment out the section in GAPBondMgr_LinkEst function highlighted below ?

Does anyone have an example for this already ?

Thanks,

Padmaja

bStatus_t GAPBondMgr_LinkEst( uint8 addrType, uint8 *pDevAddr, uint16 connHandle, uint8 role )
{

........................

// Update LRU Bond list
gapBondMgrUpdateLruBondList(idx);

}
#if ( HOST_CONFIG & CENTRAL_CFG )
else if ( role == GAP_PROFILE_CENTRAL &&
gapBond_PairingMode == GAPBOND_PAIRING_MODE_INITIATE )
{
// If Central and initiating and not bonded, then initiate pairing
VOID gapBondMgrAuthenticate( connHandle, addrType, NULL );

// Call app state callback
if ( pGapBondCB && pGapBondCB->pairStateCB )
{
pGapBondCB->pairStateCB( connHandle, GAPBOND_PAIRING_STATE_STARTED, SUCCESS );
}
}
#endif // HOST_CONFIG & CENTRAL_CFG

#if ( HOST_CONFIG & PERIPHERAL_CFG )
// If Peripheral and initiating, send a slave security request to
// initiate either pairing or encryption
if ( role == GAP_PROFILE_PERIPHERAL &&
gapBond_PairingMode == GAPBOND_PAIRING_MODE_INITIATE )
{
gapBondMgrSlaveSecurityReq( connHandle );
}
#endif //HOST_CONFIG & PERIPHERAL_CFG

return ( SUCCESS );
}

  • Hi Padmaja,

    If I understand correctly, you don't want the master to initiate pairing/bonding, but you still want you to accept request from the slave.

    You should do this by changing the GAPBOND_PAIRING_MODE to  GAPBOND_PAIRING_MODE_WAIT_FOR_REQ.

    #define DEFAULT_PAIRING_MODE                  GAPBOND_PAIRING_MODE_WAIT_FOR_REQ
    
    ...
    
    // Setup the GAP Bond Manager
    uint8_t pairMode = DEFAULT_PAIRING_MODE;
    GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);

  • Thanks Marie. That might work though that will cause the peripheral to loose the option to send a request to initiate pairing or encryption - not sure if that is necessary for their use case. We will try it and confirm back with you.

    Thanks,
    Padmaja

    #if ( HOST_CONFIG & PERIPHERAL_CFG )
    // If Peripheral and initiating, send a slave security request to
    // initiate either pairing or encryption
    if ( role == GAP_PROFILE_PERIPHERAL &&
    gapBond_PairingMode == GAPBOND_PAIRING_MODE_INITIATE )
    {
    gapBondMgrSlaveSecurityReq( connHandle );
    }
    #endif //HOST_CONFIG & PERIPHERAL_CFG

    return ( SUCCESS );