9 Replies Latest reply on May 19, 2015 7:29 PM by sam.wang

    Unable to write descriptor of DATA characteristic in speed_test example

      Hi,

       

      I'm writing an Android app to test and study the speed_test example in WICED SMART SDK, but encounter this problem:

      Writing descriptor of SPEED_TEST_CHARACTERISTIC_DATA receives a success status on Android, but speed_test_write_handler is not called in the firmware. The "data descriptor" value changed trace is also not called.

       

      Same writing method works for SPEED_TEST_CHARACTERISTIC_CONTROL_POINT. (speed_test_write_handler is called and shows "control descriptor" value changed)

      And, the peerapp (Windows app) in the SDK project is able to write descriptor for both data and control characteristics.

       

      Is it because descriptor writing method for data characteristic is different from control? Appreciate for helping!

       

      Best regards,

      Sam

       

      [Edit]

      Did some more tests and it seems which descriptor can be written is related to the handle. Following is my test:

      1. No change in code:

      Result:

      Write Control descriptor shows success on phone. Write_handler callback is called by Control descriptor handle.

      Write Data descriptor shows success on phone. Write_handler callback is not called.

       

      2. Swap Data characteristic handles with Control characteristics handles:

       

      #define HANDLE_SPEED_TEST_CHARACTERISTIC_DATA                       0x2d

      #define HANDLE_SPEED_TEST_CHARACTERISTIC_DATA_VALUE                 0x2e

      #define HANDLE_SPEED_TEST_DATA_CLIENT_CONFIGURATION_DESCRIPTOR      0x2f

      #define HANDLE_SPEED_TEST_CHARACTERISTIC_CONTROL                    0x2a

      #define HANDLE_SPEED_TEST_CHARACTERISTIC_CONTROL_VALUE              0x2b

      #define HANDLE_SPEED_TEST_CONTROL_CLIENT_CONFIGURATION_DESCRIPTOR   0x2c

       

      Result:

      Write Control descriptor shows success on phone, but write_handler callback is not called.

      Write Data descriptor shows success on phone. Write_handler callback is called by Data descriptor handle.

       

      3. Swap Data characteristic handles with Control characteristics handles, and swap position for Data and Control in speed_test_gatt_database[] (both positions of characteristic and descriptor are changed)

       

      Result:

      Write Control descriptor shows success on phone, but write_handler callback is not called.

      Write Data descriptor shows success on phone. Write_handler callback is called by Data descriptor handle.


      I have also tried several other handle numbers, but seems only 0x2f works.


      [Edit 2]

      I used wiced smart designer created a new project and created a characteristic with Device Role as Sensor sends value to host, and allow permission Notification in Client Configuration. Then, it works.

      Guessing unable to write descriptor might because in speed_test, the characteristic is "writable". And, in .wic file, if set Device Role as Host writes to or read from sensor, Client Configuration tab will disappear.