Generic Attribute Profile (GATT)

GATT functions. More...

Data Structures

struct  zos_gatt_group_handle_t
 GATT group handle. More...
 
struct  zos_gatt_service_t
 GATT Service. More...
 
struct  zos_gatt_include_t
 GATT Include (Included Service) More...
 
struct  zos_gatt_characteristic_t
 GATT Characteristic. More...
 
struct  zos_gatt_descriptor_t
 GATT Descriptor. More...
 
struct  zos_gatt_attribute_t
 GATT Attribute. More...
 
struct  zos_gatt_discover_characteristic_parameters_t
 GATT discover characteristic parameters. More...
 
struct  zos_gatt_write_parameters_t
 GATT write parameters. More...
 

Typedefs

typedef void(* zos_gatt_service_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_service_t *service, void *arg)
 GATT service discovery callback. More...
 
typedef void(* zos_gatt_characteristic_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_characteristic_t *characteristic, void *arg)
 GATT characteristic discovery callback. More...
 
typedef void(* zos_gatt_descriptor_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_descriptor_t *descriptor, void *arg)
 GATT descriptor discovery callback. More...
 
typedef void(* zos_gatt_include_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_include_t *include, void *arg)
 GATT include discovery callback. More...
 
typedef void(* zos_gatt_read_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_attribute_t *attribute, void *arg)
 GATT read callback. More...
 
typedef void(* zos_gatt_write_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, uint16_t value_handle, void *arg)
 GATT write callback. More...
 
typedef void(* zos_gatt_notification_callback_t) (zos_ble_connection_t connection, const zos_gatt_attribute_t *attribute, void *arg)
 GATT notification callback. More...
 

Enumerations

enum  zos_gatt_status_t
 GATT status code.
 

Functions

zos_result_t zn_gatt_register_notification_callback (zos_ble_connection_t connection, zos_gatt_notification_callback_t callback, void *arg)
 Register GATT notification callback. More...
 
void zn_gatt_stop_discover (zos_ble_connection_t connection)
 Stop discover procedure. More...
 
zos_result_t zn_gatt_discover_all_primary_services (zos_ble_connection_t connection, zos_gatt_service_callback_t callback, void *arg)
 Discover all Primary Services. More...
 
zos_result_t zn_gatt_discover_primary_services_by_uuid (zos_ble_connection_t connection, const zos_bt_uuid_t *uuid, zos_gatt_service_callback_t callback, void *arg)
 Discover all Primary Services with the given UUID. More...
 
zos_result_t zn_gatt_find_included_services (zos_ble_connection_t connection, const zos_gatt_service_t *service, zos_gatt_include_callback_t callback, void *arg)
 Find Included Services. More...
 
zos_result_t zn_gatt_discover_characteristics (zos_ble_connection_t connection, const zos_gatt_service_t *service, zos_gatt_characteristic_callback_t callback, void *arg)
 Discover all Characteristics of a Service. More...
 
zos_result_t zn_gatt_discover_characteristics_by_uuid (zos_ble_connection_t connection, const zos_gatt_discover_characteristic_parameters_t *parameters, zos_gatt_characteristic_callback_t callback, void *arg)
 Discover all characteristics with specific UUID in a service. More...
 
zos_result_t zn_gatt_discover_descriptors (zos_ble_connection_t connection, const zos_gatt_characteristic_t *characteristic, zos_gatt_descriptor_callback_t callback, void *arg)
 Discover all descriptors of a characteristic. More...
 
zos_result_t zn_gatt_read (zos_ble_connection_t connection, uint16_t value_handle, zos_gatt_read_callback_t callback, void *arg)
 Read attribute value. More...
 
zos_result_t zn_gatt_write (zos_ble_connection_t connection, const zos_gatt_write_parameters_t *parameters, zos_gatt_write_callback_t callback, void *arg)
 Write attribute value. More...
 

Detailed Description

GATT functions.

Typedef Documentation

typedef void(* zos_gatt_characteristic_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_characteristic_t *characteristic, void *arg)

GATT characteristic discovery callback.

Called when a characteristic is found.

typedef void(* zos_gatt_descriptor_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_descriptor_t *descriptor, void *arg)

GATT descriptor discovery callback.

Called when a descriptor is found.

typedef void(* zos_gatt_include_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_include_t *include, void *arg)

GATT include discovery callback.

Called when a include is found.

typedef void(* zos_gatt_notification_callback_t) (zos_ble_connection_t connection, const zos_gatt_attribute_t *attribute, void *arg)

GATT notification callback.

Called when a GATT notification is received.

typedef void(* zos_gatt_read_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_attribute_t *attribute, void *arg)

GATT read callback.

Called when a GATT read operation is issued.

typedef void(* zos_gatt_service_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, const zos_gatt_service_t *service, void *arg)

GATT service discovery callback.

Called when a service is found.

typedef void(* zos_gatt_write_callback_t) (zos_ble_connection_t connection, zos_gatt_status_t status, uint16_t value_handle, void *arg)

