nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Cycling Speed and Cadence Service

Cycling Speed and Cadence Service module. More...

Modules

 Cycling Speed and Cadence Service feature bits
 

Data Structures

struct  ble_cscs_evt_t
 Cycling Speed and Cadence Service event. More...
 
struct  ble_cscs_init_t
 Cycling Speed and Cadence Service init structure. This contains all options and data needed for initialization of the service. More...
 
struct  ble_cscs_s
 Cycling Speed and Cadence Service structure. This contains various status information for the service. More...
 
struct  ble_cscs_meas_s
 Cycling Speed and Cadence Service measurement structure. This contains a Cycling Speed and Cadence Service measurement. More...
 

Typedefs

typedef struct ble_cscs_s ble_cscs_t
 Cycling Speed and Cadence Service structure. This contains various status information for the service.
 
typedef void(* ble_cscs_evt_handler_t )(ble_cscs_t *p_cscs, ble_cscs_evt_t *p_evt)
 Cycling Speed and Cadence Service event handler type.
 
typedef struct ble_cscs_meas_s ble_cscs_meas_t
 Cycling Speed and Cadence Service measurement structure. This contains a Cycling Speed and Cadence Service measurement.
 

Enumerations

enum  ble_cscs_evt_type_t {
  BLE_CSCS_EVT_NOTIFICATION_ENABLED,
  BLE_CSCS_EVT_NOTIFICATION_DISABLED
}
 Cycling Speed and Cadence Service event type. More...
 

Functions

uint32_t ble_cscs_init (ble_cscs_t *p_cscs, const ble_cscs_init_t *p_cscs_init)
 Function for initializing the Cycling Speed and Cadence Service. More...
 
void ble_cscs_on_ble_evt (ble_cscs_t *p_cscs, ble_evt_t *p_ble_evt)
 Function for handling the Application's BLE Stack events. More...
 
uint32_t ble_cscs_measurement_send (ble_cscs_t *p_cscs, ble_cscs_meas_t *p_measurement)
 Function for sending cycling speed and cadence measurement if notification has been enabled. More...
 

Detailed Description

Cycling Speed and Cadence Service module.

This module implements the Cycling Speed and Cadence Service. If enabled, notification of the Cycling Speead and Candence Measurement is performed when the application calls ble_cscs_measurement_send().

To use this service, you need to provide the the supported features (Cycling Speed and Cadence Service feature bits). If you choose to support Wheel revolution data (feature bit BLE_CSCS_FEATURE_WHEEL_REV_BIT), you then need to support the 'setting of cumulative value' operation by the supporting the Speed and Cadence Control Point (Speed and Cadence Control Point) by setting the BLE_SRV_SC_CTRLPT_CUM_VAL_OP_SUPPORTED bit of the ctrplt_supported_functions in the ble_cscs_init_t structure. If you want to support the 'start autocalibration' control point feature, you need, after the BLE_SC_CTRLPT_EVT_START_CALIBRATION has been received and the auto calibration is finished, to call the ble_sc_ctrlpt_rsp_send to indicate that the operation is finished and thus be able to receive new control point operations. If you want to support the 'sensor location' related operation, you need to provide a list of supported location in the ble_cscs_init_t structure.

Note
The application or the service using this module must propagate BLE stack events to the Cycling Speead and Candence Service module by calling ble_cscs_on_ble_evt() from the from the ble_stack_handler function. This service will forward the event to the Speed and Cadence Control Point module.
Attention! To maintain compliance with Nordic Semiconductor ASA Bluetooth profile qualification listings, this section of source code must not be modified.

Enumeration Type Documentation

Cycling Speed and Cadence Service event type.

Enumerator
BLE_CSCS_EVT_NOTIFICATION_ENABLED 

Cycling Speed and Cadence value notification enabled event.

BLE_CSCS_EVT_NOTIFICATION_DISABLED 

Cycling Speed and Cadence value notification disabled event.

Function Documentation

uint32_t ble_cscs_init ( ble_cscs_t p_cscs,
const ble_cscs_init_t p_cscs_init 
)

Function for initializing the Cycling Speed and Cadence Service.

Parameters
[out]p_cscsCycling Speed and Cadence Service structure. This structure will have to be supplied by the application. It will be initialized by this function, and will later be used to identify this particular service instance.
[in]p_cscs_initInformation needed to initialize the service.
Returns
NRF_SUCCESS on successful initialization of service, otherwise an error code.
uint32_t ble_cscs_measurement_send ( ble_cscs_t p_cscs,
ble_cscs_meas_t p_measurement 
)

Function for sending cycling speed and cadence measurement if notification has been enabled.

The application calls this function after having performed a Cycling Speed and Cadence Service measurement. If notification has been enabled, the measurement data is encoded and sent to the client.

Parameters
[in]p_cscsCycling Speed and Cadence Service structure.
[in]p_measurementPointer to new cycling speed and cadence measurement.
Returns
NRF_SUCCESS on success, otherwise an error code.
void ble_cscs_on_ble_evt ( ble_cscs_t p_cscs,
ble_evt_t p_ble_evt 
)

Function for handling the Application's BLE Stack events.

Handles all events from the BLE stack of interest to the Cycling Speed and Cadence Service.

Parameters
[in]p_cscsCycling Speed and Cadence Service structure.
[in]p_ble_evtEvent received from the BLE stack.