PebbleOS
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
Heart rate sharing

Shares heart rate over the BLE Heart Rate Service, with per-device user permission. More...

Macros

#define BLE_HRM_REMINDER_POPUP_DELAY_MINS   (2 * PBL_MIN_PER_HOUR)
 Interval between sharing reminder popups, in minutes.
 

Typedefs

typedef struct BLEHRMSharingRequest BLEHRMSharingRequest
 Opaque pending request for permission to share.
 

Functions

void ble_hrm_handle_sharing_request_response (bool is_granted, BLEHRMSharingRequest *sharing_request)
 Apply the user's answer to a sharing request.
 
bool ble_hrm_is_supported_and_enabled (void)
 Check whether heart rate sharing is possible.
 
bool ble_hrm_is_sharing_to_connection (const GAPLEConnection *connection)
 Check whether heart rate is shared with a connection.
 
bool ble_hrm_is_sharing (void)
 Check whether heart rate is shared with any device.
 
void ble_hrm_revoke_sharing_permission_for_connection (GAPLEConnection *connection)
 Revoke sharing permission for a connection.
 
void ble_hrm_revoke_all (void)
 Revoke sharing permission for all connections, disconnecting them.
 
void ble_hrm_handle_activity_prefs_heart_rate_is_enabled (bool is_enabled)
 Handle a change of the heart rate monitoring preference.
 
void ble_hrm_handle_disconnection (GAPLEConnection *connection)
 Handle an LE disconnection.
 
void ble_hrm_init (void)
 Initialize heart rate sharing when the stack starts.
 
void ble_hrm_deinit (void)
 Stop sharing and forget all permissions when the stack stops.
 

Detailed Description

Shares heart rate over the BLE Heart Rate Service, with per-device user permission.

When a device subscribes, the user is asked for permission. While sharing, the heart rate monitor runs and a reminder popup is shown periodically. Available with CONFIG_SERVICE_BLE_HRM.

Macro Definition Documentation

◆ BLE_HRM_REMINDER_POPUP_DELAY_MINS

#define BLE_HRM_REMINDER_POPUP_DELAY_MINS   (2 * PBL_MIN_PER_HOUR)

Interval between sharing reminder popups, in minutes.

Typedef Documentation

◆ BLEHRMSharingRequest

Opaque pending request for permission to share.

Function Documentation

◆ ble_hrm_deinit()

void ble_hrm_deinit ( void  )

Stop sharing and forget all permissions when the stack stops.

◆ ble_hrm_handle_activity_prefs_heart_rate_is_enabled()

void ble_hrm_handle_activity_prefs_heart_rate_is_enabled ( bool  is_enabled)

Handle a change of the heart rate monitoring preference.

Disabling it ends all sharing.

Parameters
is_enabledNew preference value.

◆ ble_hrm_handle_disconnection()

void ble_hrm_handle_disconnection ( GAPLEConnection *  connection)

Handle an LE disconnection.

If the device was being shared with, briefly advertises the Heart Rate Service to help it reconnect. Permissions are kept. The caller must hold bt_lock().

Parameters
connectionDisconnected connection.

◆ ble_hrm_handle_sharing_request_response()

void ble_hrm_handle_sharing_request_response ( bool  is_granted,
BLEHRMSharingRequest *  sharing_request 
)

Apply the user's answer to a sharing request.

Called by the sharing popup. Frees sharing_request.

Parameters
is_grantedTrue if the user allowed sharing.
sharing_requestThe request being answered.

◆ ble_hrm_init()

void ble_hrm_init ( void  )

Initialize heart rate sharing when the stack starts.

◆ ble_hrm_is_sharing()

bool ble_hrm_is_sharing ( void  )

Check whether heart rate is shared with any device.

Returns
True if sharing.

◆ ble_hrm_is_sharing_to_connection()

bool ble_hrm_is_sharing_to_connection ( const GAPLEConnection *  connection)

Check whether heart rate is shared with a connection.

The caller must hold bt_lock().

Parameters
connectionLE connection, may be NULL.
Returns
True if subscribed and permitted.

◆ ble_hrm_is_supported_and_enabled()

bool ble_hrm_is_supported_and_enabled ( void  )

Check whether heart rate sharing is possible.

Returns
True if the stack and hardware support it and heart rate monitoring is enabled.

◆ ble_hrm_revoke_all()

void ble_hrm_revoke_all ( void  )

Revoke sharing permission for all connections, disconnecting them.

◆ ble_hrm_revoke_sharing_permission_for_connection()

void ble_hrm_revoke_sharing_permission_for_connection ( GAPLEConnection *  connection)

Revoke sharing permission for a connection.

Disconnects the link, since the server cannot remove a client's subscription.

Parameters
connectionLE connection.