TI BLE Stack API Documentation  2.03.08
Typedefs
GATT Server App Callback API Functions

Typedefs

typedef bStatus_t(* pfnGATTReadAttrCB_t) (uint16 connHandle, gattAttribute_t *pAttr, uint8 *pValue, uint16 *pLen, uint16 offset, uint16 maxLen, uint8 method)
 Callback function prototype to read an attribute value. More...
 
typedef bStatus_t(* pfnGATTWriteAttrCB_t) (uint16 connHandle, gattAttribute_t *pAttr, uint8 *pValue, uint16 len, uint16 offset, uint8 method)
 Callback function prototype to write an attribute value. More...
 
typedef bStatus_t(* pfnGATTAuthorizeAttrCB_t) (uint16 connHandle, gattAttribute_t *pAttr, uint8 opcode)
 Callback function prototype to authorize a Read or Write operation on a given attribute. More...
 

Detailed Description

Typedef Documentation

§ pfnGATTAuthorizeAttrCB_t

typedef bStatus_t(* pfnGATTAuthorizeAttrCB_t) (uint16 connHandle, gattAttribute_t *pAttr, uint8 opcode)

Callback function prototype to authorize a Read or Write operation on a given attribute.

Parameters
connHandle- connection request was received on
pAttr- pointer to attribute
opcode- request opcode (ATT_READ_REQ or ATT_WRITE_REQ)
Returns
SUCCESS: Operation authorized.
ATT_ERR_INSUFFICIENT_AUTHOR: Authorization required.

§ pfnGATTReadAttrCB_t

typedef bStatus_t(* pfnGATTReadAttrCB_t) (uint16 connHandle, gattAttribute_t *pAttr, uint8 *pValue, uint16 *pLen, uint16 offset, uint16 maxLen, uint8 method)

Callback function prototype to read an attribute value.

Note: blePending can be returned ONLY for the following read operations:

  • Read Request: ATT_READ_REQ
  • Read Blob Request: ATT_READ_BLOB_REQ

Note: If blePending is returned then it's the responsibility of the application to respond to ATT_READ_REQ and ATT_READ_BLOB_REQ message with ATT_READ_RSP and ATT_READ_BLOB_RSP message respectively.

Note: Payload 'pValue' used with ATT_READ_RSP and ATT_READ_BLOB_RSP must be allocated using GATT_bm_alloc().

Parameters
connHandle- connection request was received on
pAttr- pointer to attribute
pValue- pointer to data to be read (to be returned)
pLen- length of data (to be returned)
offset- offset of the first octet to be read
maxLen- maximum length of data to be read
method- type of read message
Returns
SUCCESS: Read was successfully.
blePending: A response is pending for this client.
Error, otherwise: ref ATT_ERR_CODE_DEFINES.

§ pfnGATTWriteAttrCB_t

typedef bStatus_t(* pfnGATTWriteAttrCB_t) (uint16 connHandle, gattAttribute_t *pAttr, uint8 *pValue, uint16 len, uint16 offset, uint8 method)

Callback function prototype to write an attribute value.

Note: blePending can be returned ONLY for the following write operations:

  • Write Request: ATT_WRITE_REQ
  • Write Command: ATT_WRITE_CMD
  • Write Long: ATT_EXECUTE_WRITE_REQ
  • Reliable Writes: Multiple ATT_PREPARE_WRITE_REQ followed by one final ATT_EXECUTE_WRITE_REQ

Note: If blePending is returned then it's the responsibility of the application to 1) respond to ATT_WRITE_REQ and ATT_EXECUTE_WRITE_REQ message with ATT_WRITE_RSP and ATT_EXECUTE_WRITE_RSP message respectively, and 2) free each request payload 'pValue' using BM_free().

Note: Write Command (ATT_WRITE_CMD) does NOT require a response message.

Parameters
connHandle- connection request was received on
pAttr- pointer to attribute
pValue- pointer to data to be written
pLen- length of data
offset- offset of the first octet to be written
method- type of write message
Returns
SUCCESS: Write was successfully.
blePending: A response is pending for this client.
Error, otherwise: ref ATT_ERR_CODE_DEFINES.