Hi Dialog,
I found a command GATTC_READ_CMD_IND in gattc_task.h however it is not specified in RW-BLE-GATT-IS. I tried to add a handle of this command in custs1_task.c to capture a read event from master side but my handler function is never called. Also, I did not find any place in SDK 5.0.3 using this message.
Is there anything special for this message? Do we support it on DA14580?
如果没有,我们有一个方法来捕捉甚至读t from master side on DA14580?
Thanks a lot.
Keywords:
Device:
Hi zwang308,
Currently there is no implementation from the stack in order to get a read command indication to your application, the stack on the 580 doens't support it. As a work around you can use a notifiable property and have the central write to a control point characteristic in order to trigger the notification, so you will be notified by the peripheral instead of reading it. Besides that the 5.0.4 SDK will soon be released and will give the option to intercept the reading commands the indicating them to the application.
Thanks MT_dialog
We had SDK 5.0.4. Wher ewe can find example with GATTC_READ_CMD_IND?
Hi Sparta,
As mentioned in the above post there is no implementation for the GATTC_READ_CMD_IND, there is a functionallity that will allow you to be aware when the central wants to read a characteristic from the central, there is no example on this, but i can guide you here in order to implement this, assuming that the database that you would like to enable this is the custom profile.
1) You will have to register the task that you would like to get indications using the dg_register_task_for_read_request().
2) Add the ATTS_READ_REQ_IND message in the custs1_connected[] array like this {ATTS_READ_REQ_IND, (ke_msg_func_t)atts_read_req_ind_handler}, the atts_read_req_ind_handler() function will be the handler that will be executed as soon as the central reads the characteristic of the specified task.
3) The implementation of the atts_read_req_ind_handler() function can be the following:
static int atts_read_req_ind_handler(ke_msg_id_t const msgid,
struct atts_read_req_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
uint16_t handle = param->handle;
// Confirm read request
dg_atts_read_cfm(0, handle, ATT_ERR_NO_ERROR); // 0 is the connection index ֠conidx , (first connection) , the handle is inherited form param and the 0x80 our reply
return (KE_MSG_CONSUMED);
}
The param->>handle will return the handle of the characteristic written and as soon as you get the indication you will have to respond with the dg_atts_read_cfm() function in order to send the data to the central.
Please check the UM-B-051 Software Platform Reference.pdf in Appendix G for more information.
Thanks MT_dialog
also I had problem to write more than 8 byte in characteristic that should be up to 20 bytes. What can be the reaon?
Hi Sparta,
I suppose that you 've tried to write to a characteristic which is 1 byte long, you will have to increase the length of the characteristic that you are writing to, for example if you are writing to the control point characteristic which is indeed 1 byte long you will have to increase the value of the DEF_CUST1_CTRL_POINT_CHAR_LEN in order to be able to write more than 1 byte.
Thanks MT_dialog