Bluetooth Low Energy Host Stack  Rev. 4
API Reference Manual
GATT - Generic Attribute Profile Interface

Overview


 

Files

file  att_errors.h
 
file  gatt_types.h
 
file  gatt_interface.h
 

Data Structures

struct  attPrepareWriteRequestParams_t
 
struct  gattAttribute_t
 
struct  gattCharacteristic_t
 
struct  gattService_t
 
struct  gattDbCharPresFormat_t
 
struct  gattHandleRange_t
 

Enumerations

enum  attErrorCode_t {
  gAttErrCodeNoError_c, gAttErrCodeInvalidHandle_c, gAttErrCodeReadNotPermitted_c, gAttErrCodeWriteNotPermitted_c,
  gAttErrCodeInvalidPdu_c, gAttErrCodeInsufficientAuthentication_c, gAttErrCodeRequestNotSupported_c, gAttErrCodeInvalidOffset_c,
  gAttErrCodeInsufficientAuthorization_c, gAttErrCodePrepareQueueFull_c, gAttErrCodeAttributeNotFound_c, gAttErrCodeAttributeNotLong_c,
  gAttErrCodeInsufficientEncryptionKeySize_c, gAttErrCodeInvalidAttributeValueLength_c, gAttErrCodeUnlikelyError_c, gAttErrCodeInsufficientEncryption_c,
  gAttErrCodeUnsupportedGroupType_c, gAttErrCodeInsufficientResources_c
}
 
enum  gattCccdFlags_t { gCccdEmpty_c, gCccdNotification_c, gCccdIndication_c }
 

Functions

bleResult_t Gatt_Init (void)
 
bleResult_t Gatt_GetMtu (deviceId_t deviceId, uint16_t *pOutMtu)
 

Data Structure Documentation

◆ attPrepareWriteRequestParams_t

struct attPrepareWriteRequestParams_t

Prepare Write Request Parameters Structure used by external reference.

Data Fields
uint16_t attributeHandle
uint16_t valueOffset
uint8_t attributeValue[gAttMaxMtu_c - 5]
uint16_t attributeLength

◆ gattAttribute_t

struct gattAttribute_t

GATT Attribute structure definition.

Data Fields
uint16_t handle Attribute handle.
bleUuidType_t uuidType Type of the UUID.
bleUuid_t uuid The attribute's UUID.
uint16_t valueLength Length of the attribute value array.
uint16_t maxValueLength Maximum length of the attribute value array; if this is set to 0, then the attribute's length is fixed and cannot be changed.
uint8_t * paValue Attribute value array.

◆ gattCharacteristic_t

struct gattCharacteristic_t

GATT Characteristic structure definition.

Data Fields
gattCharacteristicPropertiesBitFields_t properties Characteristic Properties as defined by GATT.
gattAttribute_t value Characteristic Value attribute.
uint8_t cNumDescriptors Size of the Characteristic Descriptors array.
gattAttribute_t * aDescriptors Characteristic Descriptors array.

◆ gattService_t

struct gattService_t

GATT Service structure definition.

Data Fields
uint16_t startHandle The handle of the Service Declaration attribute.
uint16_t endHandle The last handle belonging to this Service (followed by another Service declaration of the end of the database).
bleUuidType_t uuidType Service UUID type.
bleUuid_t uuid Service UUID.
uint8_t cNumCharacteristics Size of the Characteristic array.
gattCharacteristic_t * aCharacteristics Characteristic array.
uint8_t cNumIncludedServices Size of the Included Services array.
struct gattService_tag * aIncludedServices Included Services array.

◆ gattDbCharPresFormat_t

struct gattDbCharPresFormat_t

Characteristic Presentation Format Descriptor structure.

Data Fields
uint8_t format
int8_t exponent
uint16_t unitUuid16
uint8_t ns
uint16_t description

◆ gattHandleRange_t

struct gattHandleRange_t

GATT Handle Range structure definition.

Data Fields
uint16_t startHandle Start Handle.
uint16_t endHandle End Handle - shall be greater than or equal to Start Handle.

Enumeration Type Documentation

◆ attErrorCode_t

ATT error codes.

◆ gattCccdFlags_t

Flags for the value of the Client Characteristic Configuration Descriptor.

Enumerator
gCccdEmpty_c 

Nothing is enabled.

gCccdNotification_c 

Enables notifications.

gCccdIndication_c 

Enabled indications.

Function Documentation

◆ Gatt_Init()

bleResult_t Gatt_Init ( void  )


Initializes the GATT module.

Remarks
If the GAP module is present, this function is called internally by Ble_HostInitialize(). Otherwise, the application must call this function once at device start-up.
This function executes synchronously.

◆ Gatt_GetMtu()

bleResult_t Gatt_GetMtu ( deviceId_t  deviceId,
uint16_t *  pOutMtu 
)


Retrieves the MTU used with a given connected device.

Parameters
[in]deviceIdThe device ID of the connected peer.
[out]pOutMtuPointer to integer to be written.
Returns
gBleSuccess_c or error.
Remarks
This function executes synchronously.