Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

AIROC™ Bluetooth Forum Discussions

237_KGKT
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

@AnjanaM_61 

Hello,

I'd like to perform master slave switch after establishing the first connection.

I cannot find the API for this function for now. can I have the information about how to perform this? Is the an avaliable API for CYW20719?

 

0 Likes
1 Solution
AnjanaM_61
Moderator
Moderator
Moderator
First comment on KBA 5 questions asked First question asked

Hello @237_KGKT 

Can you please try if the below API help ?

wiced_bt_l2cap_set_desire_role(HCI_ROLE_SLAVE);  

I am referring MTB 2.4 ; API details can be found in :  /mtb_shared/wiced_btsdk/dev-kit/baselib/20719B2/release-v3.2.0/COMPONENT_20719B2/include/wiced_bt_l2c.h 

 

Regards,

Anjana

View solution in original post

0 Likes
6 Replies
AnjanaM_61
Moderator
Moderator
Moderator
First comment on KBA 5 questions asked First question asked

Hello @237_KGKT 

Can you please provide us more details? Are you using BLE or BR/EDR profiles ? 

Regards,
Anjana

0 Likes

Hello,

I am using BR/EDR profiles for implementing  an spp and iap2 applications(seperatly).

I am now struggling with connecting from the device to a peer (phone) or trying to "reconnect" to the peer after manually disconnecting the bt from the peer.

0 Likes

If I want the device to act like a master, what should I do? should I initialize the stack(e.g RFCOMM_serial_Port programm) differently?

I am now using the ModusToolbox 2.3 and I am programming cybt 413055-02. There is the cyw20719B on it!

And it is about BR/EDR

0 Likes
AnjanaM_61
Moderator
Moderator
Moderator
First comment on KBA 5 questions asked First question asked

For switching the roles, can you try the API BTM_SwitchRole . Please add the API as extern in your application code as below:

#define ROLE_MASTER 0

#define ROLE_SLAVE 1

typedef uint8_t tBTM_STATUS;

extern tBTM_STATUS BTM_GetRole (BD_ADDR remote_bd_addr, uint8_t *p_role, tBT_TRANSPORT transport);

extern tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr, UINT8 new_role, wiced_bt_dev_cmpl_cback_t *p_cb);

Example:

1. btm_status = BTM_GetRole (p_data->open.bdaddr, &role, BT_TRANSPORT_BR_EDR);

  WICED_BT_TRACE( "GetRole status:%d role:%d\n", btm_status, role ); // 0:Master, 1:Slave

2. btm_status = BTM_SwitchRole( p_data->open.bdaddr, ROLE_MASTER, BTMRoleSwitchHandler);

void BTMRoleSwitchHandler(void *role_switch_data)

{

  tBTM_BL_ROLE_CHG_DATA *p_event_data = (tBTM_BL_ROLE_CHG_DATA *)role_switch_data;

  uint8_t status = p_event_data->hci_status;

  UINT8 new_role = p_event_data->new_role;

  WICED_BT_TRACE( %B status %d new_role %d \n", p_event_data->rem_bda, status, new_role );

}

Can you try if this works?

Regards,
Anjana

0 Likes
237_KGKT
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

the ModusToolbox don't know about this APIs. maybe i should include a Header file  where these APIs are defined.

0 Likes
AnjanaM_61
Moderator
Moderator
Moderator
First comment on KBA 5 questions asked First question asked

Hello @237_KGKT 

Can you please try if the below API help ?

wiced_bt_l2cap_set_desire_role(HCI_ROLE_SLAVE);  

I am referring MTB 2.4 ; API details can be found in :  /mtb_shared/wiced_btsdk/dev-kit/baselib/20719B2/release-v3.2.0/COMPONENT_20719B2/include/wiced_bt_l2c.h 

 

Regards,

Anjana

0 Likes