Sending command fomr gatt client to server (central to peripheric)
Posted: Tue Feb 14, 2017 11:31 pm
Hi,
I am still using the gatt client sample and can scan the advertised peripherics in the area with this sample.
I need to drive (put on/off) a beewi smart led.
As far as i understood I have to call the write function with good parameters like conn_id, gatt_if, value length, value to write, etc...
But there are many function in the API
esp_ble_gattc_write_char
esp_ble_gattc_write_char_descr
esp_ble_gattc_prepare_write
esp_ble_gattc_execute_write
I have 2 important questions for my project please and I need to undestand:
1/ Should I prepare write before writing ? And what is the difference between write characteristic (esp_ble_gattc_write_char) and write descriptor (esp_ble_gattc_write_char_descr) ?
2/ How to send the command, the API provided by a BLE to control mentionned the command as an opcode for example [0x03 0x01]... I did not yet catch hox to use them, can someone explain this to me or send me a sample of code about gatt client send command to a BLE peripheric ?
Thanks
Iro
I am still using the gatt client sample and can scan the advertised peripherics in the area with this sample.
I need to drive (put on/off) a beewi smart led.
As far as i understood I have to call the write function with good parameters like conn_id, gatt_if, value length, value to write, etc...
But there are many function in the API
esp_ble_gattc_write_char
esp_ble_gattc_write_char_descr
esp_ble_gattc_prepare_write
esp_ble_gattc_execute_write
I have 2 important questions for my project please and I need to undestand:
1/ Should I prepare write before writing ? And what is the difference between write characteristic (esp_ble_gattc_write_char) and write descriptor (esp_ble_gattc_write_char_descr) ?
2/ How to send the command, the API provided by a BLE to control mentionned the command as an opcode for example [0x03 0x01]... I did not yet catch hox to use them, can someone explain this to me or send me a sample of code about gatt client send command to a BLE peripheric ?
Thanks
Iro