3 Replies Latest reply on Jan 23, 2020 12:30 AM by AnjanaM_61

    Code Example - Update connection parameter base on Wiced Studio

    PICH_4397076

      Dear All,,,

       

      I am going to develop our application with Cypress's Dual Mode BT Chipset CYW20706.

      Our application runs as a peripheral (Server / Slave),

      and after connection we need to update the connection parameters.

      I looked for a related example after wiced studio installation, but couldn't find it.
      Please let me know if there are any code examples I can refer to.

       

      Thanks,

        • 1. Re: Code Example - Update connection parameter base on Wiced Studio
          AnjanaM_61

          Hi,

           

          For updating Connection parameters, you just need to use the below API in your application after connection_up : wiced_bt_l2cap_update_ble_conn_params  ( Check wiced_bt_l2c.h file )

           

          Example:

              uint16_t min_int = 400; /* Minimum connection interval - 400 x 1.25 = 500 ms */

              uint16_t max_int = 400; /* Maximum connection interval - 400 x 1.25 = 500 ms */

              uint16_t latency = 0;   /* Slave latency */

              uint16_t timeout = 500; /* Supervision timeout - 500 x 10 = 5000 ms */

          result = wiced_bt_l2cap_update_ble_conn_params (hello_sensor_state.remote_addr,  min_int,  max_int,  latency,  timeout);

           

           

           

          Thanks,

          Anjana

          • 2. Re: Code Example - Update connection parameter base on Wiced Studio
            PICH_4397076

            Dear All,,,

             

            Thanks for your inform.

            I have one more question.

             

            When the slave sends the update connection parameter request to the master,

            it tries to display on the console screen whether the master has accepted or rejected the request.
            I want to put this part of my code in the slave-side additionally, what should I do?
            Also, after requesting the connection parameter update,

            I want to display the connection interval value determined

            after the master accepts or rejects it on the console screen.

             

            Thanks,

            • 3. Re: Code Example - Update connection parameter base on Wiced Studio
              AnjanaM_61

              Hi,

               

              You will get that info in BT stack event BTM_BLE_CONNECTION_PARAM_UPDATE

               

              Example Usage:

              wiced_result_t hello_sensor_management_cback( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data )

              {

                

                  switch( event )

                  {

              /* Bluetooth  stack enabled */

                  case BTM_ENABLED_EVT:

                           break;

              :

              :

               

              case BTM_BLE_CONNECTION_PARAM_UPDATE:

                      p_ble_conn_param_update = &p_event_data->ble_connection_param_update;

                      WICED_BT_TRACE ("BTM BLE Connection Update event status:%d interval:%d latency:%d lsto:%d\n",

                                          p_ble_conn_param_update->status,

                                          p_ble_conn_param_update->conn_interval,

                                          p_ble_conn_param_update->conn_latency,

                                          p_ble_conn_param_update->supervision_timeout);

                      break;

              :

              :

              }

              }

               

              Thanks,

              Anjana