nRF51 SDK: Running Speed and Cadence Service

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

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

Running Speed and Cadence Service module. More...

## Data Structures

struct | ble_rscs_evt_t
| Running Speed and Cadence Service event. More...
struct | ble_rscs_init_t
| Running Speed and Cadence Service init structure. This contains all options and data needed for initialization of the service. More...
struct | ble_rscs_s
| Running Speed and Cadence Service structure. This contains various status information for the service. More...
struct | ble_rscs_meas_s
| Running Speed and Cadence Service measurement structure. This contains a Running Speed and Cadence measurement. More...

## Macros

#define | BLE_RSCS_FEATURE_INSTANT_STRIDE_LEN_BIT (0x01 << 0)
| Running Speed and Cadence Service feature bits. More...
#define | BLE_RSCS_FEATURE_TOTAL_DISTANCE_BIT (0x01 << 1)
#define | BLE_RSCS_FEATURE_WALKING_OR_RUNNING_STATUS_BIT (0x01 << 2)
#define | BLE_RSCS_FEATURE_CALIBRATION_PROCEDURE_BIT (0x01 << 3)
#define | BLE_RSCS_FEATURE_MULTIPLE_SENSORS_BIT (0x01 << 4)

## Typedefs

typedef struct ble_rscs_s | ble_rscs_t
| Running Speed and Cadence Service structure. This contains various status information for the service.
typedef void(* | ble_rscs_evt_handler_t )(ble_rscs_t *p_rscs, ble_rscs_evt_t *p_evt)
| Running Speed and Cadence Service event handler type.
typedef struct ble_rscs_meas_s | ble_rscs_meas_t
| Running Speed and Cadence Service measurement structure. This contains a Running Speed and Cadence measurement.

## Enumerations

enum | ble_rscs_evt_type_t { BLE_RSCS_EVT_NOTIFICATION_ENABLED, BLE_RSCS_EVT_NOTIFICATION_DISABLED }
| Running Speed and Cadence Service event type. More...

## Functions

uint32_t | ble_rscs_init (ble_rscs_t *p_rscs, const ble_rscs_init_t *p_rscs_init)
| Function for initializing the Running Speed and Cadence Service. More...
void | ble_rscs_on_ble_evt (ble_rscs_t *p_rscs, ble_evt_t *p_ble_evt)
| Function for handling the Application's BLE Stack events. More...
uint32_t | ble_rscs_measurement_send (ble_rscs_t *p_rscs, ble_rscs_meas_t *p_measurement)
| Function for sending running speed and cadence measurement if notification has been enabled. More...

## Detailed Description

Running Speed and Cadence Service module.

This module implements the Running Speed and Cadence Service. If enabled, notification of the Running Speead and Candence Measurement is performed when the application calls ble_rscs_measurement_send().

If an event handler is supplied by the application, the Running Speed and Cadence Service will generate Running Speed and Cadence Service events to the application.

Note
  The application must propagate BLE stack events to the Running Speead and Candence Service module by calling ble_rscs_on_ble_evt() from the from the ble_stack_handler function.
  Attention! To maintain compliance with Nordic Semiconductor ASA Bluetooth profile qualification listings, this section of source code must not be modified.

## Macro Definition Documentation

#define BLE_RSCS_FEATURE_CALIBRATION_PROCEDURE_BIT (0x01 << 3)

Calibration Procedure Supported bit.

#define BLE_RSCS_FEATURE_INSTANT_STRIDE_LEN_BIT (0x01 << 0)

Running Speed and Cadence Service feature bits.

Instantaneous Stride Length Measurement Supported bit.

#define BLE_RSCS_FEATURE_MULTIPLE_SENSORS_BIT (0x01 << 4)

Multiple Sensor Locations Supported bit.

#define BLE_RSCS_FEATURE_TOTAL_DISTANCE_BIT (0x01 << 1)

Total Distance Measurement Supported bit.

#define BLE_RSCS_FEATURE_WALKING_OR_RUNNING_STATUS_BIT (0x01 << 2)

Walking or Running Status Supported bit.

## Enumeration Type Documentation

enum ble_rscs_evt_type_t

Running Speed and Cadence Service event type.

Enumerator
BLE_RSCS_EVT_NOTIFICATION_ENABLED | Running Speed and Cadence value notification enabled event.
BLE_RSCS_EVT_NOTIFICATION_DISABLED | Running Speed and Cadence value notification disabled event.

## Function Documentation

uint32_t ble_rscs_init | ( | ble_rscs_t * | p_rscs,
|  | const ble_rscs_init_t * | p_rscs_init
| ) |  |

Function for initializing the Running Speed and Cadence Service.

Parameters

  [out] | p_rscs | Running Speed and Cadence Service structure. This structure will have to be supplied by the application. It will be initialized by this function, and will later be used to identify this particular service instance.
  [in] | p_rscs_init | Information needed to initialize the service.

Returns
  NRF_SUCCESS on successful initialization of service, otherwise an error code.

uint32_t ble_rscs_measurement_send | ( | ble_rscs_t * | p_rscs,
|  | ble_rscs_meas_t * | p_measurement
| ) |  |

Function for sending running speed and cadence measurement if notification has been enabled.

The application calls this function after having performed a Running Speed and Cadence measurement. If notification has been enabled, the measurement data is encoded and sent to the client.

Parameters

  [in] | p_rscs | Running Speed and Cadence Service structure.
  [in] | p_measurement | Pointer to new running speed and cadence measurement.

Returns
  NRF_SUCCESS on success, otherwise an error code.

void ble_rscs_on_ble_evt | ( | ble_rscs_t * | p_rscs,
|  | ble_evt_t * | p_ble_evt
| ) |  |

Function for handling the Application's BLE Stack events.

Handles all events from the BLE stack of interest to the Running Speed and Cadence Service.

Parameters

  [in] | p_rscs | Running Speed and Cadence Service structure.
  [in] | p_ble_evt | Event received from the BLE stack.