Functions

GATT Server App API Functions

Functions

void GATTServApp_RegisterForMsg (uint8 taskID)
 Register your task ID to receive event messages from the GATT Server Application.
bStatus_t GATTServApp_RegisterService (gattAttribute_t *pAttrs, uint16 numAttrs, CONST gattServiceCBs_t *pServiceCBs)
 Register a service's attribute list and callback functions with the GATT Server Application.
bStatus_t GATTServApp_DeregisterService (uint16 handle, gattAttribute_t **p2pAttrs)
 Deregister a service's attribute list and callback functions from the GATT Server Application.
gattAttribute_t * GATTServApp_FindAttr (gattAttribute_t *pAttrTbl, uint16 numAttrs, uint8 *pValue)
 Find the attribute record within a service attribute table for a given attribute value pointer.
bStatus_t GATTServApp_AddService (uint32 services)
 Add function for the GATT Service.
bStatus_t GATTServApp_DelService (uint32 services)
 Delete function for the GATT Service.
bStatus_t GATTServApp_SetParameter (uint8 param, uint8 len, void *pValue)
 Set a GATT Server parameter.
bStatus_t GATTServApp_GetParameter (uint8 param, void *pValue)
 Get a GATT Server parameter.
bStatus_t GATTServApp_UpdateCharCfg (uint16 connHandle, uint16 attrHandle, uint16 value)
 Update the Client Characteristic Configuration for a given Client.
void GATTServApp_InitCharCfg (uint16 connHandle, gattCharCfg_t *charCfgTbl)
 Initialize the client characteristic configuration table.
uint16 GATTServApp_ReadCharCfg (uint16 connHandle, gattCharCfg_t *charCfgTbl)
 Read the client characteristic configuration for a given client.
uint8 GATTServApp_WriteCharCfg (uint16 connHandle, gattCharCfg_t *charCfgTbl, uint16 value)
 Write the client characteristic configuration for a given client.
bStatus_t GATTServApp_ProcessCCCWriteReq (uint16 connHandle, gattAttribute_t *pAttr, uint8 *pValue, uint8 len, uint16 offset, uint16 validCfg)
 Process the client characteristic configuration write request for a given client.
bStatus_t GATTServApp_ProcessCharCfg (gattCharCfg_t *charCfgTbl, uint8 *pValue, uint8 authenticated, gattAttribute_t *attrTbl, uint16 numAttrs, uint8 taskId)
 Process Client Charateristic Configuration change.
void GATTServApp_SendCCCUpdatedEvent (uint16 connHandle, uint16 attrHandle, uint16 value)
 Build and send the GATT_CLIENT_CHAR_CFG_UPDATED_EVENT to the application.
bStatus_t GATTServApp_SendServiceChangedInd (uint16 connHandle, uint8 taskId)
 Send out a Service Changed Indication.
uint8 GATTServApp_ReadAttr (uint16 connHandle, gattAttribute_t *pAttr, uint16 service, uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen)
 Read an attribute. If the format of the attribute value is unknown to GATT Server, use the callback function provided by the Service.
uint8 GATTServApp_WriteAttr (uint16 connHandle, uint16 handle, uint8 *pValue, uint16 len, uint16 offset)
 Write attribute data.

Function Documentation

bStatus_t GATTServApp_AddService ( uint32  services  ) 

Add function for the GATT Service.

Parameters:
services - services to add. This is a bit map and can contain more than one service.
Returns:
SUCCESS: Service added successfully.
INVALIDPARAMETER: Invalid service field.
FAILURE: Not enough attribute handles available.
bleMemAllocError: Memory allocation error occurred.
bStatus_t GATTServApp_DelService ( uint32  services  ) 

Delete function for the GATT Service.

Parameters:
services - services to delete. This is a bit map and can contain more than one service.
Returns:
SUCCESS: Service deleted successfully.
FAILURE: Service not found.
bStatus_t GATTServApp_DeregisterService ( uint16  handle,
gattAttribute_t **  p2pAttrs 
)

Deregister a service's attribute list and callback functions from the GATT Server Application.

NOTE: It's the caller's responsibility to free the service attribute list returned from this API.

Parameters:
handle - handle of service to be deregistered
p2pAttrs - pointer to array of attribute records (to be returned)
Returns:
SUCCESS: Service deregistered successfully. FAILURE: Service not found.
gattAttribute_t* GATTServApp_FindAttr ( gattAttribute_t *  pAttrTbl,
uint16  numAttrs,
uint8 pValue 
)

Find the attribute record within a service attribute table for a given attribute value pointer.

Parameters:
pAttrTbl - pointer to attribute table
numAttrs - number of attributes in attribute table
pValue - pointer to attribute value
Returns:
Pointer to attribute record. NULL, if not found.
bStatus_t GATTServApp_GetParameter ( uint8  param,
void *  pValue 
)

Get a GATT Server parameter.

Parameters:
param - Profile parameter ID
pValue - pointer to data to put. This is dependent on the parameter ID and WILL be cast to the appropriate data type (example: data type of uint16 will be cast to uint16 pointer).
Returns:
SUCCESS: Parameter get successful INVALIDPARAMETER: Invalid parameter
void GATTServApp_InitCharCfg ( uint16  connHandle,
gattCharCfg_t charCfgTbl 
)

Initialize the client characteristic configuration table.

Note: Each client has its own instantiation of the Client Characteristic Configuration. Reads/Writes of the Client Characteristic Configuration only only affect the configuration of that client.

