Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
sol-gatt.h File Reference

Routines to handle Bluetooth GATT protocol. More...

#include <sol-bluetooth.h>

Go to the source code of this file.

Data Structures

struct  sol_gatt_attr
 Representation of a GATT Attribute. More...
 

Macros

#define SOL_GATT_ATTR_INVALID   { .type = SOL_GATT_ATTR_TYPE_INVALID }
 Terminates the list of attributes. More...
 
#define SOL_GATT_CHARACTERISTIC_UUID_16(_uuid, _flags,...)
 Helper to the construction of a GATT Characteristic with 16-bit UUID. More...
 
#define SOL_GATT_DESCRIPTOR_UUID_16(_uuid, _flags,...)
 Helper to the construction of a GATT Descriptor with 16-bit UUID. More...
 
#define SOL_GATT_SERVICE_UUID_16(service_uuid)
 Helper to the construction of a GATT Service with 16-bit UUID. More...
 

Typedefs

typedef struct sol_gatt_attr sol_gatt_attr
 Representation of a GATT Attribute. More...
 
typedef struct sol_gatt_pending sol_gatt_pending
 Represents a pending request. More...
 

Enumerations

enum  sol_gatt_attr_type { SOL_GATT_ATTR_TYPE_INVALID, SOL_GATT_ATTR_TYPE_SERVICE, SOL_GATT_ATTR_TYPE_CHARACTERISTIC, SOL_GATT_ATTR_TYPE_DESCRIPTOR }
 Set of types of Attributes. More...
 
enum  sol_gatt_chr_flags {
  SOL_GATT_CHR_FLAGS_BROADCAST = (1 << 0), SOL_GATT_CHR_FLAGS_READ = (1 << 1), SOL_GATT_CHR_FLAGS_WRITE_WITHOUT_RESPONSE = (1 << 2), SOL_GATT_CHR_FLAGS_WRITE = (1 << 3),
  SOL_GATT_CHR_FLAGS_NOTIFY = (1 << 4), SOL_GATT_CHR_FLAGS_INDICATE = (1 << 5), SOL_GATT_CHR_FLAGS_AUTHENTICATED_SIGNED_WRITES = (1 << 6), SOL_GATT_CHR_FLAGS_RELIABLE_WRITE = (1 << 7),
  SOL_GATT_CHR_FLAGS_WRITABLE_AUXILIARIES = (1 << 8), SOL_GATT_CHR_FLAGS_ENCRYPT_READ = (1 << 9), SOL_GATT_CHR_FLAGS_ENCRYPT_WRITE = (1 << 10), SOL_GATT_CHR_FLAGS_ENCRYPT_AUTHENTICATED_READ = (1 << 11),
  SOL_GATT_CHR_FLAGS_ENCRYPT_AUTHENTICATED_WRITE = (1 << 12)
}
 Set of flags for Charateristic attributes. More...
 
enum  sol_gatt_desc_flags {
  SOL_GATT_DESC_FLAGS_READ = (1 << 0), SOL_GATT_DESC_FLAGS_WRITE = (1 << 1), SOL_GATT_DESC_FLAGS_ENCRYPT_READ = (1 << 2), SOL_GATT_DESC_FLAGS_ENCRYPT_WRITE = (1 << 3),
  SOL_GATT_DESC_FLAGS_ENCRYPT_AUTHENTICATED_READ = (1 << 4), SOL_GATT_DESC_FLAGS_ENCRYPT_AUTHENTICATED_WRITE = (1 << 5)
}
 Set of flags for Descriptor attributes. More...
 

Functions

int sol_gatt_discover (struct sol_bt_conn *conn, enum sol_gatt_attr_type type, const struct sol_gatt_attr *parent, const struct sol_bt_uuid *uuid, bool(*cb)(void *user_data, struct sol_bt_conn *conn, const struct sol_gatt_attr *attr), const void *user_data)
 Discover attributes by type, restricted by UUID and parent attribute. More...
 
int sol_gatt_indicate (struct sol_bt_conn *conn, const struct sol_gatt_attr *attr)
 Sends an indication to the device represented by conn. More...
 
int sol_gatt_notify (struct sol_bt_conn *conn, const struct sol_gatt_attr *attr)
 Sends a notificatiion to the device represented by conn. More...
 
const struct sol_gatt_attrsol_gatt_pending_get_attr (const struct sol_gatt_pending *op)
 Returns the attribute referenced by a pending operation. More...
 
int sol_gatt_pending_reply (struct sol_gatt_pending *pending, int error, struct sol_buffer *buf)
 Returns a response to an asynchronous operation. More...
 
int sol_gatt_read_attr (struct sol_bt_conn *conn, struct sol_gatt_attr *attr, void(*cb)(void *user_data, bool success, const struct sol_gatt_attr *attr, const struct sol_buffer *buf), const void *user_data)
 Reads the value from a attribute. More...
 
int sol_gatt_register_attributes (struct sol_gatt_attr *attrs)
 Registers attributes into the GATT database. More...
 
int sol_gatt_subscribe (struct sol_bt_conn *conn, const struct sol_gatt_attr *attr, bool(*cb)(void *user_data, const struct sol_gatt_attr *attr, const struct sol_buffer *buffer), const void *user_data)
 Registers a callback to be called when a notification/indication is received. More...
 
int sol_gatt_unregister_attributes (struct sol_gatt_attr *attrs)
 Unregisters attributes from the GATT database. More...
 
int sol_gatt_unsubscribe (bool(*cb)(void *user_data, const struct sol_gatt_attr *attr, const struct sol_buffer *buffer), const void *user_data)
 Unregisters from receiving notifications indications. More...
 
int sol_gatt_write_attr (struct sol_bt_conn *conn, struct sol_gatt_attr *attr, struct sol_buffer *buf, void(*cb)(void *user_data, bool success, const struct sol_gatt_attr *attr), const void *user_data)
 Writes the value to a attribute. More...
 

Detailed Description

Routines to handle Bluetooth GATT protocol.

The Bluetooth Generic Attribute Protocol (GATT) is a lightweight protocol on top of another protocol named ATT (Attribute Protocol), that defines the attribute has a type (UUID), a value, and is indentified by a handle.

The API is based on the BlueZ D-Bus GATT API,

See Also
https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt