PebbleOS
Loading...
Searching...
No Matches
Functions
Reversed PPoGATT

Reversed PPoGATT service: the watch hosts the service and the phone is the GATT client. More...

Functions

void pbl_bt_cb_ppog_reversed_subscribed (const struct pbl_bt_device_internal *device, uint16_t conn_handle)
 Called when the phone enabled notifications on the data characteristic.
 
void pbl_bt_cb_ppog_reversed_unsubscribed (uint16_t conn_handle)
 Called when the phone disabled notifications or disconnected.
 
void pbl_bt_cb_ppog_reversed_data_written (uint16_t conn_handle, uint8_t *buf, uint16_t len)
 Called when the phone wrote a PPoGATT packet to the data write characteristic.
 
enum pbl_bt_errno pbl_bt_ppog_reversed_notify (uint16_t conn_handle, const uint8_t *buf, uint16_t len)
 Send a PPoGATT packet to the phone as a notification.
 

Detailed Description

Reversed PPoGATT service: the watch hosts the service and the phone is the GATT client.

The service has a data characteristic the watch notifies and a data write characteristic the phone writes without response, both requiring an encrypted link. The pbl_bt_cb_ppog_reversed_* callbacks run on the NimBLE host task without bt_lock() held.

enum pbl_bt_errno err = pbl_bt_ppog_reversed_notify(conn_handle, pkt, pkt_len);
// No buffer-freed event exists: retry from a timer.
}
enum pbl_bt_errno pbl_bt_ppog_reversed_notify(uint16_t conn_handle, const uint8_t *buf, uint16_t len)
Send a PPoGATT packet to the phone as a notification.
pbl_bt_errno
Bluetooth error codes.
Definition types.h:28
@ PBL_BT_ERRNO_NOT_ENOUGH_RESOURCES
The system did not have enough resources for the operation.
Definition types.h:54

Function Documentation

◆ pbl_bt_cb_ppog_reversed_data_written()

void pbl_bt_cb_ppog_reversed_data_written ( uint16_t  conn_handle,
uint8_t *  buf,
uint16_t  len 
)
extern

Called when the phone wrote a PPoGATT packet to the data write characteristic.

Parameters
conn_handleConnection handle.
bufThe packet, on the kernel heap. Ownership passes to the callee.
lenLength of buf in bytes, never 0.

◆ pbl_bt_cb_ppog_reversed_subscribed()

void pbl_bt_cb_ppog_reversed_subscribed ( const struct pbl_bt_device_internal *  device,
uint16_t  conn_handle 
)
extern

Called when the phone enabled notifications on the data characteristic.

Parameters
deviceThe phone.
conn_handleConnection handle, to pass to pbl_bt_ppog_reversed_notify().

◆ pbl_bt_cb_ppog_reversed_unsubscribed()

void pbl_bt_cb_ppog_reversed_unsubscribed ( uint16_t  conn_handle)
extern

Called when the phone disabled notifications or disconnected.

Parameters
conn_handleConnection handle.

◆ pbl_bt_ppog_reversed_notify()

enum pbl_bt_errno pbl_bt_ppog_reversed_notify ( uint16_t  conn_handle,
const uint8_t *  buf,
uint16_t  len 
)

Send a PPoGATT packet to the phone as a notification.

Parameters
conn_handleConnection handle.
bufThe packet. Copied during the call.
lenLength of buf in bytes.
Return values
PBL_BT_ERRNO_OKSent.
PBL_BT_ERRNO_NOT_ENOUGH_RESOURCESOut of buffers. Transient: retry after a short delay, the stack has no buffers-freed event.
PBL_BT_ERRNO_INVALID_STATENot connected.
Returns
PBL_BT_ERRNO_INTERNAL_ERROR_BEGIN plus the backend error code on other failures.