NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
Attribute Protocol (ATT) Operation Codes

Macros

#define BLE_ATT_OP_ERROR_RSP   0x01
 
#define BLE_ATT_OP_READ_MULT_VAR_REQ   0x20
 
#define BLE_ATT_OP_READ_MULT_VAR_RSP   0x21
 
#define BLE_ATT_MTU_DFLT   23
 
#define BLE_ATT_MTU_MAX   527
 

Functions

int ble_att_svr_read_local (uint16_t attr_handle, struct os_mbuf **out_om)
 
int ble_att_svr_write_local (uint16_t attr_handle, struct os_mbuf *om)
 
uint16_t ble_att_mtu (uint16_t conn_handle)
 
uint16_t ble_att_preferred_mtu (void)
 
int ble_att_set_preferred_mtu (uint16_t mtu)
 

Detailed Description

Macro Definition Documentation

◆ BLE_ATT_MTU_DFLT

#define BLE_ATT_MTU_DFLT   23

Default ATT MTU. Also the minimum.

◆ BLE_ATT_MTU_MAX

#define BLE_ATT_MTU_MAX   527

An ATT MTU of 527 allows the largest ATT command (signed write) to contain a 512-byte attribute value.

◆ BLE_ATT_OP_ERROR_RSP

#define BLE_ATT_OP_ERROR_RSP   0x01

Error Response.

◆ BLE_ATT_OP_READ_MULT_VAR_REQ

#define BLE_ATT_OP_READ_MULT_VAR_REQ   0x20

Read Multiple Variable Lenght Request

◆ BLE_ATT_OP_READ_MULT_VAR_RSP

#define BLE_ATT_OP_READ_MULT_VAR_RSP   0x21

Read Multiple Variable Lenght Response

Function Documentation

◆ ble_att_mtu()

uint16_t ble_att_mtu ( uint16_t  conn_handle)

Retrieves the ATT MTU of the specified connection. If an MTU exchange for this connection has occurred, the MTU is the lower of the two peers' preferred values. Otherwise, the MTU is the default value of 23.

Parameters
conn_handleThe handle of the connection to query.
Returns
The specified connection's ATT MTU, or 0 if there is no such connection.

◆ ble_att_preferred_mtu()

uint16_t ble_att_preferred_mtu ( void  )

Retrieves the preferred ATT MTU. This is the value indicated by the device during an ATT MTU exchange.

Returns
The preferred ATT MTU.

◆ ble_att_set_preferred_mtu()

int ble_att_set_preferred_mtu ( uint16_t  mtu)

Sets the preferred ATT MTU; the device will indicate this value in all subsequent ATT MTU exchanges. The ATT MTU of a connection is equal to the lower of the two peers' preferred MTU values. The ATT MTU is what dictates the maximum size of any message sent during a GATT procedure.

The specified MTU must be within the following range: [23, BLE_ATT_MTU_MAX]. 23 is a minimum imposed by the Bluetooth specification; BLE_ATT_MTU_MAX is a NimBLE compile-time setting.

Parameters
mtuThe preferred ATT MTU.
Returns
0 on success; BLE_HS_EINVAL if the specified value is not within the allowed range.

◆ ble_att_svr_read_local()

int ble_att_svr_read_local ( uint16_t  attr_handle,
struct os_mbuf **  out_om 
)

Reads a locally registered attribute. If the specified attribute handle corresponds to a GATT characteristic value or descriptor, the read is performed by calling the registered GATT access callback.

Parameters
attr_handleThe 16-bit handle of the attribute to read.
out_omOn success, this is made to point to a newly-allocated mbuf containing the attribute data read.
Returns
0 on success; NimBLE host ATT return code if the attribute access callback reports failure; NimBLE host core return code on unexpected error.

◆ ble_att_svr_write_local()

int ble_att_svr_write_local ( uint16_t  attr_handle,
struct os_mbuf om 
)

Writes a locally registered attribute. This function consumes the supplied mbuf regardless of the outcome. If the specified attribute handle corresponds to a GATT characteristic value or descriptor, the write is performed by calling the registered GATT access callback.

Parameters
attr_handleThe 16-bit handle of the attribute to write.
omThe value to write to the attribute.
Returns
0 on success; NimBLE host ATT return code if the attribute access callback reports failure; NimBLE host core return code on unexpected error.