3 Replies Latest reply on Feb 19, 2019 10:31 PM by SheetalJ_96

    Rerun back to Connect

    user_3572401

      I am using CYBT-343026-EVAL with WICED 6.2 now.

      I want to return back to Connect  when Bluetooth headset  power On from power off.

      Now sometimes it  returns back to Connect,but it often does not Rerun back to Connect.

      I do a survey about the code.

      I have found in hci_control_ag_rfcomm.c

      void hci_control_ag_rfcomm_control_callback( uint32_t port_status, uint16_t port_handle )

      [if ( ( port_handle == p_scb->rfc_serv_handle ) || ( port_handle == p_scb->rfc_conn_handle ) )]

      If it is true ,it can return back to Connect.

      Also,I have found the port_handle is created in blow

      [

      rfcomm_result = wiced_bt_rfcomm_create_connection( UUID_SERVCLASS_HF_HANDSFREE,

                                                            p_scb->hf_scn, WICED_FALSE,

                                                            HFP_DEVICE_MTU,

                                                            p_scb->hf_addr,

                                                            &p_scb->rfc_conn_handle,

                                                            ( wiced_bt_port_mgmt_cback_t * )hci_control_ag_rfcomm_control_callback );

      ]

      But I don not know how does wiced_bt_rfcomm_create_connection() works,

      I read API-REF-20706-A2_Bluetooth.pdf,It is only have some description,I want to know more about   wiced_bt_rfcomm_create_connection.

      Can you teach me.

        • 1. Re: Rerun back to Connect
          SheetalJ_96

          Hi user_3572401,

           

          /20706-A2_Bluetooth/include/wiced_bt_rfcomm.h gives some explaination about API, it is almost same as given in API REF doc. Used parameters and functionality of the API is explained in the same.

          Can you tell what doubt you have regarding the API with which I can help?

          • 2. Re: Rerun back to Connect
            user_3572401

            @@Thank you for your reply.

            I want to return back to Connect  when Bluetooth headset  power On from power off.

            I have found the port_handle is created in blow

            [

            rfcomm_result = wiced_bt_rfcomm_create_connection( UUID_SERVCLASS_HF_HANDSFREE,

                                                                  p_scb->hf_scn, WICED_FALSE,

                                                                  HFP_DEVICE_MTU,

                                                                  p_scb->hf_addr,

                                                                  &p_scb->rfc_conn_handle,

                                                                  ( wiced_bt_port_mgmt_cback_t * )hci_control_ag_rfcomm_control_callback );

            ]

            1.I want to know what is the relationship between [port_handle] and  [rfc_conn_handle] and [rfc_serv_handle].

            2.Could you show me the source code of wiced_bt_rfcomm_create_connection().

            3.I found blow after do a survey:

            When a headset connected to BT module, [port_handle] and [rfc_conn_handle] and [rfc_serv_handle] changed after the headset power On from power off,and when [port_handle]=[rfc_conn_handle] or [rfc_serv_handle],the headset can return back to connect.

            Could you tell me how the [rfc_conn_handle] and [rfc_serv_handle] be created.communityadministratorMichaelF_56userc_2009@SheetalJ_96

            • 3. Re: Rerun back to Connect
              SheetalJ_96

              Hi user_3572401,

               

              wiced_bt_rfcomm_create_connection() performs two functions: it either establishes a connection with the peer device or accepts a connection from the peer device. the return value is the port handle created by this API.

               

              If you see the implementation in hci_control_ag_rfcomm.c, hci_control_ag_rfcomm_start_server() is called first to setup the server. rfc_serv_handle is the port handle returned after server starts. If connection is initiated by the peer device, then hci_control_ag_rfcomm_do_open() is called where peer device returns the port handle rfc_conn_handle.

              Hope this clears the confusion.!

               

              Unfortunately, I cannot provide you the source code for API wiced_bt_rfcomm_create_connection(). Although I can give you some details. The API tries to establish a port handle considering the parameters UUID, BD address and MTU size.