This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Anybody wrote ble_cps.c for Cycling Power?

We are looking for an equivalent source to Cycling Speed and Cadence, but for Cycling Power. Any help in this matter is appreciated.

  • I implemented a dummy cycling power service(attached) based on the CSCS service, only send out power number, tested work with wahoo utility app and some BLE watches.

    If you want more features, you can follow the standard cycling power service/profile description here:developer.bluetooth.org/.../ServiceViewer.aspx

    ble_cp.h ble_cp.c

  • please, could be possible that you could show us how to config the service?

    memset(&cp_init, 0, sizeof(cp_init));
                
                cp_init.ctrlpt_evt_handler    = NULL;
                cp_init.feature                     = BLE_CPS_FEATURE_WHEEL_REV_BIT | BLE_CPS_FEATURE_CRANK_REV_BIT | BLE_CPS_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(&cp_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(&cp_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
                
                
                //cp_init.ctrlpt_evt_handler            = sc_ctrlpt_event_handler;
                
                
                err_code = ble_cps_init(&m_cp, &cp_init);
                APP_ERROR_CHECK(err_code);

Related