AnsweredAssumed Answered

BlueNRG - Question about Aci_Gatt_Update_Char_Value

Question asked by Burck.Steven on Mar 21, 2016
I'm not sure if this is the place to ask this (it may be a generic bluetooth question, I'm a bit of a newbie at this), but please bear with me.

I had a bug in my software where I had accidentally declared in ACI_Gatt_Add_Characteristic a characteristic with a variable length value field (it isn't, it's fixed length).  It contained a 20 byte structure.  When calling ACI_Gatt_Update_Char_Value, I tried updating only parts of the structure by using the offset and length parameters.  This changed the size of the characteristics value each time.

I modified the length to be fixed length, but because I re-read the documentation, also modified the calls to the function Aci_Gatt_Update_Char_Value to always having offset 0 and length 20, because I don't understand what this means (from the documentation):

Val_Offset:
The offset from which the attribute value has to be updated. If
this is set to 0, and the attribute value is of variable length, then
the length of the attribute will be set to the Char_Value_Length. If
the Val_Offset is set to a value greater than 0, then the length of
the attribute will be set to the maximum length as specified for
the attribute while adding the characteristic.

It's not clear to me the point of this in a fixed-length value.  Now, my software is working, but each time I am updating a single byte in this structure (this is a generic "status" structure, in a few places one thing changes and I want to update it, such as battery level and switch positions), and would prefer minimizing communication with the BlueNRG when I do this, sending only partial data.  I could, I realize, do this by making multiple characteristics, but unfortunately I'm not the one who wrote the device specification, and unless I can show it's very detrimental to battery use, I won't get the user (customer for whom I'm developing the firmware) to change it.

Outcomes