2021-10-18 03:07 AM
I'm struggling to get some detailed information on how to determine the correct number for the max_attr_records value of the aci_gatt_add_serv() function.
I know that you need 1 for the service itself and then at least 2 for each characteristic, but what else requires an attribute record?
Let say I have the following characteristic
aci_gatt_add_char(hServiceConfiguration, UUID_TYPE_128, uuid, 6,
CHAR_PROP_NOTIFY|CHAR_PROP_READ|CHAR_PROP_WRITE, ATTR_PERMISSION_ENCRY_WRITE,
GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP,
16, 0 , &hCharTripConf);
What would be the resulting number of attribute records? I came up with 4, but I'm not sure if that's correct.
Further, there seems to be a limit for the total attribute records as I can only add a quite limited amount of services. How is this limit defined?
2021-10-18 05:59 AM
Hi @aj.sk ,
I suppose you are using BlueNRG-1 or BlueNRG-2.
FYI, together with SDK, there is a specific and useful tool named "BlueNRG-X Radio Init Wizzard".
I advise to use this tool to help configure and optimize memory usage regarding number of service, characteristics,... this tool will also compute for you max_attr_records used by the aci_gatt_add_serv()
Once you installed BlueNRG-1/-2 SDK, you should get access from your Windows menu to this "BlueNRG-X Radio Init Wizzard"
Hope it helps,
Regards,
Sebastien.
2021-10-18 06:01 AM
Hi @Sebastien DENOUAL
I'm using BlueNRG-MS, but I assume the tool will be the same?
2021-10-18 06:15 AM
Hi,
Yes : sure you can use this tool also with BlueNRG-MS.
Now, if you don't need a very high optimization (RAM impact) , you can also increase this number with some margins to not be disturbed during your dev.
Regards,
Sebastien.
2021-10-18 06:28 AM
@Sebastien DENOUAL
Could you may tell me what's the definition of "Extended Properties" for a characteristic?
It seems like I run into some limitations as I cannot add another service, I currently have a total attribute record count of 57 from 4 services.
2021-10-19 08:15 AM
Hi @aj.sk ,
FYI, Attached is the release note of BlueNRG-MS BLE stack (extracted from BlueNRG-MS SDK documentation).
According to selected BlueNRG-MS stack mode (mode1,2,3 or 4), the max number of attributes records is different.
Default is mode3.
Regards,
Sebastien.
2021-10-21 01:59 AM
@Sebastien DENOUAL
Thank you very much! What does the following sentence imply
"The total number of attribute records for services is 8(2 resvered for the default GAP and GATT services)"
Does that mean that I can have a maximum of 6 services? And could you may still explain to me how to calculate the required max attribute records for the characteristic in the original post? My guess of 4 is based on the assumption that I need 2 for the characteristic (value and description), 1 because I have the notify attribute and 1 because I have the ATTR_PERMISSION_ENCRY_WRITE - is that correct?
2021-10-21 11:06 PM
4 is correct: 1 for the service itself. and 3 for the attribute.
In the 3 records for the attribute:
ENCRY_WRITE would be a security permission configuring the encryption need to write, that does not occupy a record.
2021-10-21 11:43 PM
Hi @Winfred LU
Thanks for your response
I didn't include the service itself in my calculation, so I probably can drastically reduce the amount of used attributes... so a characteristic (not including the service it belongs to) can never use more than 3 attribute records?
2021-10-22 12:05 AM
You are welcome.
A characteristic can consume more than 3 records, in case more descriptors are needed, such as extended properties.