Running Speed and Cadence Service (RSCS)
This library 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
include/bluetooth/services/rscs.h
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
-
enumerator RSC_LOC_OTHER
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 – [in] Pointer to connection object, or NULL if sent to all connected peers.
measurement – [in] Pointer to new running speed and cadence measurement.
- Return values:
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 – [in] Initialization parameters.
- Return values:
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.
-
uint8_t inst_stride_len
-
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.
- Param total_distance:
New value for total distance.
- Retval 0:
If the operation was successful. Otherwise, a negative error code is returned.
-
int (*calibration)(void)
Start Sensor Calibration Procedure.
- Retval 0:
If the operation was successful. Otherwise, a negative error code is returned.
-
void (*update_loc)(uint8_t location)
Update Sensor Location Procedure.
- Param location:
New sensor localization value.
-
int (*set_cumulative)(uint32_t total_distance)
-
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 supported 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_features features
-
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
-
bool is_inst_stride_len
-
typedef void (*bt_rscs_evt_handler)(enum bt_rscs_evt evt)