What the GATT services of the device share.
More...
What the GATT services of the device share.
◆ PBL_BT_GATTS_SERVICE_DEFINE
| #define PBL_BT_GATTS_SERVICE_DEFINE |
( |
|
_name, |
|
|
|
_order, |
|
|
|
_add |
|
) |
| |
Value:
#define PBL_ITERABLE_SECTION(type, tag, key)
Add the object to an iterable section, a table gathered at link time from any file.
Definition section.h:144
A service of the device.
Definition gatts.h:20
int(* add)(void)
Add the service to the GATT server, e.g.
Definition gatts.h:26
Define a service of the device, added by pbl_bt_gatts_add_services().
Services are added by increasing order, which sets their attribute handles. Peers cache the handles of a bonded device, so the order of services that shipped must not change.
- Parameters
-
| _name | Name of the service. |
| _order | Two digits that place it among the others. |
| _add | Its function, see struct pbl_bt_gatts_service. |
◆ pbl_bt_gatts_add()
| int pbl_bt_gatts_add |
( |
const struct ble_gatt_svc_def * |
svcs | ) |
|
Add services to the GATT server, before the host starts.
- Parameters
-
| svcs | The services, ended by an empty one. They must outlive the server. |
- Returns
- 0 on success, negative errno otherwise.
◆ pbl_bt_gatts_add_services()
| int pbl_bt_gatts_add_services |
( |
void |
| ) |
|
Add the services defined with PBL_BT_GATTS_SERVICE_DEFINE(), before the host starts.
- Returns
- 0 on success, or what the first service that failed returned.
◆ pbl_bt_gatts_notify()
| int pbl_bt_gatts_notify |
( |
uint16_t |
conn_handle, |
|
|
uint16_t |
attr_handle, |
|
|
const void * |
data, |
|
|
uint16_t |
len |
|
) |
| |
Notify a value to a peer, subscribed or not.
- Parameters
-
| conn_handle | Connection. |
| attr_handle | Handle of the characteristic value. |
| data | The value. |
| len | Its length. |
- Returns
- 0 on success, -ENOMEM if there is no buffer for it now, -ENOTCONN if the connection is gone, another negative errno otherwise.