/* Switch GAP Role. 
This API is used to switch the BLE GAP role. The role switch can only happen if the local device: */
ADI_BLER_RESULT adi_radio_SwitchRole(ADI_BLE_ROLE *const peDesiredBleRole)
/* Switch GAP Role. 
This API is used to switch the BLE GAP role. The role switch can only happen if the local device: */
ADI_BLER_RESULT adi_radio_SwitchRole(ADI_BLE_ROLE *const peDesiredBleRole)
{
    ADI_BLER_RESULT bleResult;
    ASSERT(peDesiredBleRole != NULL);
    ADI_BLE_LOGEVENT(LOGID_CMD_BLEGAP_SWITCH_ROLE);
    ADI_BLE_RADIO_CMD_START(CMD_BLEGAP_SWITCH_ROLE);
    pBLERadio->eBleDevRole = *peDesiredBleRole;
    memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN], peDesiredBleRole, 1u);
    bleResult = bler_process_cmd(CMD_BLEGAP_SWITCH_ROLE, 1u, NULL, 0u);
    if(bleResult == ADI_BLER_SUCCESS){
    	bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_RESP_SUCCESS,ADI_BLER_CMD_TIMEOUT);
    }
    ADI_BLE_RADIO_CMD_END();
    return (bleResult);
}