Airoha M0 BLE API  1.0.5.4
ble_att.h

Macros

#define ATT_NOERR   0x00
 attribute protocol error code
 

Typedefs

typedef uint16_t att_handle
 attribute handle.
 
typedef void(* ATTCB) (ATT_CB_TYPE type, uint8_t linkindex, uint16_t handle)
 attribute value accessed call back function. More...
 
typedef void(* INDI_CB) (uint8_t link_index)
 characteristic value indication confirmed call back function. More...
 

Enumerations

enum  UUID_size { UUID_16bit = 2, UUID_128bit = 16 }
 UUID size in bytes. More...
 

Functions

uint16_t BLE_att_get_attribute_length (att_handle handle)
 get current length of attribute value More...
 
bool BLE_att_set_attribute_length (att_handle handle, uint16_t new_length)
 set current length of attribute value More...
 
uint8_t * BLE_att_get_attribute_data_ptr (att_handle handle)
 get data pointer of attribute value More...
 
bool BLE_att_set_attribute_data_ptr (att_handle handle, uint8_t *new_data_ptr)
 set data pointer of attribute value More...
 
void BLE_att_set_default_mtu (uint16_t default_mtu)
 Set default MTU. More...
 

Detailed Description

ble_att.h

ble_att.h specifies attribute protocol related API and parameter definition.

Typedef Documentation

◆ ATTCB

typedef void(* ATTCB) (ATT_CB_TYPE type, uint8_t linkindex, uint16_t handle)

attribute value accessed call back function.

Call back function would be executed if the attribute is read/changed by ATT client.

◆ INDI_CB

typedef void(* INDI_CB) (uint8_t link_index)

characteristic value indication confirmed call back function.

Call back function would be executed if indication is confirmed by client.

Enumeration Type Documentation

◆ UUID_size

enum UUID_size

UUID size in bytes.

Enumerator
UUID_16bit 

2 bytes

UUID_128bit 

16 bytes

Function Documentation

◆ BLE_att_get_attribute_length()

uint16_t BLE_att_get_attribute_length ( att_handle  handle)

get current length of attribute value

Parameters
handleatt_handle
Returns
current length of attribute value. Would return 0xFFFF if attribute handle is not valid.

◆ BLE_att_set_attribute_length()

bool BLE_att_set_attribute_length ( att_handle  handle,
uint16_t  new_length 
)

set current length of attribute value

Parameters
handleatt_handle
new_lengthnew length of this attribute. Must < 512.
Returns
0: success 1: attribute handle is not valid.

◆ BLE_att_get_attribute_data_ptr()

uint8_t* BLE_att_get_attribute_data_ptr ( att_handle  handle)

get data pointer of attribute value

Parameters
handleatt_handle
Returns
data pointer of attribute value. Would return NULL if attribute handle is not valid.

◆ BLE_att_set_attribute_data_ptr()

bool BLE_att_set_attribute_data_ptr ( att_handle  handle,
uint8_t *  new_data_ptr 
)

set data pointer of attribute value

Parameters
handleatt_handle
new_data_ptrnew data pointer of this attribute.
Returns
0: success 1: attribute handle is not valid.

◆ BLE_att_set_default_mtu()

void BLE_att_set_default_mtu ( uint16_t  default_mtu)

Set default MTU.

Parameters
default_mtuDefault MTU to be set