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

cross mob
Anonymous
Not applicable

I'm trying to create a characteristic that contains a string with a max length that will only return the parts of the data that are not 0.

So far, I couldn't figure out how to do it but I do think it should be possible because the first name in the weight scale example does it.

In my client the zeros that are send are filtered and ignored, but I have a problem with the tests with the Profile Tuning Suite.

Is it possible to do this in a custom service with a custom characteristic?

0 Likes
1 Solution
Anonymous
Not applicable

I found a way to only send the data in a longer string on a read request on the server. The actualLen value of the characteristic must be changed so that the framework only uses the data in the actualLen of the array. The CyBle_GattsWriteAttributeValue function does not use the actual length value in the CYBLE_GATT_HANDLE_VALUE_PAIR_T parameter, that is told in the documentation.

The macro CYBLE_GATT_DB_ATTR_SET_ATTR_GEN_LEN(handle, value) can be used to achieve the shorter response. This macro should be used after the CyBle_GattsWriteAttributeValue function is used to write the data in the database.This value won't change when the value in the database is changed, so after each write, this macro is advised.

View solution in original post

11 Replies