Sending data for long ( > 20 bytes) characteristics

6 posts / 0 new
Last post
slava
Offline
Last seen:3 years 3 months ago
Joined:2015-04-28 10:35
Sending data for long ( > 20 bytes) characteristics

Hello.
I trying to rewrite sample128 service for my purposes.
I changed length of first characteristic to 32 bytes.
For write data to this characteristic I use windows 8.1 APIs function BluetoothGATTSetCharacteristicValue.

When I send 20 bytes of data all seems fine, but when I try to send 32 bytes function BluetoothGATTSetCharacteristicValue returns OK for the first time, but all next times it returns ERROR_BAD_NET_RESP. After that I can`t send anything until I delete this device and pair again.

Also in second case in function gattc_write_cmd_ind_handler (sample128_task.c) I receive one message, I send from Win (32 bytes), splitted in two parts where first is data with length=18&offset=0 and second length=14&offset=18.

In which side (da14580 or Win) there is an error?

If I change first char attribute to ATT_CHAR_PROP_WR_NO_RESP I also can`t send more than 20 bytes (BluetoothGATTSetCharacteristicValue return ERROR_INVALID_FUNCTION).

What I do wrong?

Device:
MT_dialog
Offline
Last seen:1 week 5 days ago
Staff
Joined:2015-06-08 11:34
Hi slava,

Hi slava,

Please check this posthttp://support.dialog-semiconductor.com/how-send-data-more-20-bytes.

Have you tried to transferdata by using an android device to see if the result is the same?

Thanks MT_dialog

slava
Offline
Last seen:3 years 3 months ago
Joined:2015-04-28 10:35
Yes, I saw this thread. I

Yes, I saw this thread. I have no android device with BT4.0 at this moment.
消息(> 20字节)应该收到assembled or splitted on parts in function gattc_write_cmd_ind_handler?
If splitted on parts, is received data collected in param->value ?

MT_dialog
Offline
Last seen:1 week 5 days ago
Staff
Joined:2015-06-08 11:34
Hi slava,

Hi slava,

You dont have to assemble or split parts if the message is more than 20 bytes in the gattc_write_cmd_ind_handler.

This is done by lower layers of the stack.

Thanks MT_dialog

slava
Offline
Last seen:3 years 3 months ago
Joined:2015-04-28 10:35
Hi and thank you for response

Hi and thank you for response.
So for what purposes there is fields param->offset and param->last in gattc_write_cmd_ind?

If I understand you correctly in gattc_write_cmd_ind_handler I should receive whole message ( if I send 32 bytes, I should receive all 32 bytes in one call gattc_write_cmd_ind_handler with offset = 0 and length=32)?

MT_dialog
Offline
Last seen:1 week 5 days ago
Staff
Joined:2015-06-08 11:34
Hi slava,

Hi slava,

Sorry i misunderstood your question (confused it with the one i told you to check)...The param->last is for indicating that this is the last chunk of data that has been sent in order to issue only one indication when the characteristic is written. The data are coming in chunks and the gattc_write_cmd_ind_handler is called for every completed chunk, the param->value has all the data you need and its is assembled by the function attmdb_att_set_value() or attmdb_att_update_value() according to the offset, at the end of the transaction you will have all the data you need.

Thanks MT_dialog

Topic locked