LCOV - code coverage report
Current view: top level - zephyr/mgmt/mcumgr/grp/img_mgmt - img_mgmt_callbacks.h Coverage Total Hit
Test: new.info Lines: 66.7 % 21 14
Test Date: 2025-09-05 20:47:19

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2022 Laird Connectivity
       3              :  * Copyright (c) 2022 Nordic Semiconductor ASA
       4              :  *
       5              :  * SPDX-License-Identifier: Apache-2.0
       6              :  */
       7              : 
       8              : #ifndef H_MCUMGR_IMG_MGMT_CALLBACKS_
       9              : #define H_MCUMGR_IMG_MGMT_CALLBACKS_
      10              : 
      11              : #include <stdbool.h>
      12              : #include <stdint.h>
      13              : #include <zcbor_common.h>
      14              : 
      15              : #ifdef __cplusplus
      16              : extern "C" {
      17              : #endif
      18              : 
      19              : /* Dummy definitions, include zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h for actual definitions */
      20              : struct img_mgmt_upload_action;
      21              : struct img_mgmt_upload_req;
      22              : 
      23              : /**
      24              :  * @brief MCUmgr Image Management Callbacks API
      25              :  * @defgroup mcumgr_callback_api_img_mgmt Image Management Callbacks
      26              :  * @ingroup mcumgr_img_mgmt
      27              :  * @ingroup mcumgr_callback_api
      28              :  * @{
      29              :  */
      30              : 
      31              : /**
      32              :  * Structure provided in the #MGMT_EVT_OP_IMG_MGMT_DFU_CHUNK notification callback: This callback
      33              :  * function is used to notify the application about a pending firmware upload packet from a client
      34              :  * and authorise or deny it. Upload will be allowed so long as all notification handlers return
      35              :  * #MGMT_ERR_EOK, if one returns an error then the upload will be denied.
      36              :  */
      37            1 : struct img_mgmt_upload_check {
      38              :         /** Action to take */
      39            1 :         struct img_mgmt_upload_action *action;
      40              : 
      41              :         /** Upload request information */
      42            1 :         struct img_mgmt_upload_req *req;
      43              : };
      44              : 
      45              : /**
      46              :  * Structure provided in the #MGMT_EVT_OP_IMG_MGMT_DFU_CONFIRMED notification callback: This
      47              :  * callback function is used to notify the application about an image confirmation being executed
      48              :  * successfully.
      49              :  */
      50            1 : struct img_mgmt_image_confirmed {
      51              :         /** Image number which has been confirmed */
      52            1 :         const uint8_t image;
      53              : };
      54              : 
      55              : /**
      56              :  * Structure provided in the #MGMT_EVT_OP_IMG_MGMT_IMAGE_SLOT_STATE notification callback: This
      57              :  * callback function is used to allow applications or modules append custom fields to the image
      58              :  * slot state response.
      59              :  */
      60            1 : struct img_mgmt_state_slot_encode {
      61            0 :         bool *ok;
      62            0 :         zcbor_state_t *zse;
      63            0 :         const uint32_t slot;
      64            0 :         const char *version;
      65            0 :         const uint8_t *hash;
      66            0 :         const int flags;
      67              : };
      68              : 
      69              : /**
      70              :  * Structure provided in the #MGMT_EVT_OP_IMG_MGMT_SLOT_INFO_IMAGE notification callback: This
      71              :  * callback function is called once per image when the slot info command is used, it can be used
      72              :  * to return additional information/fields in the response.
      73              :  */
      74            1 : struct img_mgmt_slot_info_image {
      75              :         /** The image that is currently being enumerated. */
      76            1 :         const uint8_t image;
      77              : 
      78              :         /**
      79              :          * The zcbor encoder which is currently being used to output information, additional fields
      80              :          * can be added using this.
      81              :          */
      82            1 :         zcbor_state_t *zse;
      83              : };
      84              : 
      85              : /**
      86              :  * Structure provided in the #MGMT_EVT_OP_IMG_MGMT_SLOT_INFO_SLOT notification callback: This
      87              :  * callback function is called once per slot per image when the slot info command is used, it can
      88              :  * be used to return additional information/fields in the response.
      89              :  */
      90            1 : struct img_mgmt_slot_info_slot {
      91              :         /** The image that is currently being enumerated. */
      92            1 :         const uint8_t image;
      93              : 
      94              :         /** The slot that is currently being enumerated. */
      95            1 :         const uint8_t slot;
      96              : 
      97              :         /** Flash area of the slot that is current being enumerated. */
      98            1 :         const struct flash_area *fa;
      99              : 
     100              :         /**
     101              :          * The zcbor encoder which is currently being used to output information, additional fields
     102              :          * can be added using this.
     103              :          */
     104            1 :         zcbor_state_t *zse;
     105              : };
     106              : 
     107              : /**
     108              :  * @}
     109              :  */
     110              : 
     111              : #ifdef __cplusplus
     112              : }
     113              : #endif
     114              : 
     115              : #endif
        

Generated by: LCOV version 2.0-1