2014-08-02 08:45 AM
Hello,
there is one parameter in aci_gatt_add_serv() which needs clarification: max_attr_recordsLooking at the documentation and the sample code (the comment there suggest that even the st programer of the sample code was confused) does not give an answer to fully understand this parameter.Right now I have to use trial and error to find a working value. When looking at the parameter name it suggest that it is the maximum number of attribute records. However it looks like you have to double the actual amount of attribute records of the service and add 2 or 3 to get the correct number. Using lower numbers will result in a wrong service announcement and a non working device.tBleStatus
aci_gatt_add_serv
(
tHalUint8
service_uuid_type
,
const
tHalUint8
*
service_uuid
,
tHalUint8
service_type
,
tHalUint8
max_attr_records
,
tHalUint16
*
serviceHandle
);
Please give a calculation example for this parameter.Thanks,Maik2014-09-12 08:06 AM
You have to considered that each characteristic uses at least 2 attributes (declaration and value), plus other attributes for each included descriptor.
For example, if the characteristic has the notify property then you have to considered +3 attributes for this characteristic.
Therefore, if you add a service with two characteristics with Notification, you have to considered 2*3 attributes +1 for the service, in total the Max_Attribute_Records should be equal to 7.
Regards, Graziella