summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--packaging/libsyscommon.spec37
-rw-r--r--src/plugin-api/common/include/system/syscommon-plugin-common-interface.h2
-rw-r--r--src/plugin-api/common/include/system/syscommon-plugin-common.h1
-rw-r--r--src/plugin-api/common/src/common.h8
-rw-r--r--src/plugin-api/common/src/syscommon-plugin-api-list.h18
-rw-r--r--src/plugin-api/update-control/CMakeLists.txt68
-rw-r--r--src/plugin-api/update-control/include/system/syscommon-plugin-update-control-interface.h80
-rw-r--r--src/plugin-api/update-control/include/system/syscommon-plugin-update-control.h99
-rw-r--r--src/plugin-api/update-control/libsyscommon-plugin-api-update-control.pc.in17
-rw-r--r--src/plugin-api/update-control/src/syscommon-plugin-update-control.c172
11 files changed, 499 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f708755..87314e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_SUBDIRECTORY(src/plugin-api/common)
ADD_SUBDIRECTORY(src/plugin-api/resourced)
ADD_SUBDIRECTORY(src/plugin-api/deviced)
+ADD_SUBDIRECTORY(src/plugin-api/update-control)
# ADD_SUBDIRECTORY(src/libgdbus)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
diff --git a/packaging/libsyscommon.spec b/packaging/libsyscommon.spec
index 4d2d613..1d112a6 100644
--- a/packaging/libsyscommon.spec
+++ b/packaging/libsyscommon.spec
@@ -2,6 +2,7 @@
%define libsyscommon_plugin_api_common_version 0.1.0
%define libsyscommon_plugin_api_resourced_version 0.1.0
%define libsyscommon_plugin_api_deviced_version 0.1.0
+%define libsyscommon_plugin_api_update_control_version 0.1.0
Name: libsyscommon
Summary: System Libraries
@@ -83,6 +84,22 @@ License: MIT
%description -n libsyscommon-plugin-api-deviced-devel
Development header files for system plugin APIs for the deviced.
+%package -n libsyscommon-plugin-api-update-control
+Summary: System plugin API for the update-control
+Version: %{libsyscommon_plugin_api_update_control_version}
+License: MIT
+
+%description -n libsyscommon-plugin-api-update-control
+System plugin API for update-control.
+
+%package -n libsyscommon-plugin-api-update-control-devel
+Summary: Header files for system plugin API for update-control
+Version: %{libsyscommon_plugin_api_update_control_version}
+License: MIT
+
+%description -n libsyscommon-plugin-api-update-control-devel
+Development header files for system plugin API for update-control.
+
######
@@ -95,6 +112,7 @@ cp %{SOURCE1001} .
PLUGIN_API_COMMON_MAJORVER=$(echo %{libsyscommon_plugin_api_common_version} | cut -d'.' -f1)
PLUGIN_API_RESOURCED_MAJORVER=$(echo %{libsyscommon_plugin_api_resourced_version} | cut -d'.' -f1)
PLUGIN_API_DEVICED_MAJORVER=$(echo %{libsyscommon_plugin_api_deviced_version} | cut -d'.' -f1)
+PLUGIN_API_UPDATE_CONTROL_MAJORVER=$(echo %{libsyscommon_plugin_api_update_control} | cut -d'.' -f1)
%cmake . -DFULLVER=%{libsyscommon_version} \
-DPLUGIN_API_COMMON_VERSION=%{libsyscommon_plugin_api_common_version} \
-DPLUGIN_API_COMMON_MAJORVER=${PLUGIN_API_COMMON_MAJORVER} \
@@ -102,9 +120,12 @@ PLUGIN_API_DEVICED_MAJORVER=$(echo %{libsyscommon_plugin_api_deviced_version} |
-DPLUGIN_API_RESOURCED_MAJORVER=${PLUGIN_API_RESOURCED_MAJORVER} \
-DPLUGIN_API_DEVICED_VERSION=%{libsyscommon_plugin_api_deviced_version} \
-DPLUGIN_API_DEVICED_MAJORVER=${PLUGIN_API_DEVICED_MAJORVER} \
+ -DPLUGIN_API_UPDATE_CONTROL_VERSION=%{libsyscommon_plugin_api_update_control_version} \
+ -DPLUGIN_API_UPDATE_CONTROL_MAJORVER=${PLUGIN_API_UPDATE_CONTROL_MAJORVER} \
-DPLUGIN_API_COMMON_ENABLE_DLOG=1 \
-DPLUGIN_API_RESOURCED_ENABLE_DLOG=1 \
- -DPLUGIN_API_DEVICED_ENABLE_DLOG=1
+ -DPLUGIN_API_DEVICED_ENABLE_DLOG=1 \
+ -DPLUGIN_API_UPDATE_CONTROL_ENABLE_DLOG=1
make %{?_smp_mflags}
%install
@@ -183,3 +204,17 @@ Common system plugin APIs to load another APIs from backend.
%{_includedir}/system/syscommon-plugin-deviced*.h
%{_libdir}/pkgconfig/libsyscommon-plugin-api-deviced.pc
%{_libdir}/libsyscommon-plugin-api-deviced.so
+
+%files -n libsyscommon-plugin-api-update-control
+%defattr(-,root,root,-)
+%manifest %{name}.manifest
+%license LICENSE.MIT
+%{_libdir}/libsyscommon-plugin-api-update-control.so.*
+
+%files -n libsyscommon-plugin-api-update-control-devel
+%defattr(-,root,root,-)
+%manifest %{name}.manifest
+%license LICENSE.MIT
+%{_includedir}/system/syscommon-plugin-update-control*.h
+%{_libdir}/pkgconfig/libsyscommon-plugin-api-update-control.pc
+%{_libdir}/libsyscommon-plugin-api-update-control.so
diff --git a/src/plugin-api/common/include/system/syscommon-plugin-common-interface.h b/src/plugin-api/common/include/system/syscommon-plugin-common-interface.h
index 2345cde..7172d65 100644
--- a/src/plugin-api/common/include/system/syscommon-plugin-common-interface.h
+++ b/src/plugin-api/common/include/system/syscommon-plugin-common-interface.h
@@ -33,6 +33,7 @@ enum syscommon_plugin_abi_version {
SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN = 0,
SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_7_0,
SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
+ SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_9_0,
SYSCOMMON_PLUGIN_ABI_VERSION_END,
};
@@ -40,6 +41,7 @@ static const char *const syscommon_plugin_abi_version_str[] = {
[SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN] = "Unknown PLUGIN ABI Version",
[SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_7_0] = "PLUGIN_ABI_VERSION_TIZEN_7_0",
[SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0] = "PLUGIN_ABI_VERSION_TIZEN_8_0",
+ [SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_9_0] = "PLUGIN_ABI_VERSION_TIZEN_9_0",
};
typedef struct __syscommon_plugin_backend {
diff --git a/src/plugin-api/common/include/system/syscommon-plugin-common.h b/src/plugin-api/common/include/system/syscommon-plugin-common.h
index 528c339..81d1081 100644
--- a/src/plugin-api/common/include/system/syscommon-plugin-common.h
+++ b/src/plugin-api/common/include/system/syscommon-plugin-common.h
@@ -38,6 +38,7 @@ enum syscommon_plugin_module {
SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT,
SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY,
SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING,
+ SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL,
SYSCOMMON_PLUGIN_MODULE_END,
};
diff --git a/src/plugin-api/common/src/common.h b/src/plugin-api/common/src/common.h
index 60178e2..e654ddc 100644
--- a/src/plugin-api/common/src/common.h
+++ b/src/plugin-api/common/src/common.h
@@ -47,13 +47,15 @@ enum plugin_group {
PLUGIN_GROUP_UNKNOWN = 0,
PLUGIN_GROUP_RESOURCED,
PLUGIN_GROUP_DEVICED,
+ PLUGIN_GROUP_UPDATE_CONTROL,
PLUGIN_GROUP_END,
};
static const char *const plugin_group_string[] = {
- [PLUGIN_GROUP_UNKNOWN] = "PLUGIN_GROUP_UNKNOWN",
- [PLUGIN_GROUP_RESOURCED] = "PLUGIN_GROUP_RESOURCED",
- [PLUGIN_GROUP_DEVICED] = "PLUGIN_GROUP_DEVICED",
+ [PLUGIN_GROUP_UNKNOWN] = "PLUGIN_GROUP_UNKNOWN",
+ [PLUGIN_GROUP_RESOURCED] = "PLUGIN_GROUP_RESOURCED",
+ [PLUGIN_GROUP_DEVICED] = "PLUGIN_GROUP_DEVICED",
+ [PLUGIN_GROUP_UPDATE_CONTROL] = "PLUGIN_GROUP_UPDATE_CONTROL",
};
/**
diff --git a/src/plugin-api/common/src/syscommon-plugin-api-list.h b/src/plugin-api/common/src/syscommon-plugin-api-list.h
index 248d699..7904b87 100644
--- a/src/plugin-api/common/src/syscommon-plugin-api-list.h
+++ b/src/plugin-api/common/src/syscommon-plugin-api-list.h
@@ -66,6 +66,12 @@ static struct plugin_abi_version_match abi_version_match_data[SYSCOMMON_PLUGIN_M
.backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
},
},
+ [SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL] = {
+ [0] = {
+ .platform_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_9_0,
+ .backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_9_0,
+ },
+ },
};
static struct __plugin_module_info g_plugin_module_info[] = {
@@ -129,6 +135,18 @@ static struct __plugin_module_info g_plugin_module_info[] = {
.num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING]),
.abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING],
},
+ [SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL] = {
+ .group = PLUGIN_GROUP_UPDATE_CONTROL,
+ .module = SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL,
+ .license = PLUGIN_LICENSE_APACHE_2_0,
+ .module_name = "SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL",
+ .backend_module_name = "update-control",
+ .library_name = "/usr/lib/system/plugin/libplugin-backend-update-control.so",
+ .library_name_64bit = "/usr/lib64/system/plugin/libplugin-backend-update-control.so",
+ .symbol_name = "system_plugin_backend_update_control_data",
+ .num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL]),
+ .abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL],
+ },
};
#endif /* __PLUGIN_API_LIST_H__ */
diff --git a/src/plugin-api/update-control/CMakeLists.txt b/src/plugin-api/update-control/CMakeLists.txt
new file mode 100644
index 0000000..1e76cd8
--- /dev/null
+++ b/src/plugin-api/update-control/CMakeLists.txt
@@ -0,0 +1,68 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(syscommon-plugin-api-update-control)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "${PREFIX}/bin")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "${PREFIX}/include/system")
+SET(VERSION ${PLUGIN_API_UPDATE_CONTROL_VERSION})
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+# Including below should be removed if the repository of
+# syscommon-plugin-api-common is separated.
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../common/include)
+
+if (${PLUGIN_API_DEVICED_ENABLE_DLOG})
+ SET(PKG_MODULES
+ glib-2.0
+ dlog)
+ ADD_DEFINITIONS("-DENABLE_DLOG")
+ ADD_DEFINITIONS("-DLOG_TAG=\"SYSTEM_PLUGIN_API_UPDATE_CONTROL\"")
+else()
+ SET(PKG_MODULES
+ glib-2.0)
+endif()
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED ${PKG_MODULES})
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -fPIC")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -lrt")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+# syscommon-plugin-api-common.c and syscommon-plugin-api-conf.c are unnecessary
+# if the repository of syscommon-plugin-api-common is separated.
+# Please remove them from SRCS and add 'syscommon-plugin-api-common'
+# to PKG_MODULES.
+SET(SRCS src/syscommon-plugin-update-control.c
+ ../common/src/syscommon-plugin-api-common.c
+ ../common/src/syscommon-plugin-api-conf.c)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}
+ -ldl -Wl,-z,nodelete,--no-undefined)
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PLUGIN_API_UPDATE_CONTROL_VERSION})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PLUGIN_API_UPDATE_CONTROL_MAJORVER})
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/system/
+ DESTINATION ${INCLUDEDIR}
+ FILES_MATCHING PATTERN "*.h"
+)
+
+# CONFIGURE .pc FILE
+FOREACH(include_dirs ${pkgs_INCLUDE_DIRS})
+ SET(PLUGIN_UPDATE_CONTROL_INCLUDEDIR "${PLUGIN_UPDATE_CONTROL_INCLUDEDIR} -I${include_dirs}")
+ENDFOREACH(include_dirs)
+FOREACH(libraries ${pkgs_LIBRARIES})
+ SET(PLUGIN_UPDATE_CONTROL_LIBS "${PLUGIN_UPDATE_CONTROL_LIBS} -l${libraries}")
+ENDFOREACH(libraries)
+SET(PACKAGE_CONFIG_FILE "lib${PROJECT_NAME}.pc")
+CONFIGURE_FILE(${PACKAGE_CONFIG_FILE}.in ${PACKAGE_CONFIG_FILE} @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_CONFIG_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
diff --git a/src/plugin-api/update-control/include/system/syscommon-plugin-update-control-interface.h b/src/plugin-api/update-control/include/system/syscommon-plugin-update-control-interface.h
new file mode 100644
index 0000000..16a7343
--- /dev/null
+++ b/src/plugin-api/update-control/include/system/syscommon-plugin-update-control-interface.h
@@ -0,0 +1,80 @@
+/**
+ * MIT License
+ *
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef __SYSCOMMON_PLUGIN_UPDATE_CONTROL_INTERFACE_H__
+#define __SYSCOMMON_PLUGIN_UPDATE_CONTROL_INTERFACE_H__
+
+#include <tizen.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ SYSCOMMON_UPDATE_CONTROL_ERROR_NONE = TIZEN_ERROR_NONE,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_FILE_NO_SPACE_ON_DEVICE = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_KEY_NOT_FOUND = TIZEN_ERROR_KEY_NOT_AVAILABLE,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_KEY_REJECTED = TIZEN_ERROR_KEY_REJECTED,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_CONNECTION_ABORTED = TIZEN_ERROR_CONNECTION_ABORTED,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_CONNECTION_REFUSED = TIZEN_ERROR_CONNECTION_REFUSED,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_PROTOCOL_NOT_SUPPORTED = TIZEN_ERROR_PROTOCOL_NOT_SUPPORTED,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_PACKAGE = TIZEN_ERROR_UPDATE_CONTROL | 0x01,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_URI = TIZEN_ERROR_UPDATE_CONTROL | 0x02,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_PACKAGE_NOT_SUPPORTED = TIZEN_ERROR_UPDATE_CONTROL | 0x03,
+ SYSCOMMON_UPDATE_CONTROL_ERROR_SYSTEM_ERROR = TIZEN_ERROR_UPDATE_CONTROL | 0x04,
+} syscommon_update_control_error_e;
+
+typedef enum {
+ SYSCOMMON_UPDATE_CONTROL_PROPERTY_NEW_VERSION = 0,
+ SYSCOMMON_UPDATE_CONTROL_PROPERTY_PACKAGE_URI,
+ SYSCOMMON_UPDATE_CONTROL_PROPERTY_RESULT,
+ SYSCOMMON_UPDATE_CONTROL_PROPERTY_PACKAGE_SIZE,
+ SYSCOMMON_UPDATE_CONTROL_PROPERTY_DESCRIPTION,
+ SYSCOMMON_UPDATE_CONTROL_PROPERTY_UPDATE_AVAILABLE,
+} syscommon_update_control_property_e;
+
+typedef struct _syscommon_plugin_backend_update_control_funcs {
+ int (*update_control_initialize) (void);
+ int (*update_control_deinitialize) (void);
+ int (*update_control_check_new_version) (void);
+ int (*update_control_download_package) (void);
+ int (*update_control_do_update) (void);
+ int (*update_control_make_reservation) (struct tm *);
+ int (*update_control_cancel_reservation) (void);
+ int (*update_control_get_property) (syscommon_update_control_property_e, void **);
+
+} syscommon_plugin_backend_update_control_funcs;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__SYSCOMMON_PLUGIN_UPDATE_CONTROL_INTERFACE_H__
diff --git a/src/plugin-api/update-control/include/system/syscommon-plugin-update-control.h b/src/plugin-api/update-control/include/system/syscommon-plugin-update-control.h
new file mode 100644
index 0000000..ffaaedf
--- /dev/null
+++ b/src/plugin-api/update-control/include/system/syscommon-plugin-update-control.h
@@ -0,0 +1,99 @@
+/**
+ * MIT License
+ *
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef __SYSCOMMON_PLUGIN_UPDATE_CONTROL_H__
+#define __SYSCOMMON_PLUGIN_UPDATE_CONTROL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <system/syscommon-plugin-update-control-interface.h>
+
+/**
+ * @brief Get the backend data of update-control-plugin module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_get_backend(int *backend_exists);
+
+/**
+ * @brief Put the backend data of update-control-plugin module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_put_backend(void);
+
+/**
+ * @brief Call the update_control_initialize function of update-control-plugin module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_initialize(void);
+
+/**
+ * @brief Call the update_control_deinitialize function of update-control-plugin module
+ * Call this before calling syscommon_plugin_update_control_put_backend()
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_deinitialize(void);
+
+/**
+ * @brief Call the update_control_check_new_version function of update-control-plugin module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_check_new_version(void);
+
+/**
+ * @brief Call the update_control_download_package function of update-control-plugin module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_download_package(void);
+
+/**
+ * @brief Call the update_control_do_update function of update-control-plugin module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_do_update(void);
+
+/**
+ * @brief Call the update_control_make_reservation function of update-control-plugin module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_make_reservation(struct tm *reservation_time);
+
+/**
+ * @brief Call the update_control_cancel_reservation function of update-control-plugin module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_cancel_reservation(void);
+
+/**
+ * @brief Call the update_control_get_property function of update-control-plugin module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_update_control_get_property(syscommon_update_control_property_e property, void **value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__SYSCOMMON_PLUGIN_UPDATE_CONTROL_H__
diff --git a/src/plugin-api/update-control/libsyscommon-plugin-api-update-control.pc.in b/src/plugin-api/update-control/libsyscommon-plugin-api-update-control.pc.in
new file mode 100644
index 0000000..04393e2
--- /dev/null
+++ b/src/plugin-api/update-control/libsyscommon-plugin-api-update-control.pc.in
@@ -0,0 +1,17 @@
+# Package Information for pkg-config
+#
+# Copyright (c) 2024 Samsung Electronics Co., Ltd.
+# All rights reserved.
+#
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: libsyscommon-plugin-api-update-control
+Description: System plugin API for update-control
+Version: @VERSION@
+Requires.private: libsyscommon-plugin-api-common
+Cflags: -I${includedir} @PLUGIN_UPDATE_CONTROL_INCLUDEDIR@
+Libs: -L${libdir} -lsyscommon-plugin-api-update-control @PLUGIN_UPDATE_CONTROL_LIBS@
diff --git a/src/plugin-api/update-control/src/syscommon-plugin-update-control.c b/src/plugin-api/update-control/src/syscommon-plugin-update-control.c
new file mode 100644
index 0000000..6fd20f3
--- /dev/null
+++ b/src/plugin-api/update-control/src/syscommon-plugin-update-control.c
@@ -0,0 +1,172 @@
+/**
+ * MIT License
+ *
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include <libsyscommon/log.h>
+
+#include <system/syscommon-plugin-common.h>
+#include <system/syscommon-plugin-update-control.h>
+#include <system/syscommon-plugin-update-control-interface.h>
+
+#ifndef EXPORT
+#define EXPORT __attribute__((visibility("default")))
+#endif
+
+static syscommon_plugin_backend_update_control_funcs *funcs = NULL;
+
+EXPORT
+int syscommon_plugin_update_control_get_backend(int *backend_exists)
+{
+ if (funcs)
+ goto get_backend_success;
+
+ int ret = syscommon_plugin_common_get_backend(
+ SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL,
+ (void **)&funcs);
+
+ if (ret < 0) {
+ if ((ret == -ENOENT) && backend_exists) {
+ _I("update-control backend was not found");
+ *backend_exists = 0;
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_NONE;
+ }
+
+ _E("Failed to get update-control backend: %d", ret);
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_SYSTEM_ERROR;
+ }
+
+ _I("Success to get update-control backend: %d", ret);
+
+get_backend_success:
+ if (backend_exists)
+ *backend_exists = 1;
+
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_NONE;
+}
+
+EXPORT
+int syscommon_plugin_update_control_put_backend(void)
+{
+ if (!funcs)
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_NONE;
+
+ int ret = syscommon_plugin_common_put_backend(
+ SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL,
+ (void *)funcs);
+ if (ret < 0) {
+ _E("Failed to put update-control backend: %d", ret);
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_SYSTEM_ERROR;
+ }
+ funcs = NULL;
+
+ _I("Success to put update-control backend: %d", ret);
+
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_NONE;
+}
+
+EXPORT
+int syscommon_plugin_update_control_initialize(void)
+{
+ if (!funcs || !funcs->update_control_initialize) {
+ _E("No backend or no \"update_control_initialize\" function");
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_OPERATION;
+ }
+
+ return funcs->update_control_initialize();
+}
+
+EXPORT
+int syscommon_plugin_update_control_deinitialize(void)
+{
+ if (!funcs || !funcs->update_control_deinitialize) {
+ _E("No backend or no \"update_control_deinitialize\" function");
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_OPERATION;
+ }
+
+ return funcs->update_control_deinitialize();
+}
+
+EXPORT
+int syscommon_plugin_update_control_check_new_version(void)
+{
+ if (!funcs || !funcs->update_control_check_new_version) {
+ _E("No backend or no \"update_control_check_new_version\" function");
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_OPERATION;
+ }
+
+ return funcs->update_control_check_new_version();
+}
+
+EXPORT
+int syscommon_plugin_update_control_download_package(void)
+{
+ if (!funcs || !funcs->update_control_download_package) {
+ _E("No backend or no \"update_control_download_package\" function");
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_OPERATION;
+ }
+
+ return funcs->update_control_download_package();
+}
+
+EXPORT
+int syscommon_plugin_update_control_do_update(void)
+{
+ if (!funcs || !funcs->update_control_do_update) {
+ _E("No backend or no \"update_control_do_update\" function");
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_OPERATION;
+ }
+
+ return funcs->update_control_do_update();
+}
+
+EXPORT
+int syscommon_plugin_update_control_make_reservation(struct tm *reservation_time)
+{
+ if (!funcs || !funcs->update_control_make_reservation) {
+ _E("No backend or no \"update_control_make_reservation\" function");
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_OPERATION;
+ }
+
+ return funcs->update_control_make_reservation(reservation_time);
+}
+
+EXPORT
+int syscommon_plugin_update_control_cancel_reservation(void)
+{
+ if (!funcs || !funcs->update_control_cancel_reservation) {
+ _E("No backend or no \"update_control_cancel_reservation\" function");
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_OPERATION;
+ }
+
+ return funcs->update_control_cancel_reservation();
+}
+
+EXPORT
+int syscommon_plugin_update_control_get_property(syscommon_update_control_property_e property, void **value)
+{
+ if (!funcs || !funcs->update_control_get_property) {
+ _E("No backend or no \"update_control_get_property\" function");
+ return SYSCOMMON_UPDATE_CONTROL_ERROR_INVALID_OPERATION;
+ }
+
+ return funcs->update_control_get_property(property, value);
+}