cscs.h File Reference

Cycling Speed and Cadence Service API. More...

#include "gr_includes.h"
#include "custom_config.h"
#include <stdint.h>
#include <stdbool.h>
+ Include dependency graph for cscs.h:

Go to the source code of this file.

Classes

struct  cscs_evt_t
 Cycling Speed and Cadence Service event. More...
 
struct  cscs_meas_val_t
 Cycling Speed and Cadence Measurement Character value structure. More...
 
struct  cscs_init_t
 Cycling Speed and Cadence Service init stucture. More...
 

Macros

#define CSCS_CONNECTION_MAX   10
 Maximum number of CSCS connections. More...
 
#define CSCS_MEAS_VAL_LEN_MAX   20
 Maximum length of CSC Measurment value. More...
 
#define CSCS_FEAT_VAL_LEN_MAX   2
 Maximum length of CSC Feature value. More...
 
#define CSCS_SENSOR_LOC_VAL_LEN_MAX   1
 Maximum length of Sensor Location value. More...
 
#define CSCS_CTRL_PT_RSP_LEN_MIN   3
 Mimimum length of SC Control Point response value. More...
 
#define CSCS_CTRL_PT_VAL_LEN_MAX   (CSCS_CTRL_PT_RSP_LEN_MIN + CSCS_SENSOR_LOC_SUP_NB)
 Maximum length of SC Control Point value. More...
 
#define CSCS_ERROR_PROC_IN_PROGRESS   0x80
 Error code: A previously triggered SC Control Point operation is still in progress. More...
 
#define CSCS_ERROR_CCCD_INVALID   0x81
 Error code: The Client Characteristic Configuration descriptor is not configured. More...
 
#define CSCS_CHAR_MANDATORY   0x003f
 Bit mask for mandatory characteristic in CSCS. More...
 
#define CSCS_CHAR_SENSOR_LOC_SUP   0x00c0
 Bit mask for Sensor Location characteristic that is optional. More...
 
#define CSCS_CHAR_SC_CTRL_POINT   0x0700
 Bit mask for SC Control Point characteristic that is optional. More...
 
#define CSCS_CHAR_FULL   0x07ff
 Bit mask of the full characteristic. More...
 
#define CSCS_MEAS_FLAG_WHEEL_REVOLUTION_BIT   (0x01 << 0)
 Flag bit for Wheel Revolution Data Present. More...
 
#define CSCS_MEAS_FLAG_CRANK_REVOLUTION_BIT   (0x01 << 1)
 Flag bit for Crank Revolution Data Present. More...
 
#define CSCS_FEAT_WHEEL_REVOLUTION_SUP_BIT   (0x01 << 0)
 Bit for Wheel Revolution Data Supported. More...
 
#define CSCS_FEAT_CRANK_REVOLUTION_SUP_BIT   (0x01 << 1)
 Bit for Crank Revolution Data Supported. More...
 
#define CSCS_FEAT_MULTIPLE_SENSORS_BIT   (0x01 << 2)
 Bit for Multiple Sensor Locations Supported. More...
 
#define CSCS_FEAR_FULL_BIT   (0x07)
 Bit for all CSC features Supported. More...
 

Typedefs

typedef void(* cscs_evt_handler_t) (cscs_evt_t *p_evt)
 Cycling Speed and Cadence Service event handler type. More...
 

Enumerations

enum  cscs_sensor_loc_t {
  CSCS_SENSOR_LOC_OTHER, CSCS_SENSOR_LOC_SHOE_TOP, CSCS_SENSOR_LOC_SHOE_IN, CSCS_SENSOR_LOC_HIP,
  CSCS_SENSOR_LOC_FRONT_WHEEL, CSCS_SENSOR_LOC_LEFT_PEDAL, CSCS_SENSOR_LOC_RIGHT_PEDAL, CSCS_SENSOR_LOC_FRONT_HUB,
  CSCS_SENSOR_LOC_SUP_NB
}
 Cycling Speed and Cadence Service Sensor Location. More...
 
enum  cscs_ctrl_pt_op_code_t {
  CSCS_CTRL_PT_OP_RESERVED, CSCS_CTRL_PT_OP_SET_CUMUL_VAL, CSCS_CTRL_PT_OP_START_CALIB, CSCS_CTRL_PT_OP_UPD_LOC,
  CSCS_CTRL_PT_OP_REQ_SUP_LOC, CSCS_CTRL_PT_OP_RSP_CODE = 0x10
}
 Cycling Speed and Cadence Service Control Point Operation Code. More...
 
enum  cscs_ctrl_pt_rsp_t {
  CSCS_CTRL_PT_RSP_RESERVED, CSCS_CTRL_PT_RSP_SUCCESS, CSCS_CTRL_PT_RSP_NOT_SUP, CSCS_CTRL_PT_RSP_INVALID_PARAM,
  CSCS_CTRL_PT_RSP_FAILED
}
 Cycling Speed and Cadence Service Control Point Response value. More...
 
enum  cscs_evt_type_t {
  CSCS_EVT_INVALID, CSCS_EVT_CSC_MEAS_NOTIFICATION_ENABLE, CSCS_EVT_CSC_MEAS_NOTIFICATION_DISABLE, CSCS_EVT_CTRL_POINT_INDICATION_ENABLE,
  CSCS_EVT_CTRL_POINT_INDICATION_DISABLE, CSCS_EVT_CSC_MEAS_SEND_CPLT, CSCS_EVT_CUMUL_VAL_SET, CSCS_EVT_SEBSOR_CALIBRATION,
  CSCS_EVT_SEBSOR_LOC_UPD, CSCS_EVT_SUP_SEBSOR_LOC_REQ, CSCS_EVT_CTRL_POINT_RSP_CPLT
}
 Cycling Speed and Cadence Service event type. More...
 

Functions

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. More...
 
sdk_err_t cscs_measurement_send (uint8_t conn_idx, cscs_meas_val_t *p_meas)
 Send CSC measurement if notification has been enabled. More...
 
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. More...
 
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. More...
 

Detailed Description

Cycling Speed and Cadence Service API.

Attention
Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file cscs.h.