TI BLE Stack API Documentation  2.03.08
Functions
GATT Server API Functions

Functions

bStatus_t GATT_InitServer (void)
 Initialize the Generic Attribute Profile Server. More...
 
bStatus_t GATT_RegisterService (gattService_t *pService)
 Register a service attribute list with the GATT Server. A service is composed of characteristics or references to other services. Each characteristic contains a value and may contain optional information about the value. There are two types of services: primary service and secondary service. More...
 
bStatus_t GATT_DeregisterService (uint16 handle, gattService_t *pService)
 Deregister a service attribute list with the GATT Server. More...
 
void GATT_RegisterForReq (uint8 taskId)
 Register to receive incoming ATT Requests. More...
 
bStatus_t GATT_VerifyReadPermissions (uint16 connHandle, gattAttribute_t *pAttr, uint16 service)
 Verify the permissions of an attribute for reading. More...
 
bStatus_t GATT_VerifyWritePermissions (uint16 connHandle, gattAttribute_t *pAttr, uint16 service, attWriteReq_t *pReq)
 Verify the permissions of an attribute for writing. More...
 
uint8 GATT_ServiceChangedInd (uint16 connHandle, uint8 taskId)
 Send out a Service Changed Indication. More...
 
gattAttribute_tGATT_FindHandleUUID (uint16 startHandle, uint16 endHandle, const uint8 *pUUID, uint16 len, uint16 *pHandle)
 Find the attribute record for a given handle and UUID. More...
 
gattAttribute_tGATT_FindHandle (uint16 handle, uint16 *pHandle)
 Find the attribute record for a given handle. More...
 
gattAttribute_tGATT_FindNextAttr (gattAttribute_t *pAttr, uint16 endHandle, uint16 service, uint16 *pLastHandle)
 Find the next attribute of the same type for a given attribute. More...
 
uint16 GATT_ServiceNumAttrs (uint16 handle)
 Get the number of attributes for a given service. More...
 
uint8 GATT_ServiceEncKeySize (uint16 handle)
 Get the minimum encryption key size required by a given service. More...
 
bStatus_t GATT_SendRsp (uint16 connHandle, uint8 method, gattMsg_t *pRsp)
 Send an ATT Response message out. More...
 

Detailed Description

Function Documentation

§ GATT_DeregisterService()

bStatus_t GATT_DeregisterService ( uint16  handle,
gattService_t pService 
)

Deregister a service attribute list with the GATT Server.

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
pService- pointer to deregistered service (to be returned)
Returns
SUCCESS: Service deregistered successfully.
FAILURE: Service not found.

§ GATT_FindHandle()

gattAttribute_t* GATT_FindHandle ( uint16  handle,
uint16 *  pHandle 
)

Find the attribute record for a given handle.

Parameters
handle- handle to look for
pHandle- handle of owner of attribute (to be returned)
Returns
Pointer to attribute record. NULL, otherwise.

§ GATT_FindHandleUUID()

gattAttribute_t* GATT_FindHandleUUID ( uint16  startHandle,
uint16  endHandle,
const uint8 *  pUUID,
uint16  len,
uint16 *  pHandle 
)

Find the attribute record for a given handle and UUID.

Parameters
startHandle- first handle to look for
endHandle- last handle to look for
pUUID- pointer to UUID to look for
len- length of UUID
pHandle- handle of owner of attribute (to be returned)
Returns
Pointer to attribute record. NULL, otherwise.

§ GATT_FindNextAttr()

gattAttribute_t* GATT_FindNextAttr ( gattAttribute_t pAttr,
uint16  endHandle,
uint16  service,
uint16 *  pLastHandle 
)

Find the next attribute of the same type for a given attribute.

Parameters
pAttr- pointer to attribute to find a next for
endHandle- last handle to look for
service- handle of owner service
pLastHandle- handle of last attribute (to be returned)
Returns
Pointer to next attribute record. NULL, otherwise.

§ GATT_InitServer()

bStatus_t GATT_InitServer ( void  )

Initialize the Generic Attribute Profile Server.

