Closed alexgrauer closed 7 years ago
This depends on if you're using auto response or not. There is an api to set attribute values which is what you should use it is esp_ble_gatts_set_attr_value
.
Setting it in the read event does probably not what you want. Since I expect the value is already defined at this point. Another thing is that esp_ble_gatts_set_attr_value
is an async operation.
Hi @alexgrauer , did the above suggestion help you resolve the issue?
Hi @FayeY, I wasnt able to solve it yet. Im not sure if im calling the esp_ble_gatts_set_attr_value correctly. Im not sure i understand the parameters that go with it.
@mh-dev, if i set it in the read event, should i read the new value the next time i read it?
@alexgrauer , you shoud do like this :
case ESP_GATTS_READ_EVT: heart_ctrl_point[0] += 0x01; esp_ble_gatts_set_attr_value(param->read.handle, sizeof(heart_ctrl_point), heart_ctrl_point); ESP_LOGI(GATTS_TABLE_TAG, "READ EVENT: %d\n",heart_ctrl_point[0]); break;
The attachment is the test demo gatts_table_creat_demo.c.zip
Thanks very much @Weijian-Espressif, that worked!! Now, if i want to change heart_ctrl_point´s value from another function, not from the READ_EVT, what should i put instead of param->read.handle.
And also, is it possible to make heart_ctrl_point uint32 instead of uint8?
Thanks again
@alexgrauer maybe you can refer to gatts_demo.c , you can use ble app test, you can write some data to the demo, and after your app enable demo's notify, the demo would send you some data. gatts_demo.c.zip
Hi @alexgrauer , did the above suggestion help you resolve the issue?
Hi all,
I open this thread because im having problems to make BLE work. Im using the gatt_server_service_table example, but im not being able to change the read value of Heart Rate Control Point.
Im doing the following:
In the gatts_profile_event_handler i added: case ESP_GATTS_READ_EVT: heart_ctrl_point[1] += 0x01; ESP_LOGI(GATTS_TABLE_TAG, "READ EVENT: %d\n",heart_ctrl_point[1]); break;
When i read the value using the nRF Connect App i can see the READ EVENT text in the monitor, and the heart_ctrl_point is actually being incremented. But in the App i still see 0x00 every time i read it.
Any clue?
Thanks in advance, Alex