Write Long Characteristic Value

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

I need any example how work with Write Long Characteristic Value.

   

My device receive :

   

CYBLE_EVT_GATTS_WRITE_CMD_REQ

   

CYBLE_EVT_GATTS_PREP_WRITE_REQ

   

CYBLE_EVT_GATTS_EXEC_WRITE_REQ

   

What to do ? How response to this events ?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hello,

   

Please find the attached example project for Write long characteristics.

   

Thanks,

   

Anjana

View solution in original post

0 Likes
12 Replies
lock attach
Attachments are accessible only for community members.
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hello,

   

Please find the attached example project for Write long characteristics.

   

Thanks,

   

Anjana

0 Likes
urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

I see you answer only on case CYBLE_EVT_GATTS_EXEC_WRITE_REQ.

   

What about   CYBLE_EVT_GATTS_WRITE_CMD_REQ and CYBLE_EVT_GATTS_PREP_WRITE_REQ ?

   

No need to send any handshake to this requests ?

0 Likes
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

 Hi,

   

No need for sending any response in CYBLE_EVT_GATTS_PREP_WRITE_REQ.

   

You have to give the response in CYBLE_EVT_GATTS_EXEC_WRITE_REQ only.

   

CYBLE_EVT_GATTS_WRITE_CMD_REQ is used when you do a write without response.

   

 

   

Thanks,
Anjana

urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

I have 2 long characteristics in my profile. How can I receive information about current characteristic I receive ?

0 Likes
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

You can check which characteristic handle has been enabled and can verify the current characteristic received.

   

-Anjana

0 Likes
urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

1. I ask it because in your code it`s hardcoded :

   

write_characteristic.attrHandle=CYBLE_RW_SERVICE_WRITE_LONG_CHARACTERISTIC_CHAR_HANDLE;

   

How I can get it from eventParam ?

   

2.  As I understand it receive all data in one time ?

0 Likes
urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

In datasheet :

   

The CYBLE_EVT_GATTS_EXEC_WRITE_REQ event has the following parameter structure: typedef struct { CYBLE_CONN_HANDLE_T connHandle; CYBLE_GATT_HANDLE_VALUE_OFFSET_ PARAM_T * baseAddr; uint8 prepWriteReqCount; uint8 execWriteFlag; CYBLE_GATT_DB_ATTR_HANDLE_T attrHandle; uint8 gattErrorCode; } CYBLE_GATTS_EXEC_WRITE_REQ_T 

   

in generated BLE_1_StackGattServer.h exist explanation :

   

    /** Attribute Handle at which error occurred. This is an o/p param  */
    CYBLE_GATT_DB_ATTR_HANDLE_T                      attrHandle;     
    

   

I send different characteristic and see that it always same !

   

How receive characteristic handle ?

0 Likes
urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

this is right code :

   

 attrHandle = execwriteReqparam->baseAddr->handleValuePair.attrHandle;
            write_characteristic.attrHandle=attrHandle;

0 Likes
urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

When I sent long value I  receive CYBLE_GATT_ERR_CODE_T = 13 .

   

I can`t find what it mean. Anybody help please !

0 Likes
Anonymous
Not applicable

13 means "A write operation exceeds the maximum length of the attribute"

0 Likes
urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

What to do with this error ? Seems to me that smartphone use long write method but send not 20 bytes but all data..

0 Likes
Anonymous
Not applicable

Make sure you are comparing the eventParam handle with the handle you are looking for to make sure you are working on data for the correct Long_Write_Request; Also, double check the length of the data by reading the eventParam length byte to see how much data is with the message/data.

0 Likes