Hello,
I am trying to initialize the service Power Cycling from the files of this link https://devzone.nordicsemi.com/f/nordic-q-a/9169/cycling-power-service-0x1818
I get the CSC example from Nordic and I tried to initialize the service of Power Cycling from the files that I downloaded.
That's all
I had a response from a user that put this solution:
in services init you call this:
ble_cps_init_t cps_init;
// Initialize Cycling Power Service module
memset(&cps_init, 0, sizeof(cps_init));
cps_init.evt_handler = NULL;
cps_init.feature = BLE_CPS_FEATURE_WHEEL_REV_BIT | BLE_CSCS_FEATURE_CRANK_REV_BIT |
BLE_CSCS_FEATURE_MULTIPLE_SENSORS_BIT;
// Here the sec level for the Cycling Speed and Cadence Service can be changed/increased.
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cps_init.cp_meas_attr_md.cccd_write_perm); // for the measurement characteristic, only the CCCD write permission can be set by the application, others are mandated by service specification
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cps_init.cp_feature_attr_md.read_perm); // for the feature characteristic, only the read permission can be set by the application, others are mandated by service specification
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cps_init.cp_ctrlpt_attr_md.write_perm); // for the SC control point characteristic, only the write permission and CCCD write can be set by the application, others are mandated by service specification
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cps_init.cp_ctrlpt_attr_md.cccd_write_perm); // for the SC control point characteristic, only the write permission and CCCD write can be set by the application, others are mandated by service specification
cps_init.ctrplt_supported_functions = BLE_SRV_SC_CTRLPT_CUM_VAL_OP_SUPPORTED
|BLE_SRV_SC_CTRLPT_SENSOR_LOCATIONS_OP_SUPPORTED
|BLE_SRV_SC_CTRLPT_START_CALIB_OP_SUPPORTED;
cps_init.ctrlpt_evt_handler = sc_ctrlpt_event_handler;
cps_init.list_supported_locations = supported_locations;
cps_init.size_list_supported_locations = sizeof(supported_locations) / sizeof(ble_sensor_location_t);
sensor_location = BLE_SENSOR_LOCATION_FRONT_WHEEL; // initializes the sensor location to add the sensor location characteristic.
cps_init.sensor_location = &sensor_location;
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cps_init.cp_sensor_loc_attr_md.read_perm); // for the sensor location characteristic, only the read permission can be set by the application, others are mendated by service specification
err_code = ble_cps_init(&m_cps, &cps_init);
APP_ERROR_CHECK(err_code);
in ble_srv_common.h file you add below:
#define BLE_UUID_CYCLING_POWER 0x1818 /**< Cycling Power UUID. */
#define BLE_UUID_CYCLING_POWER_MEASUREMENT_CHAR 0x2A63 /**< Cycling Power Feature characteristic UUID. */
#define BLE_UUID_CYCLING_POWER_FEATURE_CHAR 0x2A65 /**< Cycling Power Measurement characteristic UUID. */
But It doesn't work in my compilation