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

I have the code of a sensor in keil. I couldnt understand this piece of the code, what is it trying to do with errors? How can I learn the meanings of codes?

image description

  • This doesn't look like it is releated to a sensor? Isn't this a function that is part of the Device Manager? What is it that you don't understand? Could you be a bit more specific?

  • The code is very long, this is just one part of the code. I want to understand the whole code part by part, that is why i wanted to start understanding from this part. For example in this part of the code how can I understand what is "BLE_ERROR_INVALID_CONN_HANDLE" or what is "NRF_SUCCESS" ? Is there any source where I can find the explanations of all those functions?

  • For sd_ble_gatts_service_changed() you can have a look at ble_gatts.h:

     * @retval ::NRF_SUCCESS Successfully queued the Service Changed indication for transmission.
     * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
     * @retval ::NRF_ERROR_NOT_SUPPORTED Service Changed not enabled at initialization. See @ref
     *                                   sd_ble_cfg_set and @ref ble_gatts_cfg_service_changed_t.
     * @retval ::NRF_ERROR_INVALID_STATE One or more of the following is true:
     *                                   - Invalid Connection State
     *                                   - Notifications and/or indications not enabled in the CCCD
     *                                   - An ATT_MTU exchange is ongoing
     * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
    

  •  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
     * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied, handles must be in the range populated by the application.
     * @retval ::NRF_ERROR_BUSY Procedure already in progress.
     * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value.
     */
    SVCALL(SD_BLE_GATTS_SERVICE_CHANGED, uint32_t, sd_ble_gatts_service_changed(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle));
    
Related