Parameters:
connHandle - connection handle (0xFFFF for all connections).
charCfgTbl - client characteristic configuration table.
Returns:
none
bStatus_t GATTServApp_ProcessCCCWriteReq ( uint16  connHandle,
gattAttribute_t *  pAttr,
uint8 pValue,
uint8  len,
uint16  offset,
uint16  validCfg 
)

Process the client characteristic configuration write request for a given client.

Parameters:
connHandle - connection message was received on.
pAttr - pointer to attribute.
pValue - pointer to data to be written.
len - length of data.
offset - offset of the first octet to be written.
validCfg - valid configuration.
Returns:
Success or Failure
bStatus_t GATTServApp_ProcessCharCfg ( gattCharCfg_t charCfgTbl,
uint8 pValue,
uint8  authenticated,
gattAttribute_t *  attrTbl,
uint16  numAttrs,
uint8  taskId 
)

Process Client Charateristic Configuration change.

Parameters:
charCfgTbl - characteristic configuration table.
pValue - pointer to attribute value.
authenticated - whether an authenticated link is required.
attrTbl - attribute table.
numAttrs - number of attributes in attribute table.
taskId - task to be notified of confirmation.
Returns:
Success or Failure
uint8 GATTServApp_ReadAttr ( uint16  connHandle,
gattAttribute_t *  pAttr,
uint16  service,
uint8 pValue,
uint8 pLen,
uint16  offset,
uint8  maxLen 
)

Read an attribute. If the format of the attribute value is unknown to GATT Server, use the callback function provided by the Service.

Parameters:
connHandle - connection message was received on
pAttr - pointer to attribute
service - handle of owner service
pValue - pointer to data to be read
pLen - length of data to be read
offset - offset of the first octet to be read
maxLen - maximum length of data to be read
Returns:
Success or Failure
uint16 GATTServApp_ReadCharCfg ( uint16  connHandle,
gattCharCfg_t charCfgTbl 
)

Read the client characteristic configuration for a given client.

Note: Each client has its own instantiation of the Client Characteristic Configuration. Reads of the Client Characteristic Configuration only shows the configuration for that client.

Parameters:
connHandle - connection handle.
charCfgTbl - client characteristic configuration table.
Returns:
attribute value
void GATTServApp_RegisterForMsg ( uint8  taskID  ) 

Register your task ID to receive event messages from the GATT Server Application.

Parameters:
taskID - Default task ID to send events.
Returns:
none
bStatus_t GATTServApp_RegisterService ( gattAttribute_t *  pAttrs,
uint16  numAttrs,
CONST gattServiceCBs_t pServiceCBs 
)

Register a service's attribute list and callback functions with the GATT Server Application.

Parameters:
pAttrs - Array of attribute records to be registered
numAttrs - Number of attributes in array
pServiceCBs - Service callback function pointers
Returns:
SUCCESS: Service registered successfully.
INVALIDPARAMETER: Invalid service field.
FAILURE: Not enough attribute handles available.
bleMemAllocError: Memory allocation error occurred.
void GATTServApp_SendCCCUpdatedEvent ( uint16  connHandle,
uint16  attrHandle,
uint16  value 
)

Build and send the GATT_CLIENT_CHAR_CFG_UPDATED_EVENT to the application.

Parameters:
connHandle - connection handle
attrHandle - attribute handle
value - attribute new value
Returns:
none
bStatus_t GATTServApp_SendServiceChangedInd ( uint16  connHandle,
uint8  taskId 
)

Send out a Service Changed Indication.

Parameters:
connHandle - connection to use
taskId - task to be notified of confirmation
Returns:
SUCCESS: Indication was sent successfully.
FAILURE: Service Changed attribute not found.
INVALIDPARAMETER: Invalid connection handle or request field.
MSG_BUFFER_NOT_AVAIL: No HCI buffer is available.
bleNotConnected: Connection is down.
blePending: A confirmation is pending with this client.
bStatus_t GATTServApp_SetParameter ( uint8  param,
uint8  len,
void *  pValue 
)

Set a GATT Server parameter.

Parameters:
param - Profile parameter ID
len - length of data to right
pValue - pointer to data to write. This is dependent on the parameter ID and WILL be cast to the appropriate data type (example: data type of uint16 will be cast to uint16 pointer).
Returns:
SUCCESS: Parameter set successful FAILURE: Parameter in use INVALIDPARAMETER: Invalid parameter bleInvalidRange: Invalid value bleMemAllocError: Memory allocation failed
bStatus_t GATTServApp_UpdateCharCfg ( uint16  connHandle,
uint16  attrHandle,
uint16  value 
)

Update the Client Characteristic Configuration for a given Client.

Note: This API should only be called from the Bond Manager.

Parameters:
connHandle - connection handle.
attrHandle - attribute handle.
value - characteristic configuration value.
Returns:
SUCCESS: Parameter get successful INVALIDPARAMETER: Invalid parameter
uint8 GATTServApp_WriteAttr ( uint16  connHandle,
uint16  handle,
uint8 pValue,
uint16  len,
uint16  offset 
)

Write attribute data.

Parameters:
connHandle - connection message was received on
handle - attribute handle
pValue - pointer to data to be written
len - length of data
offset - offset of the first octet to be written
Returns:
Success or Failure
uint8 GATTServApp_WriteCharCfg ( uint16  connHandle,
gattCharCfg_t charCfgTbl,
uint16  value 
)

Write the client characteristic configuration for a given client.

Note: Each client has its own instantiation of the Client Characteristic Configuration. Writes of the Client Characteristic Configuration only only affect the configuration of that client.

Parameters:
connHandle - connection handle.
charCfgTbl - client characteristic configuration table.
value - attribute new value.
Returns:
Success or Failure