| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
Running Speed and Cadence Service Client
BLE Services

## 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_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_rscs_c_t *p_ble_rscs_c, const ble_evt_t *p_ble_evt)
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, const ble_db_discovery_evt_t *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 a 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. These APIs and types can be used by the application to perform discovery of Running Speed and Cadence Service at the peer and interact with it.

Note
  The application must propagate BLE stack events to this module by calling ble_rscs_c_on_ble_evt().

## Macro Definition Documentation

#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 should be provided by the application of this module in order to receive events.

## Enumeration Type Documentation

enum ble_rscs_c_evt_type_t

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 a this instance of rscs_c.

Call this function when a link has been established with a peer to associate this link to this instance of the module. This makes it possible to handle several link and associate each link to a particular instance of this module. The connection handle and attribute handles will be provided from the discovery event BLE_RSCS_C_EVT_DISCOVERY_COMPLETE.

Parameters

  [in] | p_ble_rscs_c | Pointer to the RSC client structure instance to associate.
  [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.

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_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. Otherwise, an error code returned by ble_db_discovery_evt_register.

void ble_rscs_on_db_disc_evt | ( | ble_rscs_c_t * | p_ble_rscs_c,
|  | const ble_db_discovery_evt_t * | p_evt
| ) |  |

Function for handling events from the database discovery module.

Call this function when getting a callback event from the DB discovery modue. This function will handle an event from the database discovery module, and determine if it relates to the discovery of Running Speed and Cadence service at the peer. If so, it will call the application's event handler indicating that the RSC service has been discovered at the peer. It also populates the event with the 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.