2 Replies Latest reply on Jan 5, 2016 4:35 PM by lyhsiao

    wiced_bt_smartbridge_gatt_read_characteristic_values_using_uuid() and wiced_bt_smartbridge_gatt_read_characteristic_value()

    lyhsiao

      I have some questions about there two smartbridge functions:

      wiced_bt_smartbridge_gatt_read_characteristic_values_using_uuid() and wiced_bt_smartbridge_gatt_read_characteristic_value()

       

      In official document, state the two functions as follow:

      1. wiced_result_t wiced_bt_smartbridge_gatt_read_characteristic_value(X, X, X, X)

      /** Read Characteristic Value

      *

      * @param[in]  socket               : socket that is connected to the server to read

      *                                    Characteristic Value from

      * @param[in]  handle               : Attribute handle of the Characteristic Value to read

      * @param[in]  uuid                 : unique identifier of the Characteristic Value to read

      * @param[out] characteristic_value : pointer that will receive the Characteristic Value

      *

      * @return @ref wiced_result_t

       

      2. wiced_result_t wiced_bt_smartbridge_gatt_read_characteristic_value(X, X, X)

      /** Read Characteristic Value

      *

      * @param[in]  socket                    : socket that is connected to the server to read

      *                                         Characteristic Value from

      * @param[in]  uuid                      : unique identifier of the Characteristic Values to read

      * @param[out] characteristic_value_list : pointer that will receive the Characteristic Value list

      *

      * @return @ref wiced_result_t

       

      Example:

      I create a service A (0x150A) with one characteristic A1 (0x160A) in a ble device, and use smartbridge api of wiced-wifi with ble module to connect it.

       

      I got the correct value of A1 by calling wiced_bt_smartbridge_gatt_read_characteristic_value(X, X, 160A, X). p.s. I first find the value handle of A1.

      But I got the incorrect value by calling wiced_bt_smartbridge_gatt_read_characteristic_value(X, 160A, X), this function doesn't need the parameter of the value handle.

      I can not differentiate these two functions because the documents of them confuse me.

       

      Originally, I set the A1 as a notify characteristic, and use the wiced_bt_smartbridge_get_attribute_cache_by_uuid() and wiced_bt_smartbridge_get_attribute_cache_by_handle() to read the value, refer the sample code "bt_smartbridge" in SDK. Now, I want to try some other faster and intuitive methods.

        • 1. Re: wiced_bt_smartbridge_gatt_read_characteristic_values_using_uuid() and wiced_bt_smartbridge_gatt_read_characteristic_value()
          jayi

          Hi,

           

          wiced_bt_smartbridge_gatt_read_characteristic_values_using_uuid() should be working as well although you are right, in the documentation the two descriptions are switched.

           

          * @param[in]  handle               : Attribute handle of the Characteristic Value to read

           

          should be in the description of wiced_bt_smartbridge_gatt_read_characteristic_value().

           

          Could you please send me your code at jaeyoung.yi@broadcom.com so I can look over it?

           

          Thanks,

          Jaeyoung

          • 2. Re: wiced_bt_smartbridge_gatt_read_characteristic_values_using_uuid() and wiced_bt_smartbridge_gatt_read_characteristic_value()
            lyhsiao

            Hi,

             

            I used code as follow.

             

                                /* Use Raw Gatt Operation, wiced_bt_smartbridge_gatt_read_characteristic_values_using_uuid() bug ?? */

                                wiced_bt_smart_attribute_list_t attribute_list_t;

                                wiced_bt_smart_attribute_t* attribute1;

                                wiced_bt_uuid_t tmp_uuid;

                                tmp_uuid.size = UUID_16BIT;

             

                                tmp_uuid.value.value_16_bit = STATUS_UUID;

                                if(wiced_bt_smartbridge_gatt_read_characteristic_values_using_uuid(&smartbridge_socket[i], &tmp_uuid, &attribute_list_t) == WICED_SUCCESS)

                                {

                                    wiced_bt_smart_attribute_print_list(&attribute_list_t);

                                    if(attribute_list_t.count > 0)

                                    {

                                        if(wiced_bt_smartbridge_gatt_read_characteristic_value(&smartbridge_socket[i], attribute_list_t.list->handle, &tmp_uuid, &attribute1) == WICED_SUCCESS)

                                        {

                                            wiced_bt_smart_attribute_print(attribute1);

                                            tatus = attribute_list_t.list->value.value[0];

                                            timer = attribute_list_t.list->value.value[1];

                                        }

                                    }

                                }

             

             

            In these code as above,

             

            I used wiced_bt_smartbridge_gatt_read_characteristic_values_using_uuid() and then use wiced_bt_smart_attribute_print_list() to print attribute_list_t (only one node in the list), I got the wrong value.

            So I have to use the value handle (is correct) to call wiced_bt_smartbridge_gatt_read_characteristic_value() and then call wiced_bt_smart_attribute_print() the print the attribute1value it right.

            If I have some logic errors or other mistake, please give me advices, thanks a lot

             

            PS. Because of old evaluation board version, I use the SDK 3.1.2

             

            BR