Speed and Cadence Control Point

nRF5 SDK v13.0.0

Speed and Cadence Control Point module. More...

Data Structures

struct ble_sc_ctrlpt_evt_t
Speed and Cadence Control point event. More...
struct ble_sc_ctrlpt_val_t
struct ble_sc_ctrlpt_rsp_t
struct ble_cs_ctrlpt_init_t
Speed and Cadence Control Point init structure. This contains all options and data needed for initialization of the Speed and Cadence Control Point module. More...
struct ble_sc_ctrlpt_resp_t
Speed and Cadence Control Point response indication structure. More...
struct ble_sc_ctrlpt_s
Speed and Cadence Control Point structure. This contains various status information for the Speed and Cadence Control Point behavior. More...

Typedefs

typedef struct ble_sc_ctrlpt_s ble_sc_ctrlpt_t
typedef ble_scpt_response_t (* ble_sc_ctrlpt_evt_handler_t )( ble_sc_ctrlpt_t *p_sc_ctrlpt, ble_sc_ctrlpt_evt_t *p_evt)
Speed and Cadence Control point event handler type.

Functions

uint32_t ble_sc_ctrlpt_init ( ble_sc_ctrlpt_t *p_sc_ctrlpt, const ble_cs_ctrlpt_init_t *p_sc_ctrlpt_init)
Function for Initializing the Speed and Cadence Control Point. More...
uint32_t ble_sc_ctrlpt_rsp_send ( ble_sc_ctrlpt_t *p_sc_ctrlpt, ble_scpt_response_t response_status)
Function for sending a control point response. More...
void ble_sc_ctrlpt_on_ble_evt ( ble_sc_ctrlpt_t *p_sc_ctrlpt, ble_evt_t *p_ble_evt)
Speed and Cadence Control Point BLE stack event handler. More...

Detailed Description

Speed and Cadence Control Point module.

This module implements the Speed and Cadence control point behavior. It is used by the Cycling Speed and Cadence Service module and the ble_sdk_srv_rsc module for control point mechanisms like setting a cumulative value, Start an automatic calibration, Update the sensor location or request the supported locations.

Note
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_SC_CTRLPT_MAX_LEN   19

maximum lenght for Speed and cadence control point characteristic value.

#define BLE_SC_CTRLPT_MIN_LEN   1

minimum length for Speed and cadence control point characteristic value.

#define SCPT_MAX_RESPONSE_SIZE   ( SCPT_MIN_RESPONSE_SIZE + NB_MAX_SENSOR_LOCATIONS)

Maximum size for control point response.

#define SCPT_MIN_RESPONSE_SIZE   3

Minimum size for control point response.

#define SCPT_OPCODE_POS   0

Request opcode position.

#define SCPT_PARAMETER_POS   1

Request parameter position.

#define SCPT_RESPONSE_CODE_POS   2

Response position of response code.

#define SCPT_RESPONSE_PARAMETER   3

Response position of response parameter.

#define SCPT_RESPONSE_REQUEST_OPCODE_POS   1

Response position of requested opcode.

Enumeration Type Documentation

Speed and Cadence Control Point event type.

Enumerator
BLE_SC_CTRLPT_EVT_UPDATE_LOCATION

rcvd update location opcode (the control point handles the change of location automatically, the event just informs the application in case it needs to adjust its algorithm).

BLE_SC_CTRLPT_EVT_SET_CUMUL_VALUE

rcvd set cumulative value opcode, it is then up to the application to use the new cumulative value.

BLE_SC_CTRLPT_EVT_START_CALIBRATION

rcvd start calibration opcode, the application needs, at the end ot the calibration to call ble_sc_ctrlpt_send_rsp.

Speed and Cadence Control Point operator code (see RSC service specification)

Enumerator
BLE_SCPT_SET_CUMULATIVE_VALUE

Operator to set a given cumulative value.

BLE_SCPT_START_AUTOMATIC_CALIBRATION

Operator to start automatic calibration.

BLE_SCPT_UPDATE_SENSOR_LOCATION

Operator to update the sensor location.

BLE_SCPT_REQUEST_SUPPORTED_SENSOR_LOCATIONS

Operator to request the supported sensor locations.

BLE_SCPT_RESPONSE_CODE

Response Code.

Speed and Cadence Control Point procedure status (indicates is a procedure is in progress or not and which procedure is in progress

Enumerator
BLE_SCPT_NO_PROC_IN_PROGRESS

No procedure in progress.

BLE_SCPT_AUTOMATIC_CALIB_IN_PROGRESS

Automatic Calibration is in progress.

BLE_SCPT_INDICATION_PENDING

Control Point Indication is pending.

BLE_SCPT_IND_CONFIRM_PENDING

Waiting for the indication confirmation.

Speed and Cadence Control Point response parameter (see RSC service specification)

Enumerator
BLE_SCPT_SUCCESS

Sucess Response.

BLE_SCPT_OP_CODE_NOT_SUPPORTED

Error Response received opcode not supported.

BLE_SCPT_INVALID_PARAMETER

Error Response received parameter invalid.

BLE_SCPT_OPERATION_FAILED

Error Response operation failed.

Function Documentation

uint32_t ble_sc_ctrlpt_init ( ble_sc_ctrlpt_t * p_sc_ctrlpt ,
const ble_cs_ctrlpt_init_t * p_sc_ctrlpt_init
)

Function for Initializing the Speed and Cadence Control Point.

Function for Initializing the Speed and Cadence Control Point.

Parameters
[in] p_sc_ctrlpt Speed and Cadence Control Point structure.
[in] p_sc_ctrlpt_init Information needed to initialize the control point behavior.
Returns
NRF_SUCCESS on successful initialization of service, otherwise an error code.
void ble_sc_ctrlpt_on_ble_evt ( ble_sc_ctrlpt_t * p_sc_ctrlpt ,
ble_evt_t * p_ble_evt
)

Speed and Cadence Control Point BLE stack event handler.

Handles all events from the BLE stack of interest to the Speed and Cadence Control Point.

Parameters
[in] p_sc_ctrlpt Speed and Cadence Control Point structure.
[in] p_ble_evt Event received from the BLE stack.
uint32_t ble_sc_ctrlpt_rsp_send ( ble_sc_ctrlpt_t * p_sc_ctrlpt ,
ble_scpt_response_t response_status
)

Function for sending a control point response.

Function for sending a control point response when the control point received was BLE_SCPT_START_AUTOMATIC_CALIBRATION. To be called after the calibration procedure is finished.

Parameters
[in] p_sc_ctrlpt Speed and Cadence Control Point structure.
[in] response_status status to include in the control point response.