Running Speed and Cadence Service (RSCS)

This module implements the Running Speed and Cadence Service with the corresponding set of characteristics defined in the Running Speed and Cadence Service Specification.

The RSCS is used in the Bluetooth: Peripheral Running Speed and Cadence Service (RSCS) sample.

API documentation

Header file: include/bluetooth/services/rscs.h
Source file: subsys/bluetooth/services/rscs.c
group bt_rscs

API for the Running Speed and Cadence Service (RSCS).

Typedefs

typedef void (*bt_rscs_evt_handler)(enum bt_rscs_evt evt)

Running Speed and Cadence Service event handler type.

Enums

enum bt_rscs_location

RSC Sensor Locations.

Values:

enumerator RSC_LOC_OTHER
enumerator RSC_LOC_TOP_OF_SHOE
enumerator RSC_LOC_IN_SHOE
enumerator RSC_LOC_HIP
enumerator RSC_LOC_FRONT_WHEEL
enumerator RSC_LOC_LEFT_CRANK
enumerator RSC_LOC_RIGHT_CRANK
enumerator RSC_LOC_LEFT_PEDAL
enumerator RSC_LOC_RIGHT_PEDAL
enumerator RSC_LOC_FRONT_HUB
enumerator RSC_LOC_REAR_DROPOUT
enumerator RSC_LOC_CHAINSTAY
enumerator RSC_LOC_REAR_WHEEL
enumerator RSC_LOC_REAR_HUB
enumerator RSC_LOC_CHEST
enumerator RSC_LOC_SPIDER
enumerator RSC_LOC_CHAIN_RING
enumerator RSC_LOC_AMT
enum bt_rscs_evt

Running Speed and Cadence Service events.

Values:

enumerator RSCS_EVT_MEAS_NOTIFY_ENABLE

Measurement notification enable.

enumerator RSCS_EVT_MEAS_NOTIFY_DISABLE

Measurement notification disable.

Functions

int bt_rscs_measurement_send(struct bt_conn *conn, const struct bt_rscs_measurement *measurement)

Function for sending Running Speed and Cadence measurement.

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
  • conn – Pointer to connection object, or NULL if sent to all connected peers.

  • measurement – Pointer to new running speed and cadence measurement.

Returns

0 – If the operation was successful. Otherwise, a negative error code is returned.

int bt_rscs_init(const struct bt_rscs_init_params *init)

Function for initializing the Running Speed and Cadence Service.

Parameters
  • init – Initialization parameters.

Returns

0 – If the operation was successful. Otherwise, a negative error code is returned.

struct bt_rsc_supported_loc
#include <rscs.h>

Bitmask set of supported location.

struct bt_rscs_features
#include <rscs.h>

Bitmask set of supported features.

Public Members

uint8_t inst_stride_len

Instantaneous Stride Length Measurement Supported bit.

uint8_t total_distance

Total Distance Measurement Supported bit.

uint8_t walking_or_running

Walking or Running Status Supported bit.

uint8_t sensor_calib_proc

Calibration Procedure Supported bit.

uint8_t multi_sensor_loc

Multiple Sensor Locations Supported bit.

struct bt_rscs_cp_cb
#include <rscs.h>

SC Control Point callback structure.

Public Members

int (*set_cumulative)(uint32_t total_distance)

Set Cumulative Value Procedure.

Parameters
  • total_distance – New value for total distance.

Returns

0 – If the operation was successful. Otherwise, a negative error code is returned.

int (*calibrarion)(void)

Start Sensor Calibration Procedure.

Returns

0 – If the operation was successful. Otherwise, a negative error code is returned.

void (*update_loc)(uint8_t location)

Update Sensor Location Procedure.

Parameters
  • location – New sensor localization value.

struct bt_rscs_init_params
#include <rscs.h>

Running Speed and Cadence Service initialization parameters.

Public Members

struct bt_rscs_features features

Initial value for features of sensor.

struct bt_rsc_supported_loc supported_locations

List of supperted locations

enum bt_rscs_location location

Initial value for sensor location.

bt_rscs_evt_handler evt_handler

Event handler to be called for handling events in the RSC Service.

const struct bt_rscs_cp_cb *cp_cb

SC Control Point callback structure.

struct bt_rscs_measurement
#include <rscs.h>

Running Speed and Cadence Service measurement structure.

Public Members

bool is_inst_stride_len

True if Instantaneous Stride Length is present in the measurement.

bool is_total_distance

True if Total Distance is present in the measurement.

bool is_running

True if running, False if walking.

uint16_t inst_speed

Instantaneous Speed. 256 units = 1 meter/second

uint8_t inst_cadence

Instantaneous Cadence. 1 unit = 1 stride/minute

uint16_t inst_stride_length

Instantaneous Stride Length. 100 units = 1 meter

uint32_t total_distance

Total Distance. 1 unit = 1 meter