nRF5 SDK v17.1.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
Running Speed and Cadence Service Client

Modules

 Running Speed and Cadence Client configuration
 

Data Structures

struct  ble_rscs_c_db_t
 Structure containing the handles related to the Running Speed and Cadence Service found on the peer. More...
 
struct  ble_rsc_t
 Structure containing the Running Speed and Cadence measurement received from the peer. More...
 
struct  ble_rscs_c_evt_t
 Running Speed and Cadence Event structure. More...
 
struct  ble_rscs_c_s
 Running Speed and Cadence client structure. More...
 
struct  ble_rscs_c_init_t
 Running Speed and Cadence client initialization structure. More...
 

Macros

#define BLE_RSCS_C_DEF(_name)
 Macro for defining a ble_rscs_c instance. More...
 
#define BLE_RSCS_C_ARRAY_DEF(_name, _cnt)
 Macro for defining multiple ble_rscs_c instances. More...
 
#define BLE_RSCS_INSTANT_STRIDE_LEN_PRESENT   0x00
 
#define BLE_RSCS_TOTAL_DISTANCE_PRESENT   0x01
 
#define BLE_RSCS_WALKING_OR_RUNNING_STATUS_BIT   0x02
 

Typedefs

typedef struct ble_rscs_c_s ble_rscs_c_t
 
typedef void(* ble_rscs_c_evt_handler_t )(ble_rscs_c_t *p_ble_rscs_c, ble_rscs_c_evt_t *p_evt)
 Event handler type. More...
 

Enumerations

enum  ble_rscs_c_evt_type_t {
  BLE_RSCS_C_EVT_DISCOVERY_COMPLETE = 1,
  BLE_RSCS_C_EVT_RSC_NOTIFICATION
}
 RSCS Client event type. More...
 

Functions

uint32_t ble_rscs_c_init (ble_rscs_c_t *p_ble_rscs_c, ble_rscs_c_init_t *p_ble_rscs_c_init)
 Function for initializing the Running Speed and Cadence Service Client module. More...
 
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. More...
 
uint32_t ble_rscs_c_rsc_notif_enable (ble_rscs_c_t *p_ble_rscs_c)
 
void ble_rscs_on_db_disc_evt (ble_rscs_c_t *p_ble_rscs_c, ble_db_discovery_evt_t const *p_evt)
 Function for handling events from the Database Discovery module. More...
 
uint32_t ble_rscs_c_handles_assign (ble_rscs_c_t *p_ble_rscs_c, uint16_t conn_handle, ble_rscs_c_db_t *p_peer_handles)
 Function for assigning handles to this instance of rscs_c. More...
 

Detailed Description

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:

Macro Definition Documentation

#define BLE_RSCS_C_ARRAY_DEF (   _name,
  _cnt 
)

Macro for defining multiple ble_rscs_c instances.

Parameters
_nameName of the array of instances.
_cntNumber of instances to define.
#define BLE_RSCS_C_DEF (   _name)

Macro for defining a ble_rscs_c instance.

Parameters
_nameName 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.

Typedef Documentation

typedef void(* ble_rscs_c_evt_handler_t)(ble_rscs_c_t *p_ble_rscs_c, ble_rscs_c_evt_t *p_evt)

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.

Enumeration Type Documentation

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 Documentation

uint32_t ble_rscs_c_handles_assign ( ble_rscs_c_t p_ble_rscs_c,
uint16_t  conn_handle,
ble_rscs_c_db_t p_peer_handles 
)

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_cPointer to the RSC client structure instance for associating the link.
[in]conn_handleConnection handle to associated with the given RSCS Client Instance.
[in]p_peer_handlesAttribute handles on the RSCS server that you want this RSCS client to interact with.
uint32_t ble_rscs_c_init ( ble_rscs_c_t p_ble_rscs_c,
ble_rscs_c_init_t p_ble_rscs_c_init 
)

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_cPointer to the RSC Service Client structure.
[in]p_ble_rscs_c_initPointer to the RSC Service initialization structure containing the initialization information.
Return values
NRF_SUCCESSOperation success.
NRF_ERROR_NULLA parameter is NULL.
err_codeOtherwise, 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_evtEvent received from the BLE stack.
[in]p_contextRunning Speed and Cadence Service Client structure.
void ble_rscs_on_db_disc_evt ( ble_rscs_c_t p_ble_rscs_c,
ble_db_discovery_evt_t const *  p_evt 
)

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_cPointer to the Runnind Speed and Cadence Service Client structure.
[in]p_evtPointer to the event received from the Database Discovery module.

Documentation feedback | Developer Zone | Subscribe | Updated