plugin-api: common: Add SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY plugin module 19/297619/3
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 21 Aug 2023 10:12:32 +0000 (19:12 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 22 Aug 2023 10:14:42 +0000 (19:14 +0900)
Add SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY for display plugin module.

[Detailed description]
1. Newly added SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY plugin module
- module             : SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY
- library_name       : "/usr/lib/system/plugin/libplugin-backend-deviced-display.so"
- library_name_64bit : "/usr/lib64/system/plugin/libplugin-backend-deviced-display.so"
- symbol_name        : "system_plugin_backend_deviced_display_data"

2. Newly added SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY plugin api
- int syscommon_plugin_deviced_display_get_backend(void)
  : Load deviced display plugin-backend from above library_name/library_name_64bit path
- int syscommon_plugin_deviced_display_put_backend(void);
  : Unload Deviced display plugin-backend

Change-Id: I51ea96d56046d09b10d449c1455c97575837fdee
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/plugin-api/common/include/syscommon-plugin-common.h
src/plugin-api/common/src/syscommon-plugin-api-list.h
src/plugin-api/deviced/include/syscommon-plugin-deviced-display-interface.h
src/plugin-api/deviced/include/syscommon-plugin-deviced-display.h
src/plugin-api/deviced/src/syscommon-plugin-deviced-display.c

index 8caccbb..13b35d7 100644 (file)
@@ -36,6 +36,7 @@ enum syscommon_plugin_module {
        SYSCOMMON_PLUGIN_MODULE_RESOURCED_MEMORY_LMK,
        SYSCOMMON_PLUGIN_MODULE_DEVICED_BATTERY,
        SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT,
+       SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY,
        SYSCOMMON_PLUGIN_MODULE_END,
 };
 
index cf92695..29562d1 100644 (file)
@@ -54,6 +54,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_DEVICED_DISPLAY] = {
+               [0] = {
+                       .platform_abi_version           = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
+                       .backend_min_abi_version        = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
+               },
+       },
 };
 
 static struct __plugin_module_info g_plugin_module_info[] = {
@@ -93,6 +99,18 @@ static struct __plugin_module_info g_plugin_module_info[] = {
                .num_abi_versions       = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT]),
                .abi_versions           = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT],
        },
+       [SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY] = {
+               .group                  = PLUGIN_GROUP_DEVICED,
+               .module                 = SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY,
+               .license                = PLUGIN_LICENSE_APACHE_2_0,
+               .module_name            = "SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY",
+               .backend_module_name    = "deviced-display",
+               .library_name           = "/usr/lib/system/plugin/libplugin-backend-deviced-display.so",
+               .library_name_64bit     = "/usr/lib64/system/plugin/libplugin-backend-deviced-display.so",
+               .symbol_name            = "system_plugin_backend_deviced_display_data",
+               .num_abi_versions       = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY]),
+               .abi_versions           = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY],
+       },
 };
 
 #endif /* __PLUGIN_API_LIST_H__ */
index 7f09817..aec7526 100644 (file)
@@ -127,6 +127,10 @@ enum syscommon_deviced_display_capability {
 
 #define DEVICED_DISPLAY_SCREEN_TIMEOUT_INFINITE                        ((~0) >> 1)
 
+typedef struct _syscommon_plugin_backend_deviced_display_funcs {
+       /* NONE */
+} syscommon_plugin_backend_deviced_display_funcs;
+
 #ifdef __cplusplus
 }
 #endif
index bd6c437..1e7a034 100644 (file)
 extern "C" {
 #endif
 
-#include <system/syscommon-plugin-deviced-common-interface.h>
-#include <system/syscommon-plugin-deviced-display-interface.h>
+#include "syscommon-plugin-deviced-common-interface.h"
+#include "syscommon-plugin-deviced-display-interface.h"
+
+/**
+ * @brief Get the backend data of deviced-display module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_deviced_display_get_backend(void);
+
+/**
+ * @brief Put the backend data of deviced-display module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_deviced_display_put_backend(void);
 
 #ifdef __cplusplus
 }
index f07bd13..ba04d4e 100644 (file)
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#include <glib.h>
+
+#include "syscommon-plugin-common.h"
+
+#include "common.h"
+#include "syscommon-plugin-deviced-display.h"
+#include "syscommon-plugin-deviced-display-interface.h"
+
+#ifndef EXPORT
+#define EXPORT __attribute__((visibility("default")))
+#endif
+
+static syscommon_plugin_backend_deviced_display_funcs *g_display_funcs = NULL;
+
+EXPORT
+int syscommon_plugin_deviced_display_get_backend(void)
+{
+       int ret = 0;
+
+       if (g_display_funcs)
+               return 0;
+
+       ret = syscommon_plugin_common_get_backend(
+                               SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY,
+                               (void **)&g_display_funcs);
+       if (ret < 0) {
+               _E("Failed to get deviced_display backend: %d", ret);
+               return ret;
+       }
+
+       _I("Success to get deviced_display backend: %d", ret);
+
+       return 0;
+}
+
+EXPORT
+int syscommon_plugin_deviced_display_put_backend(void)
+{
+       int ret = 0;
+
+       if (!g_display_funcs)
+               return 0;
+
+       ret = syscommon_plugin_common_put_backend(
+                               SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY,
+                               (void *)g_display_funcs);
+       if (ret < 0) {
+               _E("Failed to put deviced_display backend: %d", ret);
+               return ret;
+       }
+       g_display_funcs = NULL;
+
+       _I("Success to put deviced_display backend: %d", ret);
+
+       return 0;
+}