diff options
author | Mateusz Moscicki <m.moscicki2@partner.samsung.com> | 2024-06-28 11:48:20 +0200 |
---|---|---|
committer | Mateusz Moscicki <m.moscicki2@partner.samsung.com> | 2024-07-01 15:01:46 +0200 |
commit | 71c964ff2b59c61a51da19495421e5cdf08ddc72 (patch) | |
tree | 764a2ee2fdbefd4ddcc2e4d7e34f6aa6e662f723 | |
parent | bb0bffde3e2414e5b811d5078033dc950c796bc4 (diff) | |
download | device-71c964ff2b59c61a51da19495421e5cdf08ddc72.tar.gz device-71c964ff2b59c61a51da19495421e5cdf08ddc72.tar.bz2 device-71c964ff2b59c61a51da19495421e5cdf08ddc72.zip |
Add upgrade type featuretizen_9.0_m2_releaseaccepted/tizen/unified/x/asan/20240813.231743accepted/tizen/unified/x/20240708.014822accepted/tizen/unified/toolchain/20240812.133305accepted/tizen/unified/dev/20240709.043437accepted/tizen/unified/20240708.173203accepted/tizen/9.0/unified/20241030.233136tizen_9.0tizenaccepted/tizen_unified_x_asanaccepted/tizen_unified_xaccepted/tizen_unified_toolchainaccepted/tizen_unified_devaccepted/tizen_unifiedaccepted/tizen_9.0_unified
To allow to change the upgrade type to "offline" or "online", the api
functions are added.
Change-Id: I0123712e319b996a9e57b3b3d2ea060914dd7bf6
-rw-r--r-- | include/hal-device-board-interface-1.h | 3 | ||||
-rw-r--r-- | include/hal-device-board.h | 22 | ||||
-rw-r--r-- | src/hal-api-device-board.c | 32 |
3 files changed, 57 insertions, 0 deletions
diff --git a/include/hal-device-board-interface-1.h b/include/hal-device-board-interface-1.h index 95c6dcc..98fd6bd 100644 --- a/include/hal-device-board-interface-1.h +++ b/include/hal-device-board-interface-1.h @@ -45,6 +45,9 @@ typedef struct _hal_backend_device_board_funcs { int (*set_upgrade_state)(char *state); int (*get_upgrade_state)(char *buffer, const int max_len); + + int (*set_upgrade_type)(char *type); + int (*get_upgrade_type)(char *buffer, const int max_len); } hal_backend_device_board_funcs; #ifdef __cplusplus diff --git a/include/hal-device-board.h b/include/hal-device-board.h index 2f6347a..e5e27af 100644 --- a/include/hal-device-board.h +++ b/include/hal-device-board.h @@ -210,6 +210,28 @@ int hal_device_board_set_upgrade_state(char *state_from, char *state_to); */ int hal_device_board_get_upgrade_state(char *buffer, const int max_len); +/** + * @brief Get upgrade type + * + * @param[out] buffer Upgrade type + * @param[in] max_len Buffer size + * + * At most (max_len - 1) bytes of the state string will be copied to the buffer argument, + * and NULL is finally appended at the end of the string. + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_get_upgrade_type(char *buffer, const int max_len); + +/** + * @brief Set upgrade type + * + * @param[in] type Upgrade type + * + * @return 0 on success, otherwise a negative error value + */ +int hal_device_board_set_upgrade_type(char *type); + #ifdef __cplusplus } #endif diff --git a/src/hal-api-device-board.c b/src/hal-api-device-board.c index 00dac68..8d34329 100644 --- a/src/hal-api-device-board.c +++ b/src/hal-api-device-board.c @@ -414,3 +414,35 @@ int hal_device_board_get_upgrade_state(char *buffer, const int max_len) return hal_device_board_funcs->get_upgrade_state(buffer, max_len); } + +int hal_device_board_set_upgrade_type(char *type) +{ + int ret; + + if (!hal_device_board_funcs) { + if ((ret = hal_device_board_get_backend()) < 0) + return ret; + } + + if (!hal_device_board_funcs || + !hal_device_board_funcs->set_upgrade_type) + return -ENODEV; + + return hal_device_board_funcs->set_upgrade_type(type); +} + +int hal_device_board_get_upgrade_type(char *buffer, const int max_len) +{ + int ret; + + if (!hal_device_board_funcs) { + if ((ret = hal_device_board_get_backend()) < 0) + return ret; + } + + if (!hal_device_board_funcs || + !hal_device_board_funcs->get_upgrade_type) + return -ENODEV; + + return hal_device_board_funcs->get_upgrade_type(buffer, max_len); +} |