Returns
SUCCESS: Server initialized successfully.
bleMemAllocError: Memory allocation error occurred.

§ GATT_RegisterForReq()

void GATT_RegisterForReq ( uint8  taskId)

Register to receive incoming ATT Requests.

Parameters
taskId- task to forward requests to
Returns
void

§ GATT_RegisterService()

bStatus_t GATT_RegisterService ( gattService_t pService)

Register a service attribute list with the GATT Server. A service is composed of characteristics or references to other services. Each characteristic contains a value and may contain optional information about the value. There are two types of services: primary service and secondary service.

A service definition begins with a service declaration and ends before the next service declaration or the maximum Attribute Handle.

A characteristic definition begins with a characteristic declaration and ends before the next characteristic or service declaration or maximum Attribute Handle.

The attribute server will only keep a pointer to the attribute list, so the calling application will have to maintain the code and RAM associated with this list.

Parameters
pService- pointer to service attribute list to be registered
Returns
SUCCESS: Service registered successfully.
INVALIDPARAMETER: Invalid service field.
FAILURE: Not enough attribute handles available.
bleMemAllocError: Memory allocation error occurred.
bleInvalidRange: Encryption key size's out of range.

§ GATT_SendRsp()

bStatus_t GATT_SendRsp ( uint16  connHandle,
uint8  method,
gattMsg_t pRsp 
)

Send an ATT Response message out.

Parameters
connHandle- connection to use
method- type of response message
pRsp- pointer to ATT response to be sent
Returns
SUCCESS: Response was sent successfully. INVALIDPARAMETER: Invalid response field. MSG_BUFFER_NOT_AVAIL: No HCI buffer is available. bleNotConnected: Connection is down. bleMemAllocError: Memory allocation error occurred. blePending: In the middle of another transmit. bleInvalidMtuSize: Packet length is larger than connection's MTU size.

§ GATT_ServiceChangedInd()

uint8 GATT_ServiceChangedInd ( 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.

§ GATT_ServiceEncKeySize()

uint8 GATT_ServiceEncKeySize ( uint16  handle)

Get the minimum encryption key size required by a given service.

Parameters
handle- service handle to look for
Returns
Encryption key size if service found. Default key size, otherwise.

§ GATT_ServiceNumAttrs()

uint16 GATT_ServiceNumAttrs ( uint16  handle)

Get the number of attributes for a given service.

Parameters
handle- service handle to look for
Returns
Number of attributes if service found. 0, otherwise.

§ GATT_VerifyReadPermissions()

bStatus_t GATT_VerifyReadPermissions ( uint16  connHandle,
gattAttribute_t pAttr,
uint16  service 
)

Verify the permissions of an attribute for reading.

Parameters
connHandle- connection to use
pAttr- pointer to attribute
service- service handle
Returns
SUCCESS : Attribute can be read.
ATT_ERR_INSUFFICIENT_ENCRYPT : Attribute cannot be read.
ATT_ERR_INSUFFICIENT_AUTHEN : Attribute requires authentication.
ATT_ERR_INSUFFICIENT_KEY_SIZE : Key Size used for encrypting is insufficient.
ATT_ERR_INSUFFICIENT_ENCRYPT : Attribute requires encryption.

§ GATT_VerifyWritePermissions()

bStatus_t GATT_VerifyWritePermissions ( uint16  connHandle,
gattAttribute_t pAttr,
uint16  service,
attWriteReq_t pReq 
)

Verify the permissions of an attribute for writing.

Parameters
connHandle- connection to use
pAttr- pointer to attribute
service- service handle
pReq- pointer to write request
Returns
SUCCESS : Attribute can be written.
ATT_ERR_INSUFFICIENT_ENCRYPT : Attribute cannot be written.
ATT_ERR_INSUFFICIENT_AUTHEN : Attribute requires authentication.
ATT_ERR_INSUFFICIENT_KEY_SIZE : Key Size used for encrypting is insufficient.
ATT_ERR_INSUFFICIENT_ENCRYPT : Attribute requires encryption.