This module contains the APIs and types exposed by the Running Speed and Cadence Service Client module. The application can use these APIs and types to perform discovery of Running Speed and Cadence Service at the peer and interact with it.
- Note
- The application must register this module as BLE event observer by using the NRF_SDH_BLE_OBSERVER macro. Example:
#define BLE_RSCS_C_ARRAY_DEF |
( |
|
_name, |
|
|
|
_cnt |
|
) |
| |
Macro for defining multiple ble_rscs_c instances.
- Parameters
-
_name | Name of the array of instances. |
_cnt | Number of instances to define. |
#define BLE_RSCS_C_DEF |
( |
|
_name | ) |
|
Macro for defining a ble_rscs_c instance.
- Parameters
-
_name | Name of the instance. |
#define BLE_RSCS_INSTANT_STRIDE_LEN_PRESENT 0x00 |
Instantaneous Stride Length Measurement Supported bit.
#define BLE_RSCS_TOTAL_DISTANCE_PRESENT 0x01 |
Total Distance Measurement Supported bit.
#define BLE_RSCS_WALKING_OR_RUNNING_STATUS_BIT 0x02 |
Walking or Running Status Supported bit.
Event handler type.
This is the type of the event handler that is to be provided by the application of this module in order to receive events.
RSCS Client event type.
Enumerator |
---|
BLE_RSCS_C_EVT_DISCOVERY_COMPLETE |
Event indicating that the Running Speed and Cadence Service has been discovered at the peer.
|
BLE_RSCS_C_EVT_RSC_NOTIFICATION |
Event indicating that a notification of the Running Speed and Cadence measurement characteristic has been received from the peer.
|
Function for assigning handles to this instance of rscs_c.
Call this function when a link has been established with a peer to associate the link to this instance of the module. This makes it possible to handle several links and associate each link to a particular instance of this module. The connection handle and attribute handles are provided from the discovery event BLE_RSCS_C_EVT_DISCOVERY_COMPLETE.
- Parameters
-
[in] | p_ble_rscs_c | Pointer to the RSC client structure instance for associating the link. |
[in] | conn_handle | Connection handle to associated with the given RSCS Client Instance. |
[in] | p_peer_handles | Attribute handles on the RSCS server that you want this RSCS client to interact with. |
Function for initializing the Running Speed and Cadence Service Client module.
This function will initialize the module and set up Database Discovery to discover the Running Speed and Cadence Service. After calling this function, call ble_db_discovery_start to start discovery once a link with a peer has been established.
- Parameters
-
[out] | p_ble_rscs_c | Pointer to the RSC Service Client structure. |
[in] | p_ble_rscs_c_init | Pointer to the RSC Service initialization structure containing the initialization information. |
- Return values
-
NRF_SUCCESS | Operation success. |
NRF_ERROR_NULL | A parameter is NULL. |
err_code | Otherwise, this function propagates the error code returned by ble_db_discovery_evt_register. |
void ble_rscs_c_on_ble_evt |
( |
ble_evt_t const * |
p_ble_evt, |
|
|
void * |
p_context |
|
) |
| |
Function for handling the Application's BLE Stack events.
Handles all events from the BLE stack that are of interest to the Running Speed and Cadence Service Client.
- Parameters
-
[in] | p_ble_evt | Event received from the BLE stack. |
[in] | p_context | Running Speed and Cadence Service Client structure. |
Function for handling events from the Database Discovery module.
Call this function when you get a callback event from the Database Discovery module. This function handles an event from the Database Discovery module, and determines whether it relates to the discovery of Running Speed and Cadence Service at the peer. If it does, the function calls the application's event handler to indicate that the RSC Service was discovered at the peer. The function also populates the event with service-related information before providing it to the application.
- Parameters
-
| p_ble_rscs_c | Pointer to the Runnind Speed and Cadence Service Client structure. |
[in] | p_evt | Pointer to the event received from the Database Discovery module. |