GATT write callback.

Called when a GATT write operation is issued.

Function Documentation

zos_result_t zn_gatt_discover_all_primary_services ( zos_ble_connection_t  connection,
zos_gatt_service_callback_t  callback,
void *  arg 
)

Discover all Primary Services.

Parameters
[in]connectionBLE connection handle
[in]callbackCallback function that will be called when a Primary Service is found. A NULL service will be passed when discovery is complete.
[in]argArgument that will be passed to the callback
Returns
zos_result_t result of api call
zos_result_t zn_gatt_discover_characteristics ( zos_ble_connection_t  connection,
const zos_gatt_service_t service,
zos_gatt_characteristic_callback_t  callback,
void *  arg 
)

Discover all Characteristics of a Service.

Parameters
[in]connectionBLE connection handle
[in]serviceService which Characteristics will be discovered
[in]callbackCallback function that will be called when a Characteristic is found. A NULL characteristic will be passed when discovery is complete.
[in]argArgument that will be passed to the callback
Returns
zos_result_t result of api call
zos_result_t zn_gatt_discover_characteristics_by_uuid ( zos_ble_connection_t  connection,
const zos_gatt_discover_characteristic_parameters_t parameters,
zos_gatt_characteristic_callback_t  callback,
void *  arg 
)

Discover all characteristics with specific UUID in a service.

Parameters
[in]connectionBLE connection handle
[in]parametersDiscovery parameters
[in]callbackCallback function that will be called when a Characteristic is found. A NULL characteristic will be passed when discovery is complete.
[in]argArgument that will be passed to the callback
Returns
zos_result_t result of api call
zos_result_t zn_gatt_discover_descriptors ( zos_ble_connection_t  connection,
const zos_gatt_characteristic_t characteristic,
zos_gatt_descriptor_callback_t  callback,
void *  arg 
)

Discover all descriptors of a characteristic.

Parameters
[in]connectionBLE connection handle
[in]characteristicCharacteristic which descriptors will be discovered
[in]callbackCallback function that will be called when a descriptor is found. A NULL descriptor will be passed when discovery is complete.
[in]argArgument that will be passed to the callback
Returns
zos_result_t result of api call
zos_result_t zn_gatt_discover_primary_services_by_uuid ( zos_ble_connection_t  connection,
const zos_bt_uuid_t uuid,
zos_gatt_service_callback_t  callback,
void *  arg 
)

Discover all Primary Services with the given UUID.

Parameters
[in]connectionBLE connection handle
[in]uuidUUID of the primary service to find
[in]callbackCallback function that will be called when a Primary Service with the given UUID is found. A NULL service will be passed when discovery is complete.
[in]argArgument that will be passed to the callback
Returns
zos_result_t result of api call
zos_result_t zn_gatt_find_included_services ( zos_ble_connection_t  connection,
const zos_gatt_service_t service,
zos_gatt_include_callback_t  callback,
void *  arg 
)

Find Included Services.

Parameters
[in]connectionBLE connection handle
[in]serviceService in which the Included Services will be found
[in]callbackCallback function that will be called when an Included Service is found. A NULL service will be passed when discovery is complete.
[in]argArgument that will be passed to the callback
Returns
zos_result_t result of api call
zos_result_t zn_gatt_read ( zos_ble_connection_t  connection,
uint16_t  value_handle,
zos_gatt_read_callback_t  callback,
void *  arg 
)

Read attribute value.

Parameters
[in]connectionBLE connection handle
[in]value_handleAttribute value handle
[in]callbackCallback function that will be called when the read operation is complete
[in]argArgument that will be passed to the callback
Returns
zos_result_t result of api call
zos_result_t zn_gatt_register_notification_callback ( zos_ble_connection_t  connection,
zos_gatt_notification_callback_t  callback,
void *  arg 
)

Register GATT notification callback.

Warning
The notification callback runs in the Bluetooth thread context. The ZAP that receives notification via this callback must inspect the data quickly and return. If further processing is required, it shall be deferred to the ZAP thread. Any extended operation executed in this callback may impact the overall system stability.
Parameters
[in]connectionBLE connection
[in]callbackCallback function that will be called when a GATT notification is received
[in]argArgument that will be passed to the notification callback
Returns
zos_result_t result of api call
void zn_gatt_stop_discover ( zos_ble_connection_t  connection)

Stop discover procedure.

Parameters
[in]connectionBLE connection handle
Returns
zos_result_t result of api call
zos_result_t zn_gatt_write ( zos_ble_connection_t  connection,
const zos_gatt_write_parameters_t parameters,
zos_gatt_write_callback_t  callback,
void *  arg 
)

Write attribute value.

Parameters
[in]connectionBLE connection handle
[in]parametersWrite parameters
[in]callbackCallback function that will be called when the write operation is complete
[in]argArgument that will be passed to the callback
Returns
zos_result_t result of api call