PebbleOS v4.47.0-505-g4bbc630fa
Loading...
Searching...
No Matches
gatt.h File Reference
#include <stdint.h>
#include <pbl/kernel/section.h>
#include <pbl/util/size.h>
#include <host/ble_uuid.h>

Data Structures

struct  pbl_bt_gattc_chr
 A characteristic found by pbl_bt_gattc_discover(). More...
 
struct  pbl_bt_gattc_service_cb
 What a service client reports; any may be null. More...
 
struct  pbl_bt_gattc_service
 A client of one service of one connection at a time. More...
 
struct  pbl_bt_gattc_notify_listener
 A listener of the notifications and indications of peers. More...
 

Macros

#define PBL_BT_GATTC_SERVICE_DEFINE(_name, _svc_uuid, _chr_uuids, _optional, _notifying)
 Define a service client.
 
#define PBL_BT_GATTC_NOTIFY_LISTENER_DEFINE(_name, _fn)
 Define a listener of the notifications and indications of peers.
 

Typedefs

typedef void(* pbl_bt_gattc_discover_cb_t) (uint16_t conn_handle, int status, const struct pbl_bt_gattc_chr *chrs, void *arg)
 Called when pbl_bt_gattc_discover() is done, on the host task.
 

Functions

int pbl_bt_gattc_discover (uint16_t conn_handle, const ble_uuid_t *svc_uuid, const ble_uuid_t *const *chr_uuids, uint8_t num_chrs, pbl_bt_gattc_discover_cb_t cb, void *arg)
 Find a service of the peer and characteristics of it.
 
int pbl_bt_gattc_service_start (struct pbl_bt_gattc_service *svc, uint16_t conn_handle, const struct pbl_bt_gattc_service_cb *cb)
 Look for the service on a connection.
 
int pbl_bt_gattc_service_rediscover (struct pbl_bt_gattc_service *svc)
 Look for the service again, as when the peer says its services changed.
 
void pbl_bt_gattc_service_stop (struct pbl_bt_gattc_service *svc)
 Forget the service and the connection.
 
int pbl_bt_gattc_service_subscribe (struct pbl_bt_gattc_service *svc, uint8_t chr, bool enable)
 Subscribe to the notifications of a characteristic, or unsubscribe.
 
int pbl_bt_gattc_service_write (struct pbl_bt_gattc_service *svc, uint8_t chr, const void *data, uint16_t len)
 Write the value of a characteristic.
 
int pbl_bt_gattc_service_read (struct pbl_bt_gattc_service *svc, uint8_t chr)
 Read the value of a characteristic, all of it however long.
 
bool pbl_bt_gattc_service_notify_rx (struct pbl_bt_gattc_service *svc, uint16_t conn_handle, uint16_t attr_handle, struct os_mbuf *om)
 Take a notification or indication if it is of a characteristic of the service.
 
bool pbl_bt_gattc_notify_rx (uint16_t conn_handle, uint16_t attr_handle, struct os_mbuf *om)
 Offer a notification or indication of a peer to the listeners.