nRF51 SDK
|
Speed and Cadence Control Point module. More...
Macros | |
#define | BLE_SC_CTRLPT_MAX_LEN 19 |
#define | BLE_SC_CTRLPT_MIN_LEN 1 |
#define | BLE_SRV_SC_CTRLPT_SENSOR_LOCATIONS_OP_SUPPORTED 0x01 |
#define | BLE_SRV_SC_CTRLPT_CUM_VAL_OP_SUPPORTED 0x02 |
#define | BLE_SRV_SC_CTRLPT_START_CALIB_OP_SUPPORTED 0x04 |
#define | SCPT_OPCODE_POS 0 |
#define | SCPT_PARAMETER_POS 1 |
#define | SCPT_RESPONSE_REQUEST_OPCODE_POS 1 |
#define | SCPT_RESPONSE_CODE_POS 2 |
#define | SCPT_RESPONSE_PARAMETER 3 |
#define | SCPT_MIN_RESPONSE_SIZE 3 |
#define | SCPT_MAX_RESPONSE_SIZE (SCPT_MIN_RESPONSE_SIZE + NB_MAX_SENSOR_LOCATIONS) |
Typedefs | |
typedef struct ble_sc_ctrlpt_s | ble_sc_ctrlpt_t |
Speed and Cadence Control Point structure. This contains various status information for the Speed and Cadence Control Point behavior. | |
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. | |
Enumerations | |
enum | ble_sc_ctrlpt_evt_type_t { BLE_SC_CTRLPT_EVT_UPDATE_LOCATION, BLE_SC_CTRLPT_EVT_SET_CUMUL_VALUE, BLE_SC_CTRLPT_EVT_START_CALIBRATION } |
Speed and Cadence Control Point event type. More... | |
enum | ble_scpt_operator_t { BLE_SCPT_SET_CUMULATIVE_VALUE = 0x01, BLE_SCPT_START_AUTOMATIC_CALIBRATION = 0x02, BLE_SCPT_UPDATE_SENSOR_LOCATION = 0x03, BLE_SCPT_REQUEST_SUPPORTED_SENSOR_LOCATIONS = 0x04, BLE_SCPT_RESPONSE_CODE = 0x10 } |
enum | ble_scpt_response_t { BLE_SCPT_SUCCESS = 0x01, BLE_SCPT_OP_CODE_NOT_SUPPORTED = 0x02, BLE_SCPT_INVALID_PARAMETER = 0x03, BLE_SCPT_OPERATION_FAILED = 0x04 } |
enum | ble_scpt_procedure_status_t { BLE_SCPT_NO_PROC_IN_PROGRESS = 0x00, BLE_SCPT_AUTOMATIC_CALIB_IN_PROGRESS = 0x01, BLE_SCPT_INDICATION_PENDING = 0x02, BLE_SCPT_IND_CONFIRM_PENDING = 0x03 } |
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... | |
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... | |
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.
#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 BLE_SRV_SC_CTRLPT_SENSOR_LOCATIONS_OP_SUPPORTED 0x01 |
Support for sensor location related operations
#define BLE_SRV_SC_CTRLPT_CUM_VAL_OP_SUPPORTED 0x02 |
Support for setting cumulative value related operations
#define BLE_SRV_SC_CTRLPT_START_CALIB_OP_SUPPORTED 0x04 |
Support for starting calibration related operations
#define SCPT_OPCODE_POS 0 |
Request opcode position.
#define SCPT_PARAMETER_POS 1 |
Request parameter position.
#define SCPT_RESPONSE_REQUEST_OPCODE_POS 1 |
Response position of requested opcode.
#define SCPT_RESPONSE_CODE_POS 2 |
Response position of response code.
#define SCPT_RESPONSE_PARAMETER 3 |
Response position of response parameter.
#define SCPT_MIN_RESPONSE_SIZE 3 |
Minimum size for control point response.
#define SCPT_MAX_RESPONSE_SIZE (SCPT_MIN_RESPONSE_SIZE + NB_MAX_SENSOR_LOCATIONS) |
Maximum size for control point response.
enum ble_scpt_operator_t |
Speed and Cadence Control Point operator code (see RSC service specification)
enum ble_scpt_response_t |
Speed and Cadence Control Point response parameter (see RSC service specification)
Speed and Cadence Control Point procedure status (indicates is a procedure is in progress or not and which procedure is in progress
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.
[in] | p_sc_ctrlpt | Speed and Cadence Control Point structure. |
[in] | p_cscs_init | Information needed to initialize the control point behavior. |
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 when the control point received was BLE_SCPT_START_AUTOMATIC_CALIBRATION. To be called after the calibration procedure is finished.
[in] | p_sc_ctrlpt | Speed and Cadence Control Point structure. |
[in] | response_status | status to include in the control point response. |
void ble_sc_ctrlpt_on_ble_evt | ( | ble_sc_ctrlpt_t * | p_sc_ctrlpt, |
ble_evt_t * | p_ble_evt | ||
) |
Handles all events from the BLE stack of interest to the Speed and Cadence Control Point.
[in] | p_sc_ctrlpt | Speed and Cadence Control Point structure. |
[in] | p_ble_evt | Event received from the BLE stack. |