Cycling Speed and Cadence Service Client API.
More...
|
| typedef void(* | cscs_client_read_csc_features_completed_cb_t) (ble_client_t *client, att_error_t status, uint16_t features) |
| | Read feature completed callback. More...
|
| |
| typedef void(* | cscs_client_get_event_state_completed_cb_t) (ble_client_t *client, cscs_client_event_t event, att_error_t status, bool enabled) |
| | Get event state completed callback. More...
|
| |
| typedef void(* | cscs_client_set_event_state_completed_cb_t) (ble_client_t *client, cscs_client_event_t event, att_error_t status) |
| | Set event state completed callback. More...
|
| |
| typedef void(* | cscs_client_get_sc_control_point_state_completed_cb_t) (ble_client_t *client, att_error_t status, bool enabled) |
| | Get control point state completed callback. More...
|
| |
| typedef void(* | cscs_client_set_sc_control_point_state_completed_cb_t) (ble_client_t *client, att_error_t status) |
| | Set control point state completed callback. More...
|
| |
| typedef void(* | cscs_client_update_sensor_location_completed_cb_t) (ble_client_t *client, cscs_client_status_t status) |
| | Update sensor location callback. More...
|
| |
| typedef void(* | cscs_client_read_sensor_location_completed_cb_t) (ble_client_t *client, att_error_t status, cscs_client_sensor_location_t location) |
| | Read sensor location callback. More...
|
| |
| typedef void(* | cscs_client_set_cumulative_value_completed_cb_t) (ble_client_t *client, cscs_client_status_t status) |
| | Set cumulative value callback. More...
|
| |
| typedef void(* | cscs_client_request_supported_sensor_locations_completed_cb_t) (ble_client_t *client, cscs_client_status_t status, uint8_t locations_count, const uint8_t *locations) |
| | Request supported sensor locations callback. More...
|
| |
| typedef void(* | cscs_client_csc_measurement_cb_t) (ble_client_t *client, const cscs_client_measurement_t *measurement) |
| | CSC measurement callback. More...
|
| |
|
| enum | cscs_client_feature_t { CSCS_CLIENT_FEATURE_WHEEL_REVOLUTION_DATA = 0x01,
CSCS_CLIENT_FEATURE_CRANK_REVOLUTION_DATA = 0x02,
CSCS_CLIENT_FEATURE_MULTIPLE_SENSOR_LOCATIONS = 0x04
} |
| |
| enum | cscs_client_status_t {
CSCS_CLIENT_STATUS_SUCCESS = 0x01,
CSCS_CLIENT_STATUS_OPCODE_NOT_SUPPORTED = 0x02,
CSCS_CLIENT_STATUS_INVALID_PARAM = 0x03,
CSCS_CLIENT_STATUS_OPERATION_FAILED = 0x04,
CSCS_CLIENT_STATUS_OPERATION_IN_PROGRESS = 0x80,
CSCS_CLIENT_STATUS_IMPROPERLY_CONFIGURED = 0x81,
CSCS_CLIENT_STATUS_TIMEOUT = 0x100
} |
| |
| enum | cscs_client_sensor_location_t {
CSCS_CLIENT_SENSOR_LOCATION_OTHER = 0x00,
CSCS_CLIENT_SENSOR_LOCATION_TOP_OF_SHOE = 0x01,
CSCS_CLIENT_SENSOR_LOCATION_IN_SHOE = 0x02,
CSCS_CLIENT_SENSOR_LOCATION_HIP = 0x03,
CSCS_CLIENT_SENSOR_LOCATION_FRONT_WHEEL = 0x04,
CSCS_CLIENT_SENSOR_LOCATION_LEFT_CRANK = 0x05,
CSCS_CLIENT_SENSOR_LOCATION_RIGHT_CRANK = 0x06,
CSCS_CLIENT_SENSOR_LOCATION_LEFT_PEDAL = 0x07,
CSCS_CLIENT_SENSOR_LOCATION_RIGHT_PEDAL = 0x08,
CSCS_CLIENT_SENSOR_LOCATION_FRONT_HUB = 0x09,
CSCS_CLIENT_SENSOR_LOCATION_REAR_DROPOUT = 0x0a,
CSCS_CLIENT_SENSOR_LOCATION_CHAINSTAY = 0x0b,
CSCS_CLIENT_SENSOR_LOCATION_REAR_WHEEL = 0x0c,
CSCS_CLIENT_SENSOR_LOCATION_REAR_HUB = 0x0d,
CSCS_CLIENT_SENSOR_LOCATION_CHEST = 0x0e
} |
| |
| enum | cscs_client_event_t { CSCS_CLIENT_EVENT_CSC_MEASUREMENT_NOTIF = 0x01
} |
| |
| enum | cscs_client_cap_t { CSCS_CLIENT_CAP_SENSOR_LOCATION = 0x01
} |
| |
|
| ble_client_t * | cscs_client_init (const cscs_client_callbacks_t *cb, const ble_evt_gattc_browse_svc_t *evt) |
| | Register CSC Client instance. More...
|
| |
| bool | cscs_client_read_csc_features (ble_client_t *client) |
| | Read CSC features. More...
|
| |
| cscs_client_cap_t | cscs_client_get_capabilities (ble_client_t *client) |
| | Get capabilities. More...
|
| |
| bool | cscs_client_get_event_state (ble_client_t *client, cscs_client_event_t event) |
| | Get event state. More...
|
| |
| bool | cscs_client_set_event_state (ble_client_t *client, cscs_client_event_t event, bool enable) |
| | Set event state. More...
|
| |
| bool | cscs_client_get_sc_control_point_ind_state (ble_client_t *client) |
| | Get control point state. More...
|
| |
| bool | cscs_client_set_sc_control_point_ind_state (ble_client_t *client, bool enable) |
| | Set control point state. More...
|
| |
| bool | cscs_client_read_sensor_location (ble_client_t *client) |
| | Read sensor location. More...
|
| |
| bool | cscs_client_update_sensor_location (ble_client_t *client, cscs_client_sensor_location_t location) |
| | Update sensor location. More...
|
| |
| bool | cscs_client_request_supported_sensor_locations (ble_client_t *client) |
| | Request supported sensor locations. More...
|
| |
| bool | cscs_client_set_cumulative_value (ble_client_t *client, uint32_t value) |
| | Set cumulative value. More...
|
| |
| void | cscs_client_sc_control_point_timeout (ble_client_t *client) |
| | Control point operation timeout. More...
|
| |
| ble_client_t * | cscs_client_init_from_data (uint16_t conn_idx, const cscs_client_callbacks_t *cb, const void *data, size_t length) |
| | Initialize CSCP Client instance from buffered (cached) data and register application callbacks. More...
|
| |
Cycling Speed and Cadence Service Client API.
◆ cscs_client_csc_measurement_cb_t
CSC measurement callback.
Callback with CSC measurement
- Parameters
-
| [in] | client | CSCS Client instance |
| [in[ | measurement CSC measurement |
◆ cscs_client_get_event_state_completed_cb_t
Get event state completed callback.
- Parameters
-
| [in] | client | client instance |
| [in] | event | indication/notification characteristic |
| [in] | status | operation status |
| [in] | enabled | state flag |
◆ cscs_client_get_sc_control_point_state_completed_cb_t
| typedef void(* cscs_client_get_sc_control_point_state_completed_cb_t) (ble_client_t *client, att_error_t status, bool enabled) |
Get control point state completed callback.
- Parameters
-
| [in] | client | client instance |
| [in] | status | operation status |
| [in] | enabled | state flag |
◆ cscs_client_read_csc_features_completed_cb_t
| typedef void(* cscs_client_read_csc_features_completed_cb_t) (ble_client_t *client, att_error_t status, uint16_t features) |
Read feature completed callback.
- Parameters
-
| [in] | client | client instance |
| [in] | status | operation status |
| [in] | features | supported features |
◆ cscs_client_read_sensor_location_completed_cb_t
Read sensor location callback.
Indicates current sensor location
- Parameters
-
| [in] | client | CSCS Client instance |
| [in] | status | operation status |
| [in] | location | sensor location |
◆ cscs_client_request_supported_sensor_locations_completed_cb_t
| typedef void(* cscs_client_request_supported_sensor_locations_completed_cb_t) (ble_client_t *client, cscs_client_status_t status, uint8_t locations_count, const uint8_t *locations) |
Request supported sensor locations callback.
Indicates supported sensor locations of CSC Sensor. Locations array is valid in case of success.
- Parameters
-
| [in] | client | CSCS Client instance |
| [in] | status | operation status |
| [in] | locations_count | number of supported locations |
| [in] | locations | array of supported locations |
◆ cscs_client_set_cumulative_value_completed_cb_t
Set cumulative value callback.
Indicates status of set cumulative value procedure.
- Parameters
-
| [in] | client | CSCS Client instance |
| [in] | status | operation status |
◆ cscs_client_set_event_state_completed_cb_t
Set event state completed callback.
- Parameters
-
| [in] | client | client instance |
| [in] | event | indication/notification characteristic |
| [in] | status | operation status |
◆ cscs_client_set_sc_control_point_state_completed_cb_t
Set control point state completed callback.
- Parameters
-
| [in] | client | client instance |
| [in] | status | operation status |
◆ cscs_client_update_sensor_location_completed_cb_t
Update sensor location callback.
Indicates status of update sensor location procedure.
- Parameters
-
| [in] | client | CSCS Client instance |
| [in] | status | operation status |
◆ cscs_client_cap_t
Capabilities (supported characteristic) bit mask
| Enumerator |
|---|
| CSCS_CLIENT_CAP_SENSOR_LOCATION | Sensor Location Characteristic
|
◆ cscs_client_event_t
Event Characteristics (those which have indications/notifications as property)
| Enumerator |
|---|
| CSCS_CLIENT_EVENT_CSC_MEASUREMENT_NOTIF | Cycling Speed and Cadence Measurement Characteristic
|
◆ cscs_client_feature_t
CSC features
| Enumerator |
|---|
| CSCS_CLIENT_FEATURE_WHEEL_REVOLUTION_DATA | Wheel Revolution Data Supported
|
| CSCS_CLIENT_FEATURE_CRANK_REVOLUTION_DATA | Crank Revolution Data Supported
|
| CSCS_CLIENT_FEATURE_MULTIPLE_SENSOR_LOCATIONS | Multiple Sensor Locations Supported
|
◆ cscs_client_sensor_location_t
Sensor locations
| Enumerator |
|---|
| CSCS_CLIENT_SENSOR_LOCATION_OTHER | Location Other
|
| CSCS_CLIENT_SENSOR_LOCATION_TOP_OF_SHOE | Location Top of shoe
|
| CSCS_CLIENT_SENSOR_LOCATION_IN_SHOE | Location In shoe
|
| CSCS_CLIENT_SENSOR_LOCATION_HIP | Location Hip
|
| CSCS_CLIENT_SENSOR_LOCATION_FRONT_WHEEL | Location Front wheel
|
| CSCS_CLIENT_SENSOR_LOCATION_LEFT_CRANK | Location Left crank
|
| CSCS_CLIENT_SENSOR_LOCATION_RIGHT_CRANK | Location Right crank
|
| CSCS_CLIENT_SENSOR_LOCATION_LEFT_PEDAL | Location Left pedal
|
| CSCS_CLIENT_SENSOR_LOCATION_RIGHT_PEDAL | Location Right pedal
|
| CSCS_CLIENT_SENSOR_LOCATION_FRONT_HUB | Location Front hub
|
| CSCS_CLIENT_SENSOR_LOCATION_REAR_DROPOUT | Location Rear dropout
|
| CSCS_CLIENT_SENSOR_LOCATION_CHAINSTAY | Location Chainstay
|
| CSCS_CLIENT_SENSOR_LOCATION_REAR_WHEEL | Location Rear wheel
|
| CSCS_CLIENT_SENSOR_LOCATION_REAR_HUB | Location Rear hub
|
| CSCS_CLIENT_SENSOR_LOCATION_CHEST | Location Chest
|
◆ cscs_client_status_t
Status
| Enumerator |
|---|
| CSCS_CLIENT_STATUS_SUCCESS | Status success
|
| CSCS_CLIENT_STATUS_OPCODE_NOT_SUPPORTED | Status opcode not supported
|
| CSCS_CLIENT_STATUS_INVALID_PARAM | Status invalid parameters
|
| CSCS_CLIENT_STATUS_OPERATION_FAILED | Status operation failed
|
| CSCS_CLIENT_STATUS_OPERATION_IN_PROGRESS | Status operation in progress
|
| CSCS_CLIENT_STATUS_IMPROPERLY_CONFIGURED | Status CCC descriptor improperly configured
|
| CSCS_CLIENT_STATUS_TIMEOUT | Status SC Control Point operation timeout
|
◆ cscs_client_get_capabilities()
Get capabilities.
Function returns capabilities enum
- Parameters
-
| [in] | client | client instance |
- Returns
- Bit mask with capabilities
◆ cscs_client_get_event_state()
Get event state.
Function reads CCC descriptor of specified characteristic. After successful operation get_event_state_completed callback will be called.
- Parameters
-
| [in] | client | client instance |
| [in] | event | indication/notification characteristic |
- Returns
- true if read request has been sent successfully, otherwise false
◆ cscs_client_get_sc_control_point_ind_state()
| bool cscs_client_get_sc_control_point_ind_state |
( |
ble_client_t * |
client | ) |
|
Get control point state.
Function reads CCC descriptor of SC Control Point characteristic. After successful operation get_sc_control_point_state_completed callback will be called.
- Parameters
-
| [in] | client | client instance |
- Returns
- true if read request has been sent successfully, false otherwise
◆ cscs_client_init()
Register CSC Client instance.
Funtion registers new CSC Client instance
- Parameters
-
| [in] | cb | application callbacks |
| [in] | evt | browse svc event with HID svc details |
- Returns
- client instance if success, otherwise NULL
◆ cscs_client_init_from_data()
Initialize CSCP Client instance from buffered (cached) data and register application callbacks.
Function sematics is very similar to cscs_client_init() but internal data is initialized by buffered context and the client is automatically added to active clients collection.
- Parameters
-
| [in] | conn_idx | connection index |
| [in] | cb | application callbacks |
| [in] | data | buffered data |
| [in] | length | buffer's length |
- Returns
- client instance when initialized properly, NULL otherwise
◆ cscs_client_read_csc_features()
Read CSC features.
Function reads mandatory CSC Feature characteristic. After successful operation read_features_completed callback will be called.
- Parameters
-
| [in] | client | client instance |
- Returns
- true if request sent successfully, otherwise false
◆ cscs_client_read_sensor_location()
| bool cscs_client_read_sensor_location |
( |
ble_client_t * |
client | ) |
|
Read sensor location.
Function triggers read sensor location characteristic
- Parameters
-
| [in] | client | CSC Client instance |
- Returns
- true if request has been send successfully, otherwise false
◆ cscs_client_request_supported_sensor_locations()
| bool cscs_client_request_supported_sensor_locations |
( |
ble_client_t * |
client | ) |
|
Request supported sensor locations.
Function requests supported sensor location using SC Control Point Characteristic. Once operation is completed, callback request_supported_sensor_locations wil be called with proper status.
- Parameters
-
| [in] | client | CSC Client instance |
- Returns
- true if request has been send successfully, otherwise false
◆ cscs_client_sc_control_point_timeout()
| void cscs_client_sc_control_point_timeout |
( |
ble_client_t * |
client | ) |
|
Control point operation timeout.
Function should be called when the timer related with operation timeout of specific CSCS Client's SC Control Point is expired. This function is necessary for proper handling of SC Control Point indication timeout.
- Parameters
-
| [in] | client | client instance |
◆ cscs_client_set_cumulative_value()
| bool cscs_client_set_cumulative_value |
( |
ble_client_t * |
client, |
|
|
uint32_t |
value |
|
) |
| |
Set cumulative value.
Function sets wheel cumulative value of CSC Sensor using SC Control Point Characteristic. Once operation is completed, callback set_cumulative_value wil be called.
- Parameters
-
| [in] | client | CSC Client instance |
| [in] | value | cumulative value |
- Returns
- true if request has been send successfully, otherwise false
◆ cscs_client_set_event_state()
Set event state.
Function writes CCC descriptor of specified characteristic. After successful operation set_event_state_completed callback will be called.
- Parameters
-
| [in] | client | client instance |
| [in] | event | indication/notification characteristic |
| [in] | enable | state flag |
- Returns
- true if write request has been sent successfully, otherwise false
◆ cscs_client_set_sc_control_point_ind_state()
| bool cscs_client_set_sc_control_point_ind_state |
( |
ble_client_t * |
client, |
|
|
bool |
enable |
|
) |
| |
Set control point state.
Function writes CCC descriptor of SC Control Point characteristic. After successful operation set_sc_control_point_state_completed callback will be called.
- Parameters
-
| [in] | client | client instance |
| [in] | enable | state flag |
- Returns
- true if write request has been sent successfully, false otherwise.
◆ cscs_client_update_sensor_location()
Update sensor location.
Function triggers sensor location update using SC Control Point Characteristic. Once operation is completed, callback update_sensor_location will be called with proper status.
- Parameters
-
| [in] | client | CSC Client instance |
| [in] | location | requested location |
- Returns
- true if request has been send successfully, otherwise false