LCOV - code coverage report
Current view: top level - zephyr/mgmt/mcumgr/grp/os_mgmt - os_mgmt.h Coverage Total Hit
Test: new.info Lines: 8.3 % 24 2
Test Date: 2025-03-11 06:50:38

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2018-2021 mcumgr authors
       3              :  * Copyright (c) 2022 Laird Connectivity
       4              :  * Copyright (c) 2023 Nordic Semiconductor ASA
       5              :  *
       6              :  * SPDX-License-Identifier: Apache-2.0
       7              :  */
       8              : 
       9              : #ifndef H_OS_MGMT_
      10              : #define H_OS_MGMT_
      11              : 
      12              : #ifdef __cplusplus
      13              : extern "C" {
      14              : #endif
      15              : 
      16              : /**
      17              :  * Command IDs for OS management group.
      18              :  */
      19            1 : #define OS_MGMT_ID_ECHO                 0
      20            0 : #define OS_MGMT_ID_CONS_ECHO_CTRL       1
      21            0 : #define OS_MGMT_ID_TASKSTAT             2
      22            0 : #define OS_MGMT_ID_MPSTAT               3
      23            0 : #define OS_MGMT_ID_DATETIME_STR         4
      24            0 : #define OS_MGMT_ID_RESET                5
      25            0 : #define OS_MGMT_ID_MCUMGR_PARAMS        6
      26            0 : #define OS_MGMT_ID_INFO                 7
      27            0 : #define OS_MGMT_ID_BOOTLOADER_INFO      8
      28              : 
      29              : /**
      30              :  * Command result codes for OS management group.
      31              :  */
      32            1 : enum os_mgmt_err_code_t {
      33              :         /** No error, this is implied if there is no ret value in the response */
      34              :         OS_MGMT_ERR_OK = 0,
      35              : 
      36              :         /** Unknown error occurred. */
      37              :         OS_MGMT_ERR_UNKNOWN,
      38              : 
      39              :         /** The provided format value is not valid. */
      40              :         OS_MGMT_ERR_INVALID_FORMAT,
      41              : 
      42              :         /** Query was not recognized. */
      43              :         OS_MGMT_ERR_QUERY_YIELDS_NO_ANSWER,
      44              : 
      45              :         /** RTC is not set */
      46              :         OS_MGMT_ERR_RTC_NOT_SET,
      47              : 
      48              :         /** RTC command failed */
      49              :         OS_MGMT_ERR_RTC_COMMAND_FAILED,
      50              : 
      51              :         /** Query was recognized but there is no valid value for the response. */
      52              :         OS_MGMT_ERR_QUERY_RESPONSE_VALUE_NOT_VALID,
      53              : };
      54              : 
      55              : /* Bitmask values used by the os info command handler. Note that the width of this variable is
      56              :  * 32-bits, allowing 32 flags, custom user-level implementations should start at
      57              :  * OS_MGMT_INFO_FORMAT_USER_CUSTOM_START and reference that directly as additional format
      58              :  * specifiers might be added to this list in the future.
      59              :  */
      60            0 : enum os_mgmt_info_formats {
      61              :         OS_MGMT_INFO_FORMAT_KERNEL_NAME = BIT(0),
      62              :         OS_MGMT_INFO_FORMAT_NODE_NAME = BIT(1),
      63              :         OS_MGMT_INFO_FORMAT_KERNEL_RELEASE = BIT(2),
      64              :         OS_MGMT_INFO_FORMAT_KERNEL_VERSION = BIT(3),
      65              :         OS_MGMT_INFO_FORMAT_BUILD_DATE_TIME = BIT(4),
      66              :         OS_MGMT_INFO_FORMAT_MACHINE = BIT(5),
      67              :         OS_MGMT_INFO_FORMAT_PROCESSOR = BIT(6),
      68              :         OS_MGMT_INFO_FORMAT_HARDWARE_PLATFORM = BIT(7),
      69              :         OS_MGMT_INFO_FORMAT_OPERATING_SYSTEM = BIT(8),
      70              : 
      71              :         OS_MGMT_INFO_FORMAT_USER_CUSTOM_START = BIT(9),
      72              : };
      73              : 
      74              : /* Structure provided in the MGMT_EVT_OP_OS_MGMT_INFO_CHECK notification callback */
      75            0 : struct os_mgmt_info_check {
      76              :         /* Input format string from the mcumgr client */
      77            0 :         struct zcbor_string *format;
      78              :         /* Bitmask of values specifying which outputs should be present */
      79            0 :         uint32_t *format_bitmask;
      80              :         /* Number of valid format characters parsed, must be incremented by 1 for each valid
      81              :          * character
      82              :          */
      83            0 :         uint16_t *valid_formats;
      84              :         /* Needs to be set to true if the OS name is being provided by external code */
      85            0 :         bool *custom_os_name;
      86              : };
      87              : 
      88              : /* Structure provided in the MGMT_EVT_OP_OS_MGMT_INFO_APPEND notification callback */
      89            0 : struct os_mgmt_info_append {
      90              :         /* The format bitmask from the processed commands, the bits should be cleared once
      91              :          * processed, note that if all_format_specified is specified, the corresponding bits here
      92              :          * will not be set
      93              :          */
      94            0 :         uint32_t *format_bitmask;
      95              :         /* Will be true if the all 'a' specifier was provided */
      96            0 :         bool all_format_specified;
      97              :         /* The output buffer which the responses should be appended to. If prior_output is true, a
      98              :          * space must be added prior to the output response
      99              :          */
     100            0 :         uint8_t *output;
     101              :         /* The current size of the output response in the output buffer, must be updated to be the
     102              :          * size of the output response after appending data
     103              :          */
     104            0 :         uint16_t *output_length;
     105              :         /* The size of the output buffer, including null terminator character, if the output
     106              :          * response would exceed this size, the function must abort and return false to return a
     107              :          * memory error to the client
     108              :          */
     109            0 :         uint16_t buffer_size;
     110              :         /* If there has been prior output, must be set to true if a response has been output */
     111            0 :         bool *prior_output;
     112              : };
     113              : 
     114              : #ifdef __cplusplus
     115              : }
     116              : #endif
     117              : 
     118              : #endif /* H_OS_MGMT_ */
        

Generated by: LCOV version 2.0-1