Generic Attribute Profile (GATT)
www.ti.com
56
SWRU271H–October 2010–Revised April 2019
Submit Documentation Feedback
Copyright © 2010–2019, Texas Instruments Incorporated
The Bluetooth Low Energy Protocol Stack
5.5.4.2.2 Add Service Function
As Section 5.5.4.1 describes, when an application starts up it must add the GATT services it supports.
Each profile needs a global AddService function that can be called by the application. Some of these
services are defined in the protocol stack, such as GGS_AddService and GATTServApp_AddService.
User-defined services must expose their own AddService function that the application can call for profile
initialization. Using SimpleProfile_AddService() as an example, these functions should do the following:
• Allocate space for the client characteristic configuration (CCC) arrays.
As described in Section 5.5.4.2.1.4, a pointer to one of these arrays initialized in the profile. In the
AddService function, several supported connections are declared and memory is allocated for each
array. One CCC is defined in the simpleGATTProfile but the profile may contain additional CCCs.
• Initialize the CCC arrays.
CCC values do not change between power downs and bonded device connections because they are
stored in NV. For each CCC in the profile, the GATTServApp_InitCharCfg() function must be called.
This function initializes the CCCs with information from a previously bonded connection. If the function
cannot find the information, set the initial values to default values.
• Register the profile with the GATTServApp.
This function passes the attribute table of the profile to the GATTServApp so the attributes of the
profile are added to the application-wide attribute table, which is managed by the protocol stack. The
GATTServApp function assigns handles for each attribute. This function also passes pointers the
callback of the profile to the stack to initiate communication between the GATTServApp and the profile.