NimBLE-Arduino 2.1.2
|
Bluetooth Generic Attribute Profile (GATT) More...
Classes | |
struct | ble_gatt_cpfd |
struct | ble_gatt_access_ctxt |
struct | ble_gatt_register_ctxt |
Macros | |
#define | BLE_GATT_CHR_FORMAT_BOOLEAN 0x01 |
#define | BLE_GATT_CHR_UNIT_UNITLESS 0x2700 /* Unitless */ |
#define | BLE_GATT_CHR_NAMESPACE_BT_SIG 0x01 |
#define | BLE_GATT_CHR_BT_SIG_DESC_UNKNOWN 0x0000 |
#define | BLE_GATT_CHR_BT_SIG_DESC_FRONT 0x0100 |
Typedefs | |
typedef int | ble_gatt_attr_fn(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg) |
typedef int | ble_gatt_attr_mult_fn(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attrs, uint8_t num_attrs, void *arg) |
typedef int | ble_gatt_reliable_attr_fn(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attrs, uint8_t num_attrs, void *arg) |
Functions | |
int | ble_gattc_exchange_mtu (uint16_t conn_handle, ble_gatt_mtu_fn *cb, void *cb_arg) |
int | ble_gattc_disc_all_svcs (uint16_t conn_handle, ble_gatt_disc_svc_fn *cb, void *cb_arg) |
int | ble_gattc_disc_svc_by_uuid (uint16_t conn_handle, const ble_uuid_t *uuid, ble_gatt_disc_svc_fn *cb, void *cb_arg) |
int | ble_gattc_find_inc_svcs (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, ble_gatt_disc_svc_fn *cb, void *cb_arg) |
int | ble_gattc_disc_all_chrs (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, ble_gatt_chr_fn *cb, void *cb_arg) |
int | ble_gattc_disc_chrs_by_uuid (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, const ble_uuid_t *uuid, ble_gatt_chr_fn *cb, void *cb_arg) |
int | ble_gattc_disc_all_dscs (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, ble_gatt_dsc_fn *cb, void *cb_arg) |
int | ble_gattc_read (uint16_t conn_handle, uint16_t attr_handle, ble_gatt_attr_fn *cb, void *cb_arg) |
int | ble_gattc_read_by_uuid (uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, const ble_uuid_t *uuid, ble_gatt_attr_fn *cb, void *cb_arg) |
int | ble_gattc_read_long (uint16_t conn_handle, uint16_t handle, uint16_t offset, ble_gatt_attr_fn *cb, void *cb_arg) |
int | ble_gattc_read_mult (uint16_t conn_handle, const uint16_t *handles, uint8_t num_handles, ble_gatt_attr_fn *cb, void *cb_arg) |
int | ble_gattc_write_no_rsp (uint16_t conn_handle, uint16_t attr_handle, struct os_mbuf *om) |
int | ble_gattc_write_no_rsp_flat (uint16_t conn_handle, uint16_t attr_handle, const void *data, uint16_t data_len) |
int | ble_gattc_signed_write (uint16_t conn_handle, uint16_t attr_handle, struct os_mbuf *txom) |
int | ble_gattc_write (uint16_t conn_handle, uint16_t attr_handle, struct os_mbuf *om, ble_gatt_attr_fn *cb, void *cb_arg) |
int | ble_gattc_write_flat (uint16_t conn_handle, uint16_t attr_handle, const void *data, uint16_t data_len, ble_gatt_attr_fn *cb, void *cb_arg) |
int | ble_gattc_write_long (uint16_t conn_handle, uint16_t attr_handle, uint16_t offset, struct os_mbuf *om, ble_gatt_attr_fn *cb, void *cb_arg) |
int | ble_gattc_write_reliable (uint16_t conn_handle, struct ble_gatt_attr *attrs, int num_attrs, ble_gatt_reliable_attr_fn *cb, void *cb_arg) |
int | ble_gatts_notify_custom (uint16_t conn_handle, uint16_t att_handle, struct os_mbuf *om) |
int | ble_gattc_notify_custom (uint16_t conn_handle, uint16_t att_handle, struct os_mbuf *om) |
int | ble_gatts_notify (uint16_t conn_handle, uint16_t chr_val_handle) |
int | ble_gattc_notify (uint16_t conn_handle, uint16_t chr_val_handle) |
int | ble_gatts_indicate_custom (uint16_t conn_handle, uint16_t chr_val_handle, struct os_mbuf *txom) |
int | ble_gattc_indicate_custom (uint16_t conn_handle, uint16_t chr_val_handle, struct os_mbuf *txom) |
int | ble_gatts_indicate (uint16_t conn_handle, uint16_t chr_val_handle) |
int | ble_gattc_indicate (uint16_t conn_handle, uint16_t chr_val_handle) |
int | ble_gatts_add_svcs (const struct ble_gatt_svc_def *svcs) |
int | ble_gatts_svc_set_visibility (uint16_t handle, int visible) |
int | ble_gatts_count_cfg (const struct ble_gatt_svc_def *defs) |
void | ble_gatts_chr_updated (uint16_t chr_val_handle) |
int | ble_gatts_find_svc (const ble_uuid_t *uuid, uint16_t *out_handle) |
int | ble_gatts_find_chr (const ble_uuid_t *svc_uuid, const ble_uuid_t *chr_uuid, uint16_t *out_def_handle, uint16_t *out_val_handle) |
int | ble_gatts_find_dsc (const ble_uuid_t *svc_uuid, const ble_uuid_t *chr_uuid, const ble_uuid_t *dsc_uuid, uint16_t *out_dsc_handle) |
void | ble_gatts_show_local (void) |
int | ble_gatts_reset (void) |
int | ble_gatts_start (void) |
int | ble_gatts_peer_cl_sup_feat_update (uint16_t conn_handle, struct os_mbuf *om) |
int | ble_gatts_peer_cl_sup_feat_get (uint16_t conn_handle, uint8_t *out_supported_feat, uint8_t len) |
int | ble_gatts_get_cfgable_chrs (void) |
Bluetooth Generic Attribute Profile (GATT)
#define BLE_GATT_CHR_BT_SIG_DESC_FRONT 0x0100 |
0x0001 - 0x00FF represent themselves. See Ref for more info
#define BLE_GATT_CHR_BT_SIG_DESC_UNKNOWN 0x0000 |
Client Presentation Format GATT Description for Name Space BT_SIG Ref: Assigned Numbers Specification
#define BLE_GATT_CHR_FORMAT_BOOLEAN 0x01 |
Client Presentation Format GATT Format Types Ref: Assigned Numbers Specification
#define BLE_GATT_CHR_NAMESPACE_BT_SIG 0x01 |
Client Presentation Format GATT Name Space Ref: Assigned Numbers Specification
#define BLE_GATT_CHR_UNIT_UNITLESS 0x2700 /* Unitless */ |
Client Presentation Format GATT Unit UUIDs Ref: Assigned Numbers Specification
typedef int ble_gatt_attr_fn(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg) |
The host will free the attribute mbuf automatically after the callback is executed. The application can take ownership of the mbuf and prevent it from being freed by assigning NULL to attr->om.
typedef int ble_gatt_attr_mult_fn(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attrs, uint8_t num_attrs, void *arg) |
The host will free the attribute mbuf automatically after the callback is executed. The application can take ownership of the mbuf and prevent it from being freed by assigning NULL to attr->om.
typedef int ble_gatt_reliable_attr_fn(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attrs, uint8_t num_attrs, void *arg) |
The host will free the attribute mbufs automatically after the callback is executed. The application can take ownership of the mbufs and prevent them from being freed by assigning NULL to each attribute's om field.
int ble_gattc_disc_all_chrs | ( | uint16_t | conn_handle, |
uint16_t | start_handle, | ||
uint16_t | end_handle, | ||
ble_gatt_chr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Discover All Characteristics of a Service.
conn_handle | The connection over which to execute the procedure. |
start_handle | The handle to begin the search at (generally the service definition handle). |
end_handle | The handle to end the search at (generally the last handle in the service). |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_disc_all_dscs | ( | uint16_t | conn_handle, |
uint16_t | start_handle, | ||
uint16_t | end_handle, | ||
ble_gatt_dsc_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Discover All Characteristic Descriptors.
conn_handle | The connection over which to execute the procedure. |
chr_val_handle | The handle of the characteristic value attribute. |
chr_end_handle | The last handle in the characteristic definition. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_disc_all_svcs | ( | uint16_t | conn_handle, |
ble_gatt_disc_svc_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Discover All Primary Services.
conn_handle | The connection over which to execute the procedure. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_disc_chrs_by_uuid | ( | uint16_t | conn_handle, |
uint16_t | start_handle, | ||
uint16_t | end_handle, | ||
const ble_uuid_t * | uuid, | ||
ble_gatt_chr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Discover Characteristics by UUID.
conn_handle | The connection over which to execute the procedure. |
start_handle | The handle to begin the search at (generally the service definition handle). |
end_handle | The handle to end the search at (generally the last handle in the service). |
chr_uuid128 | The 128-bit UUID of the characteristic to discover. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_disc_svc_by_uuid | ( | uint16_t | conn_handle, |
const ble_uuid_t * | uuid, | ||
ble_gatt_disc_svc_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Discover Primary Service by Service UUID.
conn_handle | The connection over which to execute the procedure. |
service_uuid128 | The 128-bit UUID of the service to discover. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_exchange_mtu | ( | uint16_t | conn_handle, |
ble_gatt_mtu_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Exchange MTU.
conn_handle | The connection over which to execute the procedure. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_find_inc_svcs | ( | uint16_t | conn_handle, |
uint16_t | start_handle, | ||
uint16_t | end_handle, | ||
ble_gatt_disc_svc_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Find Included Services.
conn_handle | The connection over which to execute the procedure. |
start_handle | The handle to begin the search at (generally the service definition handle). |
end_handle | The handle to end the search at (generally the last handle in the service). |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_indicate | ( | uint16_t | conn_handle, |
uint16_t | chr_val_handle | ||
) |
Deprecated. Should not be used. Use ble_gatts_indicate instead.
int ble_gattc_indicate_custom | ( | uint16_t | conn_handle, |
uint16_t | chr_val_handle, | ||
struct os_mbuf * | txom | ||
) |
Deprecated. Should not be used. Use ble_gatts_indicate_custom instead.
int ble_gattc_notify | ( | uint16_t | conn_handle, |
uint16_t | chr_val_handle | ||
) |
Deprecated. Should not be used. Use ble_gatts_notify instead.
int ble_gattc_notify_custom | ( | uint16_t | conn_handle, |
uint16_t | att_handle, | ||
struct os_mbuf * | om | ||
) |
Deprecated. Should not be used. Use ble_gatts_notify_custom instead.
int ble_gattc_read | ( | uint16_t | conn_handle, |
uint16_t | attr_handle, | ||
ble_gatt_attr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Read Characteristic Value.
conn_handle | The connection over which to execute the procedure. |
attr_handle | The handle of the characteristic value to read. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_read_by_uuid | ( | uint16_t | conn_handle, |
uint16_t | start_handle, | ||
uint16_t | end_handle, | ||
const ble_uuid_t * | uuid, | ||
ble_gatt_attr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Read Using Characteristic UUID.
conn_handle | The connection over which to execute the procedure. |
start_handle | The first handle to search (generally the handle of the service definition). |
end_handle | The last handle to search (generally the last handle in the service definition). |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_read_long | ( | uint16_t | conn_handle, |
uint16_t | handle, | ||
uint16_t | offset, | ||
ble_gatt_attr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Read Long Characteristic Values.
conn_handle | The connection over which to execute the procedure. |
handle | The handle of the characteristic value to read. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_read_mult | ( | uint16_t | conn_handle, |
const uint16_t * | handles, | ||
uint8_t | num_handles, | ||
ble_gatt_attr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Read Multiple Characteristic Values.
conn_handle | The connection over which to execute the procedure. |
handles | An array of 16-bit attribute handles to read. |
num_handles | The number of entries in the "handles" array. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_signed_write | ( | uint16_t | conn_handle, |
uint16_t | attr_handle, | ||
struct os_mbuf * | txom | ||
) |
Initiates GATT procedure: Signed Write. This function consumes the supplied mbuf regardless of the outcome.
conn_handle | The connection over which to execute the procedure. |
attr_handle | The handle of the characteristic value to write to. |
txom | The value to write to the characteristic. |
int ble_gattc_write | ( | uint16_t | conn_handle, |
uint16_t | attr_handle, | ||
struct os_mbuf * | om, | ||
ble_gatt_attr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Write Characteristic Value. This function consumes the supplied mbuf regardless of the outcome.
conn_handle | The connection over which to execute the procedure. |
attr_handle | The handle of the characteristic value to write to. |
txom | The value to write to the characteristic. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_write_flat | ( | uint16_t | conn_handle, |
uint16_t | attr_handle, | ||
const void * | data, | ||
uint16_t | data_len, | ||
ble_gatt_attr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Write Characteristic Value (flat buffer version).
conn_handle | The connection over which to execute the procedure. |
attr_handle | The handle of the characteristic value to write to. |
value | The value to write to the characteristic. |
value_len | The number of bytes to write. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_write_long | ( | uint16_t | conn_handle, |
uint16_t | attr_handle, | ||
uint16_t | offset, | ||
struct os_mbuf * | om, | ||
ble_gatt_attr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Write Long Characteristic Values. This function consumes the supplied mbuf regardless of the outcome.
conn_handle | The connection over which to execute the procedure. |
attr_handle | The handle of the characteristic value to write to. |
txom | The value to write to the characteristic. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gattc_write_no_rsp | ( | uint16_t | conn_handle, |
uint16_t | attr_handle, | ||
struct os_mbuf * | om | ||
) |
Initiates GATT procedure: Write Without Response. This function consumes the supplied mbuf regardless of the outcome.
conn_handle | The connection over which to execute the procedure. |
attr_handle | The handle of the characteristic value to write to. |
txom | The value to write to the characteristic. |
int ble_gattc_write_no_rsp_flat | ( | uint16_t | conn_handle, |
uint16_t | attr_handle, | ||
const void * | data, | ||
uint16_t | data_len | ||
) |
Initiates GATT procedure: Write Without Response. This function consumes the supplied mbuf regardless of the outcome.
conn_handle | The connection over which to execute the procedure. |
attr_handle | The handle of the characteristic value to write to. |
value | The value to write to the characteristic. |
value_len | The number of bytes to write. |
int ble_gattc_write_reliable | ( | uint16_t | conn_handle, |
struct ble_gatt_attr * | attrs, | ||
int | num_attrs, | ||
ble_gatt_reliable_attr_fn * | cb, | ||
void * | cb_arg | ||
) |
Initiates GATT procedure: Reliable Writes. This function consumes the supplied mbufs regardless of the outcome.
conn_handle | The connection over which to execute the procedure. |
attrs | An array of attribute descriptors; specifies which characteristics to write to and what data to write to them. The mbuf pointer in each attribute is set to NULL by this function. |
num_attrs | The number of characteristics to write; equal to the number of elements in the 'attrs' array. |
cb | The function to call to report procedure status updates; null for no callback. |
cb_arg | The optional argument to pass to the callback function. |
int ble_gatts_add_svcs | ( | const struct ble_gatt_svc_def * | svcs | ) |
Queues a set of service definitions for registration. All services queued in this manner get registered when ble_gatts_start() is called.
svcs | An array of service definitions to queue for registration. This array must be terminated with an entry whose 'type' equals 0. |
void ble_gatts_chr_updated | ( | uint16_t | chr_val_handle | ) |
Send notification (or indication) to any connected devices that have subscribed for notification (or indication) for specified characteristic.
chr_val_handle | Characteristic value handle |
int ble_gatts_count_cfg | ( | const struct ble_gatt_svc_def * | defs | ) |
Adjusts a host configuration object's settings to accommodate the specified service definition array. This function adds the counts to the appropriate fields in the supplied configuration object without clearing them first, so it can be called repeatedly with different inputs to calculate totals. Be sure to zero the GATT server settings prior to the first call to this function.
defs | The service array containing the resource definitions to be counted. |
int ble_gatts_find_chr | ( | const ble_uuid_t * | svc_uuid, |
const ble_uuid_t * | chr_uuid, | ||
uint16_t * | out_def_handle, | ||
uint16_t * | out_val_handle | ||
) |
Retrieves the pair of attribute handles associated with a local GATT characteristic.
svc_uuid | The UUID of the parent service. |
chr_uuid | The UUID of the characteristic to look up. |
out_def_handle | On success, populated with the handle of the characteristic definition attribute. Pass null if you don't need this value. |
out_val_handle | On success, populated with the handle of the characteristic value attribute. Pass null if you don't need this value. |
int ble_gatts_find_dsc | ( | const ble_uuid_t * | svc_uuid, |
const ble_uuid_t * | chr_uuid, | ||
const ble_uuid_t * | dsc_uuid, | ||
uint16_t * | out_dsc_handle | ||
) |
Retrieves the attribute handle associated with a local GATT descriptor.
svc_uuid | The UUID of the grandparent service. |
chr_uuid | The UUID of the parent characteristic. |
dsc_uuid | The UUID of the descriptor ro look up. |
out_handle | On success, populated with the handle of the descriptor attribute. Pass null if you don't need this value. |
int ble_gatts_find_svc | ( | const ble_uuid_t * | uuid, |
uint16_t * | out_handle | ||
) |
Retrieves the attribute handle associated with a local GATT service.
uuid | The UUID of the service to look up. |
out_handle | On success, populated with the handle of the service attribute. Pass null if you don't need this value. |
int ble_gatts_get_cfgable_chrs | ( | void | ) |
Returns the current number of configured characteristics
int ble_gatts_indicate | ( | uint16_t | conn_handle, |
uint16_t | chr_val_handle | ||
) |
Sends a characteristic indication. The content of the message is read from the specified characteristic.
conn_handle | The connection over which to execute the procedure. |
chr_val_handle | The value attribute handle of the characteristic to include in the outgoing indication. |
int ble_gatts_indicate_custom | ( | uint16_t | conn_handle, |
uint16_t | chr_val_handle, | ||
struct os_mbuf * | txom | ||
) |
Sends a "free-form" characteristic indication. The provided mbuf contains the indication payload. This function consumes the supplied mbuf regardless of the outcome.
conn_handle | The connection over which to execute the procedure. |
chr_val_handle | The value attribute handle of the characteristic to include in the outgoing indication. |
txom | The data to include in the indication. |
int ble_gatts_notify | ( | uint16_t | conn_handle, |
uint16_t | chr_val_handle | ||
) |
Sends a characteristic notification. The content of the message is read from the specified characteristic.
conn_handle | The connection over which to execute the procedure. |
chr_val_handle | The value attribute handle of the characteristic to include in the outgoing notification. |
int ble_gatts_notify_custom | ( | uint16_t | conn_handle, |
uint16_t | att_handle, | ||
struct os_mbuf * | om | ||
) |
Sends a "free-form" characteristic notification. This function consumes the supplied mbuf regardless of the outcome.
conn_handle | The connection over which to execute the procedure. |
chr_val_handle | The attribute handle to indicate in the outgoing notification. |
txom | The value to write to the characteristic. |
int ble_gatts_peer_cl_sup_feat_get | ( | uint16_t | conn_handle, |
uint8_t * | out_supported_feat, | ||
uint8_t | len | ||
) |
Gets Client Supported Features for specified connection.
conn_handle | Connection handle identifying connection for which Client Supported Features should be saved |
out_supported_feat | Client supported features to be returned. |
int ble_gatts_peer_cl_sup_feat_update | ( | uint16_t | conn_handle, |
struct os_mbuf * | om | ||
) |
Saves Client Supported Features for specified connection.
conn_handle | Connection handle identifying connection for which Client Supported Features should be saved |
om | The mbuf chain to set value from. |
int ble_gatts_reset | ( | void | ) |
Resets the GATT server to its initial state. On success, this function removes all supported services, characteristics, and descriptors. This function requires that: o No peers are connected, and o No GAP operations are active (advertise, discover, or connect).
void ble_gatts_show_local | ( | void | ) |
Prints dump of local GATT database. This is useful to log local state of database in human readable form.
int ble_gatts_start | ( | void | ) |
Makes all registered services available to peers. This function gets called automatically by the NimBLE host on startup; manual calls are only necessary for replacing the set of supported services with a new one. This function requires that: o No peers are connected, and o No GAP operations are active (advertise, discover, or connect).
int ble_gatts_svc_set_visibility | ( | uint16_t | handle, |
int | visible | ||
) |
Set visibility of local GATT service. Invisible services are not removed from database but are not discoverable by peer devices. Service Changed should be handled by application when needed by calling ble_svc_gatt_changed().
handle | Handle of service |
visible | non-zero if service should be visible |