- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi cypress team,
I am work on spp sample code with CYBT-343026. And I want to keep my 343026 in slave, but sometimes there's a role switch that my 343026 become master. I have tride wiced_bt_dev_switch_role to switch it back to slave but it doesn't work. What can I do to keep it in slave mode.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The API can work for BT configuration. Please set it as follows:
uint8_t role;
case BTM_ENABLED_EVT:
role = wiced_bt_l2cap_set_desire_role(L2CAP_ROLE_DISALLOW_SWITCH);
WICED_BT_TRACE("==== disable switch role=%d\n", role );
role = wiced_bt_l2cap_set_desire_role(0x01);//slave = 0x01
WICED_BT_TRACE("==== set desire role=%d\n", role );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @wenchilo
Can you please let us know the peer device you are using?
What is the result of wiced_bt_dev_switch_role API ? Where exactly you are using this API in your application code?
Regards,
Anjana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. The peer device is also CYBT-343026
2. I am not sure about the result of wiced_bt_dev_switch_role cause WICED_BT_CMD_STARTED and
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please try to use the following API:
/**
*
* Function wiced_bt_l2cap_set_desire_role
*
* This function sets the desire role for L2CAP.
* If the new role is L2CAP_ROLE_ALLOW_SWITCH, allow switch on
* HciCreateConnection.
* If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow switch on
* HciCreateConnection.
*
* If the new role is a valid role (HCI_ROLE_CENTRAL or HCI_ROLE_PERIPHERAL),
* the desire role is set to the new value. Otherwise, it is not changed.
*
* @param[in] new_role: New role value
*
* @return the new (current) role
*
*/
uint8_t wiced_bt_l2cap_set_desire_role (uint8_t new_role);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, can this API be called after making a connection, or do I have to choose the role before connection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have tried calling wiced_bt_l2cap_set_desire_role before and after making a connection. But it still doesn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure if wiced_bt_l2cap_set_desire_role works on bt cause the introduction says valid role including HCI_ROLE_CENTRAL or HCI_ROLE_PERIPHERAL but not master and slave.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The API can work for BT configuration. Please set it as follows:
uint8_t role;
case BTM_ENABLED_EVT:
role = wiced_bt_l2cap_set_desire_role(L2CAP_ROLE_DISALLOW_SWITCH);
WICED_BT_TRACE("==== disable switch role=%d\n", role );
role = wiced_bt_l2cap_set_desire_role(0x01);//slave = 0x01
WICED_BT_TRACE("==== set desire role=%d\n", role );