Go to the documentation of this file.
62 #include "custom_config.h"
70 #define CSCS_CONNECTION_MAX 10
71 #define CSCS_MEAS_VAL_LEN_MAX 20
72 #define CSCS_FEAT_VAL_LEN_MAX 2
73 #define CSCS_SENSOR_LOC_VAL_LEN_MAX 1
74 #define CSCS_CTRL_PT_RSP_LEN_MIN 3
75 #define CSCS_CTRL_PT_VAL_LEN_MAX (CSCS_CTRL_PT_RSP_LEN_MIN + CSCS_SENSOR_LOC_SUP_NB)
77 #define CSCS_ERROR_PROC_IN_PROGRESS 0x80
78 #define CSCS_ERROR_CCCD_INVALID 0x81
85 #define CSCS_CHAR_MANDATORY 0x003f
86 #define CSCS_CHAR_SENSOR_LOC_SUP 0x00c0
87 #define CSCS_CHAR_SC_CTRL_POINT 0x0700
88 #define CSCS_CHAR_FULL 0x07ff
96 #define CSCS_MEAS_FLAG_WHEEL_REVOLUTION_BIT (0x01 << 0)
97 #define CSCS_MEAS_FLAG_CRANK_REVOLUTION_BIT (0x01 << 1)
105 #define CSCS_FEAT_WHEEL_REVOLUTION_SUP_BIT (0x01 << 0)
106 #define CSCS_FEAT_CRANK_REVOLUTION_SUP_BIT (0x01 << 1)
107 #define CSCS_FEAT_MULTIPLE_SENSORS_BIT (0x01 << 2)
108 #define CSCS_FEAR_FULL_BIT (0x07)
@ CSCS_SENSOR_LOC_SHOE_TOP
Sensor location: top of shoe.
@ CSCS_CTRL_PT_RSP_RESERVED
Reserved value.
const uint8_t * p_data
Pointer to event data.
@ CSCS_EVT_CSC_MEAS_NOTIFICATION_ENABLE
Indicate that CSC Measurement notification has been enabled.
uint32_t cumulative_wheel_revs
Cumulative Wheel Revolutions.
uint16_t char_mask
Initial mask of supported characteristics, and configured with Characteristics Mask.
@ CSCS_CTRL_PT_RSP_SUCCESS
Operation Success.
uint8_t conn_idx
The index of the connection.
@ CSCS_SENSOR_LOC_RIGHT_PEDAL
Sensor location: right pedal.
@ CSCS_CTRL_PT_RSP_NOT_SUP
Operation Code Not Supported.
cscs_ctrl_pt_op_code_t
Cycling Speed and Cadence Service Control Point Operation Code.
sdk_err_t cscs_ctrl_pt_rsp_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length)
Send SC Control Point responce if indication has been enabled.
sdk_err_t cscs_measurement_send(uint8_t conn_idx, cscs_meas_val_t *p_meas)
Send CSC measurement if notification has been enabled.
bool crank_rev_data_present
If Crank Revolution Data is present.
Cycling Speed and Cadence Measurement Character value structure.
cscs_evt_type_t
Cycling Speed and Cadence Service event type.
@ CSCS_CTRL_PT_OP_REQ_SUP_LOC
Request Supported Sensor Locations Operation Code.
@ CSCS_CTRL_PT_RSP_INVALID_PARAM
Invalid Parameter.
@ CSCS_SENSOR_LOC_HIP
Sensor location: hip.
uint16_t cumulative_crank_revs
Cumulative Crank Revolutions.
cscs_sensor_loc_t sensor_location
Initial sensor location.
@ CSCS_SENSOR_LOC_FRONT_HUB
Sensor location: front hub.
@ CSCS_CTRL_PT_RSP_FAILED
Operation Failed.
@ CSCS_SENSOR_LOC_FRONT_WHEEL
Sensor location: front wheel.
cscs_ctrl_pt_rsp_t
Cycling Speed and Cadence Service Control Point Response value.
sdk_err_t cscs_sensor_loc_update(cscs_sensor_loc_t sensor_loc)
Update Sensor Location if Multiple Sensor Locations Supported cscs_init_t::feature.
void(* cscs_evt_handler_t)(cscs_evt_t *p_evt)
Cycling Speed and Cadence Service event handler type.
uint16_t feature
Initial value for features.
@ CSCS_CTRL_PT_OP_RESERVED
Reserved for future use.
@ CSCS_SENSOR_LOC_LEFT_PEDAL
Sensor location: left pedal.
@ CSCS_EVT_CTRL_POINT_INDICATION_DISABLE
Indicate that SC Control Point indication has been disabled.
cscs_evt_handler_t evt_handler
Cycling Speed and Cadence Service event handler.
cscs_sensor_loc_t
Cycling Speed and Cadence Service Sensor Location.
uint16_t sdk_err_t
SDK API result type.
@ CSCS_EVT_CTRL_POINT_INDICATION_ENABLE
Indicate that SC Control Point indication has been enabled.
@ CSCS_CTRL_PT_OP_RSP_CODE
Response code.
@ CSCS_EVT_INVALID
Indicate that invalid event.
Cycling Speed and Cadence Service init stucture.
@ CSCS_EVT_CTRL_POINT_RSP_CPLT
Indicate that SC Control Point response has been indicated.
@ CSCS_EVT_CSC_MEAS_SEND_CPLT
Indicate that CSC Measurement has been notified.
uint16_t last_wheel_event_time
Last Wheel Event Time.
cscs_evt_type_t evt_type
The CSCS event type.
uint16_t last_crank_event_time
Last Crank Event Time.
@ CSCS_SENSOR_LOC_SUP_NB
Number of sensor location.
sdk_err_t cscs_service_init(cscs_init_t *p_cscs_init)
Initialize a Cycling Speed and Cadence Service instance and add in the DB.
uint16_t length
Length of event data.
@ CSCS_EVT_CSC_MEAS_NOTIFICATION_DISABLE
Indicate that CSC Measurement notification has been disabled.
@ CSCS_SENSOR_LOC_SHOE_IN
Sensor location: inside of shoe.
@ CSCS_EVT_SEBSOR_CALIBRATION
Indicate that Sensor calibration procedure should be initiated.
bool wheel_rev_data_present
If Wheel Revolution Data is present.
@ CSCS_CTRL_PT_OP_START_CALIB
Start Sensor Calibration Operation Code.
@ CSCS_EVT_CUMUL_VAL_SET
Indicate that Wheel Revolution Data needs to be set.
@ CSCS_SENSOR_LOC_OTHER
Sensor location: other.
@ CSCS_EVT_SEBSOR_LOC_UPD
Indicate that Sensor Location needs to be reset.
@ CSCS_CTRL_PT_OP_UPD_LOC
Update Sensor Location Operation Code.
@ CSCS_EVT_SUP_SEBSOR_LOC_REQ
Indicate that request supported sensor location list.
@ CSCS_CTRL_PT_OP_SET_CUMUL_VAL
Set Cumulative value Operation Code.
Cycling Speed and Cadence Service event.