summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>2024-06-28 11:48:20 +0200
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>2024-07-08 14:09:49 +0200
commit544055baa647a4c76a2050de46b9f5cbe27df0eb (patch)
treec83fa686cd94f367aed56ea908281f05b1508d97
parent1ef60d92e81e7292ea0e715ef43933004182bb95 (diff)
downloaddevice-accepted/tizen_8.0_unified.tar.gz
device-accepted/tizen_8.0_unified.tar.bz2
device-accepted/tizen_8.0_unified.zip
To allow to change the upgrade type to "offline" or "online", the api functions are added. Change-Id: I0123712e319b996a9e57b3b3d2ea060914dd7bf6
-rw-r--r--include/backend/hal-board-interface.h3
-rw-r--r--include/hal-board.h22
-rw-r--r--src/board.c32
3 files changed, 57 insertions, 0 deletions
diff --git a/include/backend/hal-board-interface.h b/include/backend/hal-board-interface.h
index 9d9e708..619ee0b 100644
--- a/include/backend/hal-board-interface.h
+++ b/include/backend/hal-board-interface.h
@@ -45,6 +45,9 @@ typedef struct _hal_backend_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_board_funcs;
#ifdef __cplusplus
diff --git a/include/hal-board.h b/include/hal-board.h
index aec56e4..5377a46 100644
--- a/include/hal-board.h
+++ b/include/hal-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/board.c b/src/board.c
index c45e444..9966d8d 100644
--- a/src/board.c
+++ b/src/board.c
@@ -415,3 +415,35 @@ int hal_device_board_get_upgrade_state(char *buffer, const int max_len)
return hal_board_funcs->get_upgrade_state(buffer, max_len);
}
+
+int hal_device_board_set_upgrade_type(char *type)
+{
+ int ret;
+
+ if (!hal_board_funcs) {
+ if ((ret = hal_device_board_get_backend()) < 0)
+ return ret;
+ }
+
+ if (!hal_board_funcs ||
+ !hal_board_funcs->set_upgrade_type)
+ return -ENODEV;
+
+ return hal_board_funcs->set_upgrade_type(type);
+}
+
+int hal_device_board_get_upgrade_type(char *buffer, const int max_len)
+{
+ int ret;
+
+ if (!hal_board_funcs) {
+ if ((ret = hal_device_board_get_backend()) < 0)
+ return ret;
+ }
+
+ if (!hal_board_funcs ||
+ !hal_board_funcs->get_upgrade_type)
+ return -ENODEV;
+
+ return hal_board_funcs->get_upgrade_type(buffer, max_len);
+}