From: Chanwoo Choi Date: Tue, 22 Aug 2023 10:43:10 +0000 (+0900) Subject: plugin-api: Change the header including style and remove duplicate common.h X-Git-Tag: accepted/tizen/unified/20230825.044252~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F69%2F297669%2F2;p=platform%2Fcore%2Fsystem%2Flibsyscommon.git plugin-api: Change the header including style and remove duplicate common.h In order to specify the path of header file, change the header including style as following and the remove the duplicated common.h including log macro. - Before header including style #include "syscommon-plugin-common.h" #include "syscommon-plugin-common-interface.h" - After header including style #include #include Change-Id: I723114be26e7891661dcc7ac02fd7d1ceb8dc0a1 Signed-off-by: Chanwoo Choi --- diff --git a/src/plugin-api/common/CMakeLists.txt b/src/plugin-api/common/CMakeLists.txt index 666d51f..d6eea2b 100644 --- a/src/plugin-api/common/CMakeLists.txt +++ b/src/plugin-api/common/CMakeLists.txt @@ -47,7 +47,7 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_LDFLAGS} SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) -INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/system/ DESTINATION ${INCLUDEDIR} FILES_MATCHING PATTERN "*.h") diff --git a/src/plugin-api/common/include/syscommon-plugin-common-interface.h b/src/plugin-api/common/include/syscommon-plugin-common-interface.h deleted file mode 100644 index 2345cde..0000000 --- a/src/plugin-api/common/include/syscommon-plugin-common-interface.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_COMMON_INTERFACE__ -#define __SYSCOMMON_PLUGIN_COMMON_INTERFACE__ - -#ifdef __cplusplus -extern "C" { -#endif - -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_END, -}; - -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", -}; - -typedef struct __syscommon_plugin_backend { - const char *name; - const char *vendor; - const unsigned int abi_version; - int (*init) (void **data); - int (*exit) (void *data); -} syscommon_plugin_backend; - -#ifdef __cplusplus -} -#endif -#endif /* __SYSCOMMON_PLUGIN_COMMON_INTERFACE__ */ diff --git a/src/plugin-api/common/include/syscommon-plugin-common.h b/src/plugin-api/common/include/syscommon-plugin-common.h deleted file mode 100644 index 13b35d7..0000000 --- a/src/plugin-api/common/include/syscommon-plugin-common.h +++ /dev/null @@ -1,171 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_COMMON__ -#define __SYSCOMMON_PLUGIN_COMMON__ - -#include "syscommon-plugin-common-interface.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum syscommon_plugin_module { - SYSCOMMON_PLUGIN_MODULE_UNKNOWN = 0, - 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, -}; - -/** - * @brief Get the backend library name according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[out] Backend Library name of PLUGIN module - * @param[in] Arrary size of name[] - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_get_backend_library_name( - enum syscommon_plugin_module module, - char *name, int size); - -/** - * @brief Get the backend symbol name according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[out] Backend symbol name of PLUGIN module - * @param[in] Arrary size of name[] - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_get_backend_symbol_name( - enum syscommon_plugin_module module, char *name, int size); - -/** - * @brief Get the backend data according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[out] Data pointer where 'plugin_backend_[module]_funcs' instance - * should be stored from PLUGIN backend binary. - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_get_backend(enum syscommon_plugin_module module, - void **data); - -/** - * @brief Put the backend data according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[in] Data pointer where 'plugin_backend_[module]_funcs' instance - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_put_backend(enum syscommon_plugin_module module, - void *data); - -/** - * @brief Get the backend data with the specific library name according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[out] Data pointer where 'plugin_backend_[module]_funcs' instance - * should be stored from PLUGIN backend binary. - * @param[in] PLUGIN backend library name which is not default library name - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_get_backend_with_library_name( - enum syscommon_plugin_module module, - void **data, const char *library_name); - -/** - * @brief Put the backend data with the specific library name according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[in] Data pointer where 'plugin_backend_[module]_funcs' instance - * @param[in] PLUGIN backend library name which is not default library name - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_put_backend_with_library_name( - enum syscommon_plugin_module module, - void *data, const char *library_name); - -/** - * @brief Check PLUGIN ABI version whehter is suppored or not on current platform - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[in] PLUGIN ABI version of backend module among enum plugin_abi_version - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_check_backend_abi_version( - enum syscommon_plugin_module module, - enum syscommon_plugin_abi_version abi_version); - -/** - * @brief Get the backend PLUGIN ABI version according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @return @c positive integer value on success, otherwise a zero error value - */ -unsigned int syscommon_plugin_common_get_backend_abi_version( - enum syscommon_plugin_module module); - -/** - * @brief Get the backend name according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[out] Backend name of PLUGIN module - * @param[in] Arrary size of name[] - * @return @c positive integer value on success, otherwise a zero error value - */ -int syscommon_plugin_common_get_backend_name( - enum syscommon_plugin_module module, - char *name, int size); - -/** - * @brief Get the backend vendor description according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[out] Backend vendor description of PLUGIN module - * @param[in] Arrary size of vendor[] - * @return @c positive integer value on success, otherwise a zero error value - */ -int syscommon_plugin_common_get_backend_vendor( - enum syscommon_plugin_module module, - char *vendor, int size); - -/** - * @brief Get the number of the backend libraries according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_get_backend_count( - enum syscommon_plugin_module module); - -/** - * @brief Get the backend library names according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[out] Data pointer should be filled by backend library names - * @param[in] Number of backend library of specific PLUGIN module - * @param[in] Maximum length of the library name - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_get_backend_library_names( - enum syscommon_plugin_module module, - char **library_names, - int library_count, - int library_name_size); - -#ifdef __cplusplus -} -#endif -#endif /* __SYSCOMMON_PLUGIN_COMMON__ */ 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 new file mode 100644 index 0000000..2345cde --- /dev/null +++ b/src/plugin-api/common/include/system/syscommon-plugin-common-interface.h @@ -0,0 +1,56 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_COMMON_INTERFACE__ +#define __SYSCOMMON_PLUGIN_COMMON_INTERFACE__ + +#ifdef __cplusplus +extern "C" { +#endif + +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_END, +}; + +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", +}; + +typedef struct __syscommon_plugin_backend { + const char *name; + const char *vendor; + const unsigned int abi_version; + int (*init) (void **data); + int (*exit) (void *data); +} syscommon_plugin_backend; + +#ifdef __cplusplus +} +#endif +#endif /* __SYSCOMMON_PLUGIN_COMMON_INTERFACE__ */ diff --git a/src/plugin-api/common/include/system/syscommon-plugin-common.h b/src/plugin-api/common/include/system/syscommon-plugin-common.h new file mode 100644 index 0000000..13b35d7 --- /dev/null +++ b/src/plugin-api/common/include/system/syscommon-plugin-common.h @@ -0,0 +1,171 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_COMMON__ +#define __SYSCOMMON_PLUGIN_COMMON__ + +#include "syscommon-plugin-common-interface.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum syscommon_plugin_module { + SYSCOMMON_PLUGIN_MODULE_UNKNOWN = 0, + 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, +}; + +/** + * @brief Get the backend library name according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[out] Backend Library name of PLUGIN module + * @param[in] Arrary size of name[] + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_common_get_backend_library_name( + enum syscommon_plugin_module module, + char *name, int size); + +/** + * @brief Get the backend symbol name according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[out] Backend symbol name of PLUGIN module + * @param[in] Arrary size of name[] + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_common_get_backend_symbol_name( + enum syscommon_plugin_module module, char *name, int size); + +/** + * @brief Get the backend data according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[out] Data pointer where 'plugin_backend_[module]_funcs' instance + * should be stored from PLUGIN backend binary. + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_common_get_backend(enum syscommon_plugin_module module, + void **data); + +/** + * @brief Put the backend data according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[in] Data pointer where 'plugin_backend_[module]_funcs' instance + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_common_put_backend(enum syscommon_plugin_module module, + void *data); + +/** + * @brief Get the backend data with the specific library name according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[out] Data pointer where 'plugin_backend_[module]_funcs' instance + * should be stored from PLUGIN backend binary. + * @param[in] PLUGIN backend library name which is not default library name + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_common_get_backend_with_library_name( + enum syscommon_plugin_module module, + void **data, const char *library_name); + +/** + * @brief Put the backend data with the specific library name according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[in] Data pointer where 'plugin_backend_[module]_funcs' instance + * @param[in] PLUGIN backend library name which is not default library name + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_common_put_backend_with_library_name( + enum syscommon_plugin_module module, + void *data, const char *library_name); + +/** + * @brief Check PLUGIN ABI version whehter is suppored or not on current platform + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[in] PLUGIN ABI version of backend module among enum plugin_abi_version + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_common_check_backend_abi_version( + enum syscommon_plugin_module module, + enum syscommon_plugin_abi_version abi_version); + +/** + * @brief Get the backend PLUGIN ABI version according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @return @c positive integer value on success, otherwise a zero error value + */ +unsigned int syscommon_plugin_common_get_backend_abi_version( + enum syscommon_plugin_module module); + +/** + * @brief Get the backend name according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[out] Backend name of PLUGIN module + * @param[in] Arrary size of name[] + * @return @c positive integer value on success, otherwise a zero error value + */ +int syscommon_plugin_common_get_backend_name( + enum syscommon_plugin_module module, + char *name, int size); + +/** + * @brief Get the backend vendor description according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[out] Backend vendor description of PLUGIN module + * @param[in] Arrary size of vendor[] + * @return @c positive integer value on success, otherwise a zero error value + */ +int syscommon_plugin_common_get_backend_vendor( + enum syscommon_plugin_module module, + char *vendor, int size); + +/** + * @brief Get the number of the backend libraries according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_common_get_backend_count( + enum syscommon_plugin_module module); + +/** + * @brief Get the backend library names according to the type of PLUGIN module + * @param[in] PLUGIN module id among enum plugin_moudle + * @param[out] Data pointer should be filled by backend library names + * @param[in] Number of backend library of specific PLUGIN module + * @param[in] Maximum length of the library name + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_common_get_backend_library_names( + enum syscommon_plugin_module module, + char **library_names, + int library_count, + int library_name_size); + +#ifdef __cplusplus +} +#endif +#endif /* __SYSCOMMON_PLUGIN_COMMON__ */ diff --git a/src/plugin-api/common/src/common.h b/src/plugin-api/common/src/common.h index a89fe09..44e99fd 100644 --- a/src/plugin-api/common/src/common.h +++ b/src/plugin-api/common/src/common.h @@ -27,7 +27,7 @@ #include -#include "syscommon-plugin-common.h" +#include #ifdef __cplusplus extern "C" { diff --git a/src/plugin-api/common/src/syscommon-plugin-api-conf.c b/src/plugin-api/common/src/syscommon-plugin-api-conf.c index 19daa1a..0525b0a 100644 --- a/src/plugin-api/common/src/syscommon-plugin-api-conf.c +++ b/src/plugin-api/common/src/syscommon-plugin-api-conf.c @@ -27,8 +27,8 @@ #include #include -#include "syscommon-plugin-common.h" -#include "syscommon-plugin-common-interface.h" +#include +#include #include "common.h" #include "syscommon-plugin-api-conf.h" diff --git a/src/plugin-api/common/src/syscommon-plugin-api-conf.h b/src/plugin-api/common/src/syscommon-plugin-api-conf.h index 20e8b32..17dbbe8 100644 --- a/src/plugin-api/common/src/syscommon-plugin-api-conf.h +++ b/src/plugin-api/common/src/syscommon-plugin-api-conf.h @@ -28,7 +28,7 @@ #include #include -#include "syscommon-plugin-common-interface.h" +#include #ifdef __cplusplus extern "C" { 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 29562d1..9271370 100644 --- a/src/plugin-api/common/src/syscommon-plugin-api-list.h +++ b/src/plugin-api/common/src/syscommon-plugin-api-list.h @@ -25,7 +25,7 @@ #ifndef __SYSCOMMON_PLUGIN_API_LIST_H__ #define __SYSCOMMON_PLUGIN_API_LIST_H__ -#include "syscommon-plugin-common.h" +#include #include "common.h" diff --git a/src/plugin-api/deviced/CMakeLists.txt b/src/plugin-api/deviced/CMakeLists.txt index 644c594..c51dce5 100644 --- a/src/plugin-api/deviced/CMakeLists.txt +++ b/src/plugin-api/deviced/CMakeLists.txt @@ -53,7 +53,7 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PLUGIN_API_DEVICED_VE SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PLUGIN_API_DEVICED_MAJORVER}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) -INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/system/ DESTINATION ${INCLUDEDIR} FILES_MATCHING PATTERN "*.h" ) diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-battery-interface.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-battery-interface.h deleted file mode 100644 index 1088509..0000000 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-battery-interface.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_DEVICED_BATTERY_INTERFACE_H__ -#define __SYSCOMMON_PLUGIN_DEVICED_BATTERY_INTERFACE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -typedef struct _syscommon_plugin_backend_deviced_battery_funcs { - bool (*is_possible_to_notify_battery_full) (void); - -} syscommon_plugin_backend_deviced_battery_funcs; - -#ifdef __cplusplus -} -#endif - -#endif //__SYSCOMMON_PLUGIN_DEVICED_BATTERY_INTERFACE_H__ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-battery.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-battery.h deleted file mode 100644 index 3e376b0..0000000 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-battery.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_DEVICED_BATTERY_H__ -#define __SYSCOMMON_PLUGIN_DEVICED_BATTERY_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** - * @brief Get the backend data of deviced-battery module - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_deviced_battery_get_backend(void); - -/** - * @brief Put the backend data of deviced-battery module - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_deviced_battery_put_backend(void); - -/** - * @brief Call the is_possible_to_notify_battery_full function of deviced-battery module - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_deviced_battery_is_possible_to_notify_battery_full(bool *possible_notify); - -#ifdef __cplusplus -} -#endif - -#endif //__SYSCOMMON_PLUGIN_DEVICED_BATTERY_H__ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-common-interface.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-common-interface.h deleted file mode 100644 index 4e18d39..0000000 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-common-interface.h +++ /dev/null @@ -1,150 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_DEVICED_COMMON_INTERFACE_H__ -#define __SYSCOMMON_PLUGIN_DEVICED_COMMON_INTERFACE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -enum deviced_resource_type { - DEVICED_RESOURCE_TYPE_UNKNOWN, - DEVICED_RESOURCE_TYPE_POWER, - DEVICED_RESOURCE_TYPE_DISPLAY, - DEVICED_RESOURCE_TYPE_END, -}; - -/** - * Define event of the deviced. - * - * Each event has a category, usually name of a module, that the event is related to. - * There must be a 'General' event for a category, such as DEVICED_EVENT_DISPLAY. - * There can be several 'Specfic' events in a category, such as DEVICED_EVENT_DISPLAY_LOCK. - */ -enum deviced_event { - DEVICED_EVENT_BASE = 10000, - DEVICED_EVENT_UNKNOWN, - - /* display */ - DEVICED_EVENT_DISPLAY, - DEVICED_EVENT_DISPLAY_AMBIENT, - DEVICED_EVENT_DISPLAY_LOCK, - DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT, - - /* battery */ - DEVICED_EVENT_BATTERY, - DEVICED_EVENT_BATTERY_CAPACITY_FULL, - DEVICED_EVENT_BATTERY_CAPACITY_LOW, - DEVICED_EVENT_BATTERY_HEALTH_OVERHEAT, - DEVICED_EVENT_BATTERY_HEALTH_OVERCOOL, - - /* extcon */ - DEVICED_EVENT_EXTCON, - DEVICED_EVENT_EXTCON_USB, - DEVICED_EVENT_EXTCON_USBHOST, - DEVICED_EVENT_EXTCON_CRADLE, - DEVICED_EVENT_EXTCON_EARJACK, - - /* input */ - DEVICED_EVENT_INPUT, - DEVICED_EVENT_INPUT_POWERKEY, - DEVICED_EVENT_INPUT_BACKKEY, - DEVICED_EVENT_INPUT_BEZEL, - - /* power */ - DEVICED_EVENT_POWER, - - /* touchscreen */ - DEVICED_EVENT_TOUCHSCREEN, - - /* misc */ - DEVICED_EVENT_MISC, - DEVICED_EVENT_MISC_SWIMMODE, - DEVICED_EVENT_MISC_DBUS, - DEVICED_EVENT_MISC_BOOTING, - DEVICED_EVENT_MISC_DUMPMODE, - DEVICED_EVENT_MISC_POPUP, - DEVICED_EVENT_MISC_TIME, -}; - -enum deviced_notifier { - DEVICED_NOTIFIER_MIN, - DEVICED_NOTIFIER_DAEMON_RESTARTED = DEVICED_NOTIFIER_MIN, - DEVICED_NOTIFIER_DELAYED_INIT, - DEVICED_NOTIFIER_LCD, - DEVICED_NOTIFIER_LCD_OFF, - DEVICED_NOTIFIER_LCD_OFF_COMPLETE, - DEVICED_NOTIFIER_LCD_AUTOBRT_SENSING, - DEVICED_NOTIFIER_LOWBAT, - DEVICED_NOTIFIER_FULLBAT, - DEVICED_NOTIFIER_POWER_SUPPLY, - DEVICED_NOTIFIER_BATTERY_HEALTH, - DEVICED_NOTIFIER_BATTERY_PRESENT, - DEVICED_NOTIFIER_BATTERY_OVP, - DEVICED_NOTIFIER_BATTERY_CHARGING, - DEVICED_NOTIFIER_BATTERY_CHARGER_CONNECTED, - DEVICED_NOTIFIER_BATTERY_CHARGER_DISCONNECTED, - DEVICED_NOTIFIER_DISPLAY_AMBIENT_CONDITION, - DEVICED_NOTIFIER_DISPLAY_AMBIENT_STATE, - DEVICED_NOTIFIER_DISPLAY_LOCK, - DEVICED_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, - DEVICED_NOTIFIER_POWEROFF_TRIGGERED, - DEVICED_NOTIFIER_POWEROFF, - DEVICED_NOTIFIER_APPLICATION_BACKGROUND, - DEVICED_NOTIFIER_APPLICATION_FOREGROUND, - DEVICED_NOTIFIER_APPLICATION_TERMINATED, - DEVICED_NOTIFIER_USB_DEBUG_MODE, - DEVICED_NOTIFIER_USB_TETHERING_MODE, - DEVICED_NOTIFIER_EVENT_HANDLER, - DEVICED_NOTIFIER_CPU_BOOST_LOWBAT, - DEVICED_NOTIFIER_CPU_BOOST_POWEROFF, - /* Experimental for Specific device - contact to deviced owner */ - DEVICED_NOTIFIER_PMQOS, - DEVICED_NOTIFIER_PMQOS_ULTRAPOWERSAVING, - DEVICED_NOTIFIER_PMQOS_POWERSAVING, - DEVICED_NOTIFIER_COOL_DOWN, - DEVICED_NOTIFIER_VITAL_STATE, - DEVICED_NOTIFIER_LONGKEY_RESTORE, - DEVICED_NOTIFIER_UPSM, - DEVICED_NOTIFIER_UPSM_OFF, - DEVICED_NOTIFIER_BEZEL_WAKEUP, - DEVICED_NOTIFIER_DISPLAY_BRIGHTNESS, - DEVICED_NOTIFIER_ULTRAPOWERSAVING, - DEVICED_NOTIFIER_KEY_PRESS, - DEVICED_NOTIFIER_KEY_RELEASE, - DEVICED_NOTIFIER_EVENT_ACQUIRE_WAKELOCK, - DEVICED_NOTIFIER_EVENT_RELEASE_WAKELOCK, - - /* Purpose of calling methods of different modules - * Use prefix DEVICED_NOTIFIER_REQUEST */ - DEVICED_NOTIFIER_REQUEST_TRANSITION_STATE, - DEVICED_NOTIFIER_MAX, -}; - -#ifdef __cplusplus -} -#endif - -#endif /*__SYSCOMMON_PLUGIN_DEVICED_COMMON_INTERFACE_H__ */ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-display-interface.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-display-interface.h deleted file mode 100644 index aec7526..0000000 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-display-interface.h +++ /dev/null @@ -1,138 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_DEVICED_DISPLAY_INTERFACE_H__ -#define __SYSCOMMON_PLUGIN_DEVICED_DISPLAY_INTERFACE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#define DEVICED_DISPLAY_ATTR_INT_GET_MAX_BRIGHTNESS (1ULL << 0) -#define DEVICED_DISPLAY_ATTR_INT_GET_CURRENT_STATE (1ULL << 1) -#define DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE (1ULL << 2) -#define DEVICED_DISPLAY_ATTR_INT_DPMS_STATE (1ULL << 3) -#define DEVICED_DISPLAY_ATTR_TUPLE2_SET_DISPLAY_DIRECT (1ULL << 4) -#define DEVICED_DISPLAY_ATTR_INT_CUSTOM_BRIGHTNESS (1ULL << 5) -#define DEVICED_DISPLAY_ATTR_UINT64_GET_ACTOR_CAPABILITY (1ULL << 6) -#define DEVICED_DISPLAY_ATTR_TUPLE3_SET_ACTOR_CAPABILITY (1ULL << 7) -#define DEVICED_DISPLAY_ATTR_INT_GET_TOUCH_EVENT_BLOCKED (1ULL << 8) -#define DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL (1ULL << 9) - -enum syscommon_deviced_display_state { - SYSCOMMON_DEVICED_DISPLAY_STATE_START, - SYSCOMMON_DEVICED_DISPLAY_STATE_ON, - SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, - SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, - SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP, - SYSCOMMON_DEVICED_DISPLAY_STATE_END, -}; - -struct syscommon_deviced_display_state_info { - enum syscommon_deviced_display_state state; /**< state number */ - const char *name; /**< state name (string) */ - int (*trans) (int evt); /**< transition function pointer */ - int (*action) (int timeout); /**< enter action */ - int (*check) (int curr, int next); /**< transition check function */ - GSourceFunc timeout_cb; - int timeout; -}; - -enum syscommon_deviced_dpms_state { - SYSCOMMON_DEVICED_DPMS_ON, /* In use */ - SYSCOMMON_DEVICED_DPMS_STANDBY, /* Blanked, low power */ - SYSCOMMON_DEVICED_DPMS_SUSPEND, /* Blanked, lower power */ - SYSCOMMON_DEVICED_DPMS_OFF, /* Shut off, awaiting activity */ - SYSCOMMON_DEVICED_DPMS_FORCE_OFF,/* Force Shut off */ - SYSCOMMON_DEVICED_DPMS_DETACH, /* Display detached */ -}; - -enum syscommon_deviced_dpms_type { - SYSCOMMON_DEVICED_DPMS_TYPE_WINDOW_MANAGER, - SYSCOMMON_DEVICED_DPMS_TYPE_NONE, -}; - -enum syscommon_deviced_display_orientation { - SYSCOMMON_DEVICED_DISPLAY_ORIENTATION_HORIZONTAL, - SYSCOMMON_DEVICED_DISPLAY_ORIENTATION_VERTICAL, -}; - -struct syscommon_deviced_display_config { - double lock_wait_time; - double longpress_interval; - double lightsensor_interval; - int lcdoff_timeout; - const int pm_default_brightness; - int brightness_change_step; - int lcd_always_on; - int dimming; - int framerate_app[4]; - int control_display; - int powerkey_doublepress; - int alpm_on; - int accel_sensor_on; - int continuous_sampling; - enum syscommon_deviced_display_orientation display_init_direction; - int aod_enter_level; - bool aod_tsp; - bool timeout_enable; - bool input_support; - bool touch_wakeup; - bool display_on_usb_conn_changed; - enum syscommon_deviced_dpms_type display_dpms_type; -}; - -enum syscommon_deviced_display_actor_id { - SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY = 1, - SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY, - SYSCOMMON_DEVICED_DISPLAY_ACTOR_API, - SYSCOMMON_DEVICED_DISPLAY_ACTOR_GESTURE, -}; - -struct syscommon_deviced_display_actor_ops { - enum syscommon_deviced_display_actor_id id; - unsigned int caps; -}; - -enum syscommon_deviced_display_capability { - SYSCOMMON_DEVICED_DISPLAY_CAPA_BRIGHTNESS = 1 << 0, - SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON = 1 << 1, - SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF = 1 << 2, - SYSCOMMON_DEVICED_DISPLAY_CAPA_POWEROFF = 1 << 3, -}; - -#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 - -#endif //__SYSCOMMON_PLUGIN_DEVICED_DISPLAY_INTERFACE_H__ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-display.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-display.h deleted file mode 100644 index 1e7a034..0000000 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-display.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_DEVICED_DISPLAY_H__ -#define __SYSCOMMON_PLUGIN_DEVICED_DISPLAY_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#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 -} -#endif - -#endif //__SYSCOMMON_PLUGIN_DEVICED_DISPLAY_H__ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-input-interface.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-input-interface.h deleted file mode 100644 index b777152..0000000 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-input-interface.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_DEVICED_INPUT_INTERFACE_H__ -#define __SYSCOMMON_PLUGIN_DEVICED_INPUT_INTERFACE_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define SYSCOMMON_DEVICED_INPUT_KEY_RELEASED 0 -#define SYSCOMMON_DEVICED_INPUT_KEY_PRESSED 1 -#define SYSCOMMON_DEVICED_INPUT_KEY_BEING_PRESSED 2 - -typedef struct _syscommon_plugin_backend_deviced_input_funcs { - void (*input_event_cb)(struct timeval time, unsigned short type, - unsigned short keycode, unsigned int keyvalue); -} syscommon_plugin_backend_deviced_input_funcs; - -#ifdef __cplusplus -} -#endif - -#endif //__SYSCOMMON_PLUGIN_DEVICED_input_INTERFACE_H__ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-input.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-input.h deleted file mode 100644 index 9dda045..0000000 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-input.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_DEVICED_INPUT_H__ -#define __SYSCOMMON_PLUGIN_DEVICED_INPUT_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Get the backend data of deviced-input module - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_deviced_input_get_backend(void); - -/** - * @brief Put the backend data of deviced-input module - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_deviced_input_put_backend(void); - -/** - * @brief Input event callback function - */ -void syscommon_plugin_deviced_input_event_cb(struct timeval time, unsigned short type, - unsigned short keycode, unsigned int keyvalue); - - -#ifdef __cplusplus -} -#endif - -#endif //__SYSCOMMON_PLUGIN_DEVICED_INPUT_H__ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h deleted file mode 100644 index b7eb153..0000000 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h +++ /dev/null @@ -1,139 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_DEVICED_POWER_INTERFACE_H__ -#define __SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define DEVICED_POWER_ATTR_SET_UINT64_4_CURRENT_STATE (1ULL << 0) -#define DEVICED_POWER_ATTR_UINT64_CURRENT_STATE (1ULL << 1) -#define DEVICED_POWER_ATTR_INT_WAKEUP_REASON (1ULL << 2) -#define DEVICED_POWER_ATTR_TUPLE2_SET_WAKELOCK (1ULL << 3) -#define DEVICED_POWER_ATTR_INT_GET_VITAL_MODE (1ULL << 4) -#define DEVICED_POWER_ATTR_TUPLE2_SET_HISTORY_LOG (1ULL << 5) - -enum { - DEVICED_POWER_STATE_MIN_INDEX, - DEVICED_POWER_STATE_START_INDEX = DEVICED_POWER_STATE_MIN_INDEX, - DEVICED_POWER_STATE_NORMAL_INDEX, - DEVICED_POWER_STATE_SLEEP_INDEX, - DEVICED_POWER_STATE_POWEROFF_INDEX, - DEVICED_POWER_STATE_REBOOT_INDEX, - DEVICED_POWER_STATE_EXIT_INDEX, - DEVICED_POWER_STATE_MAX_INDEX, - - DEVICED_POWER_TRANSIENT_STATE_MIN_INDEX, - DEVICED_POWER_TRANSIENT_STATE_RESUMING_EARLY_INDEX = DEVICED_POWER_TRANSIENT_STATE_MIN_INDEX, - DEVICED_POWER_TRANSIENT_STATE_RESUMING_INDEX, - DEVICED_POWER_TRANSIENT_STATE_RESUMING_LATE_INDEX, - DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY_INDEX, - DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_INDEX, - DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE_INDEX, - DEVICED_POWER_TRANSIENT_STATE_MAX_INDEX, -}; - -#define DEVICED_POWER_STATE_UNDEFINED (0) - -#define DEVICED_POWER_STATE_START (1ULL << DEVICED_POWER_STATE_START_INDEX) -#define DEVICED_POWER_STATE_NORMAL (1ULL << DEVICED_POWER_STATE_NORMAL_INDEX) -#define DEVICED_POWER_STATE_SLEEP (1ULL << DEVICED_POWER_STATE_SLEEP_INDEX) -#define DEVICED_POWER_STATE_POWEROFF (1ULL << DEVICED_POWER_STATE_POWEROFF_INDEX) -#define DEVICED_POWER_STATE_REBOOT (1ULL << DEVICED_POWER_STATE_REBOOT_INDEX) -#define DEVICED_POWER_STATE_EXIT (1ULL << DEVICED_POWER_STATE_EXIT_INDEX) -#define DEVICED_POWER_STATE_ALL ((1ULL << DEVICED_POWER_STATE_MAX_INDEX) - (1ULL << DEVICED_POWER_STATE_MIN_INDEX)) - -#define DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY (1ULL << DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY_INDEX) -#define DEVICED_POWER_TRANSIENT_STATE_SUSPENDING (1ULL << DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_INDEX) -#define DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE (1ULL << DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE_INDEX) -#define DEVICED_POWER_TRANSIENT_STATE_RESUMING_EARLY (1ULL << DEVICED_POWER_TRANSIENT_STATE_RESUMING_EARLY_INDEX) -#define DEVICED_POWER_TRANSIENT_STATE_RESUMING (1ULL << DEVICED_POWER_TRANSIENT_STATE_RESUMING_INDEX) -#define DEVICED_POWER_TRANSIENT_STATE_RESUMING_LATE (1ULL << DEVICED_POWER_TRANSIENT_STATE_RESUMING_LATE_INDEX) - -#define DEVICED_POWER_STATE_INDEX(state) (__builtin_ctzll(state)) - -struct syscommon_plugin_deviced_power_trans_info { - u_int64_t curr; - u_int64_t next; - int reason; - const void *data; -}; - -static inline u_int64_t syscommon_plugin_deviced_power_convert_to_power_state(const char *str) -{ - if (strncmp(str, "start", sizeof("start")) == 0) - return DEVICED_POWER_STATE_START; - else if (strncmp(str, "sleep", sizeof("sleep")) == 0) - return DEVICED_POWER_STATE_SLEEP; - else if (strncmp(str, "normal", sizeof("normal")) == 0) - return DEVICED_POWER_STATE_NORMAL; - else if (strncmp(str, "poweroff", sizeof("poweroff")) == 0) - return DEVICED_POWER_STATE_POWEROFF; - else if (strncmp(str, "reboot", sizeof("reboot")) == 0) - return DEVICED_POWER_STATE_REBOOT; - else if (strncmp(str, "exit", sizeof("exit")) == 0) - return DEVICED_POWER_STATE_EXIT; - else if (strncmp(str, "current", sizeof("current")) == 0) - return DEVICED_POWER_STATE_ALL; - - return DEVICED_POWER_STATE_UNDEFINED; -} - -/* - * Vital state enumeration - */ -enum syscommon_deviced_vital_state { - SYSCOMMON_DEVICED_VITAL_SLEEP, /* suspend state */ - SYSCOMMON_DEVICED_VITAL_WAKEUP, /* resume state */ - SYSCOMMON_DEVICED_VITAL_DISPLAY_WAKEUP, - SYSCOMMON_DEVICED_VITAL_EXIT, -}; - -enum syscommon_deviced_power_log_type { - SYSCOMMON_DEVICED_POWER_LOG_TYPE_MIN = 0, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_KEY_PRESS = SYSCOMMON_DEVICED_POWER_LOG_TYPE_MIN, /* key log */ - SYSCOMMON_DEVICED_POWER_LOG_TYPE_KEY_LONG_PRESS, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_KEY_RELEASE, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_ON, /* lcd log */ - SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_ON_COMPLETE, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_ON_FAIL, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_DIM, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_DIM_FAIL, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_OFF, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_OFF_COMPLETE, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_OFF_FAIL, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_CONTROL_FAIL, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_SLEEP, - SYSCOMMON_DEVICED_POWER_LOG_TYPE_MAX -}; - -#ifdef __cplusplus -} -#endif - -#endif /*__SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__ */ diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-power.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-power.h deleted file mode 100644 index 0ae2223..0000000 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-power.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_DEVICED_POWER_H__ -#define __SYSCOMMON_PLUGIN_DEVICED_POWER_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /*__SYSCOMMON_PLUGIN_DEVICED_POWER_H__ */ diff --git a/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-battery-interface.h b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-battery-interface.h new file mode 100644 index 0000000..1088509 --- /dev/null +++ b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-battery-interface.h @@ -0,0 +1,42 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_DEVICED_BATTERY_INTERFACE_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_BATTERY_INTERFACE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +typedef struct _syscommon_plugin_backend_deviced_battery_funcs { + bool (*is_possible_to_notify_battery_full) (void); + +} syscommon_plugin_backend_deviced_battery_funcs; + +#ifdef __cplusplus +} +#endif + +#endif //__SYSCOMMON_PLUGIN_DEVICED_BATTERY_INTERFACE_H__ diff --git a/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-battery.h b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-battery.h new file mode 100644 index 0000000..3e376b0 --- /dev/null +++ b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-battery.h @@ -0,0 +1,56 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_DEVICED_BATTERY_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_BATTERY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** + * @brief Get the backend data of deviced-battery module + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_deviced_battery_get_backend(void); + +/** + * @brief Put the backend data of deviced-battery module + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_deviced_battery_put_backend(void); + +/** + * @brief Call the is_possible_to_notify_battery_full function of deviced-battery module + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_deviced_battery_is_possible_to_notify_battery_full(bool *possible_notify); + +#ifdef __cplusplus +} +#endif + +#endif //__SYSCOMMON_PLUGIN_DEVICED_BATTERY_H__ diff --git a/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-common-interface.h b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-common-interface.h new file mode 100644 index 0000000..4e18d39 --- /dev/null +++ b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-common-interface.h @@ -0,0 +1,150 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_DEVICED_COMMON_INTERFACE_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_COMMON_INTERFACE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +enum deviced_resource_type { + DEVICED_RESOURCE_TYPE_UNKNOWN, + DEVICED_RESOURCE_TYPE_POWER, + DEVICED_RESOURCE_TYPE_DISPLAY, + DEVICED_RESOURCE_TYPE_END, +}; + +/** + * Define event of the deviced. + * + * Each event has a category, usually name of a module, that the event is related to. + * There must be a 'General' event for a category, such as DEVICED_EVENT_DISPLAY. + * There can be several 'Specfic' events in a category, such as DEVICED_EVENT_DISPLAY_LOCK. + */ +enum deviced_event { + DEVICED_EVENT_BASE = 10000, + DEVICED_EVENT_UNKNOWN, + + /* display */ + DEVICED_EVENT_DISPLAY, + DEVICED_EVENT_DISPLAY_AMBIENT, + DEVICED_EVENT_DISPLAY_LOCK, + DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT, + + /* battery */ + DEVICED_EVENT_BATTERY, + DEVICED_EVENT_BATTERY_CAPACITY_FULL, + DEVICED_EVENT_BATTERY_CAPACITY_LOW, + DEVICED_EVENT_BATTERY_HEALTH_OVERHEAT, + DEVICED_EVENT_BATTERY_HEALTH_OVERCOOL, + + /* extcon */ + DEVICED_EVENT_EXTCON, + DEVICED_EVENT_EXTCON_USB, + DEVICED_EVENT_EXTCON_USBHOST, + DEVICED_EVENT_EXTCON_CRADLE, + DEVICED_EVENT_EXTCON_EARJACK, + + /* input */ + DEVICED_EVENT_INPUT, + DEVICED_EVENT_INPUT_POWERKEY, + DEVICED_EVENT_INPUT_BACKKEY, + DEVICED_EVENT_INPUT_BEZEL, + + /* power */ + DEVICED_EVENT_POWER, + + /* touchscreen */ + DEVICED_EVENT_TOUCHSCREEN, + + /* misc */ + DEVICED_EVENT_MISC, + DEVICED_EVENT_MISC_SWIMMODE, + DEVICED_EVENT_MISC_DBUS, + DEVICED_EVENT_MISC_BOOTING, + DEVICED_EVENT_MISC_DUMPMODE, + DEVICED_EVENT_MISC_POPUP, + DEVICED_EVENT_MISC_TIME, +}; + +enum deviced_notifier { + DEVICED_NOTIFIER_MIN, + DEVICED_NOTIFIER_DAEMON_RESTARTED = DEVICED_NOTIFIER_MIN, + DEVICED_NOTIFIER_DELAYED_INIT, + DEVICED_NOTIFIER_LCD, + DEVICED_NOTIFIER_LCD_OFF, + DEVICED_NOTIFIER_LCD_OFF_COMPLETE, + DEVICED_NOTIFIER_LCD_AUTOBRT_SENSING, + DEVICED_NOTIFIER_LOWBAT, + DEVICED_NOTIFIER_FULLBAT, + DEVICED_NOTIFIER_POWER_SUPPLY, + DEVICED_NOTIFIER_BATTERY_HEALTH, + DEVICED_NOTIFIER_BATTERY_PRESENT, + DEVICED_NOTIFIER_BATTERY_OVP, + DEVICED_NOTIFIER_BATTERY_CHARGING, + DEVICED_NOTIFIER_BATTERY_CHARGER_CONNECTED, + DEVICED_NOTIFIER_BATTERY_CHARGER_DISCONNECTED, + DEVICED_NOTIFIER_DISPLAY_AMBIENT_CONDITION, + DEVICED_NOTIFIER_DISPLAY_AMBIENT_STATE, + DEVICED_NOTIFIER_DISPLAY_LOCK, + DEVICED_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, + DEVICED_NOTIFIER_POWEROFF_TRIGGERED, + DEVICED_NOTIFIER_POWEROFF, + DEVICED_NOTIFIER_APPLICATION_BACKGROUND, + DEVICED_NOTIFIER_APPLICATION_FOREGROUND, + DEVICED_NOTIFIER_APPLICATION_TERMINATED, + DEVICED_NOTIFIER_USB_DEBUG_MODE, + DEVICED_NOTIFIER_USB_TETHERING_MODE, + DEVICED_NOTIFIER_EVENT_HANDLER, + DEVICED_NOTIFIER_CPU_BOOST_LOWBAT, + DEVICED_NOTIFIER_CPU_BOOST_POWEROFF, + /* Experimental for Specific device - contact to deviced owner */ + DEVICED_NOTIFIER_PMQOS, + DEVICED_NOTIFIER_PMQOS_ULTRAPOWERSAVING, + DEVICED_NOTIFIER_PMQOS_POWERSAVING, + DEVICED_NOTIFIER_COOL_DOWN, + DEVICED_NOTIFIER_VITAL_STATE, + DEVICED_NOTIFIER_LONGKEY_RESTORE, + DEVICED_NOTIFIER_UPSM, + DEVICED_NOTIFIER_UPSM_OFF, + DEVICED_NOTIFIER_BEZEL_WAKEUP, + DEVICED_NOTIFIER_DISPLAY_BRIGHTNESS, + DEVICED_NOTIFIER_ULTRAPOWERSAVING, + DEVICED_NOTIFIER_KEY_PRESS, + DEVICED_NOTIFIER_KEY_RELEASE, + DEVICED_NOTIFIER_EVENT_ACQUIRE_WAKELOCK, + DEVICED_NOTIFIER_EVENT_RELEASE_WAKELOCK, + + /* Purpose of calling methods of different modules + * Use prefix DEVICED_NOTIFIER_REQUEST */ + DEVICED_NOTIFIER_REQUEST_TRANSITION_STATE, + DEVICED_NOTIFIER_MAX, +}; + +#ifdef __cplusplus +} +#endif + +#endif /*__SYSCOMMON_PLUGIN_DEVICED_COMMON_INTERFACE_H__ */ diff --git a/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-display-interface.h b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-display-interface.h new file mode 100644 index 0000000..aec7526 --- /dev/null +++ b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-display-interface.h @@ -0,0 +1,138 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_DEVICED_DISPLAY_INTERFACE_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_DISPLAY_INTERFACE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define DEVICED_DISPLAY_ATTR_INT_GET_MAX_BRIGHTNESS (1ULL << 0) +#define DEVICED_DISPLAY_ATTR_INT_GET_CURRENT_STATE (1ULL << 1) +#define DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE (1ULL << 2) +#define DEVICED_DISPLAY_ATTR_INT_DPMS_STATE (1ULL << 3) +#define DEVICED_DISPLAY_ATTR_TUPLE2_SET_DISPLAY_DIRECT (1ULL << 4) +#define DEVICED_DISPLAY_ATTR_INT_CUSTOM_BRIGHTNESS (1ULL << 5) +#define DEVICED_DISPLAY_ATTR_UINT64_GET_ACTOR_CAPABILITY (1ULL << 6) +#define DEVICED_DISPLAY_ATTR_TUPLE3_SET_ACTOR_CAPABILITY (1ULL << 7) +#define DEVICED_DISPLAY_ATTR_INT_GET_TOUCH_EVENT_BLOCKED (1ULL << 8) +#define DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL (1ULL << 9) + +enum syscommon_deviced_display_state { + SYSCOMMON_DEVICED_DISPLAY_STATE_START, + SYSCOMMON_DEVICED_DISPLAY_STATE_ON, + SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, + SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, + SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP, + SYSCOMMON_DEVICED_DISPLAY_STATE_END, +}; + +struct syscommon_deviced_display_state_info { + enum syscommon_deviced_display_state state; /**< state number */ + const char *name; /**< state name (string) */ + int (*trans) (int evt); /**< transition function pointer */ + int (*action) (int timeout); /**< enter action */ + int (*check) (int curr, int next); /**< transition check function */ + GSourceFunc timeout_cb; + int timeout; +}; + +enum syscommon_deviced_dpms_state { + SYSCOMMON_DEVICED_DPMS_ON, /* In use */ + SYSCOMMON_DEVICED_DPMS_STANDBY, /* Blanked, low power */ + SYSCOMMON_DEVICED_DPMS_SUSPEND, /* Blanked, lower power */ + SYSCOMMON_DEVICED_DPMS_OFF, /* Shut off, awaiting activity */ + SYSCOMMON_DEVICED_DPMS_FORCE_OFF,/* Force Shut off */ + SYSCOMMON_DEVICED_DPMS_DETACH, /* Display detached */ +}; + +enum syscommon_deviced_dpms_type { + SYSCOMMON_DEVICED_DPMS_TYPE_WINDOW_MANAGER, + SYSCOMMON_DEVICED_DPMS_TYPE_NONE, +}; + +enum syscommon_deviced_display_orientation { + SYSCOMMON_DEVICED_DISPLAY_ORIENTATION_HORIZONTAL, + SYSCOMMON_DEVICED_DISPLAY_ORIENTATION_VERTICAL, +}; + +struct syscommon_deviced_display_config { + double lock_wait_time; + double longpress_interval; + double lightsensor_interval; + int lcdoff_timeout; + const int pm_default_brightness; + int brightness_change_step; + int lcd_always_on; + int dimming; + int framerate_app[4]; + int control_display; + int powerkey_doublepress; + int alpm_on; + int accel_sensor_on; + int continuous_sampling; + enum syscommon_deviced_display_orientation display_init_direction; + int aod_enter_level; + bool aod_tsp; + bool timeout_enable; + bool input_support; + bool touch_wakeup; + bool display_on_usb_conn_changed; + enum syscommon_deviced_dpms_type display_dpms_type; +}; + +enum syscommon_deviced_display_actor_id { + SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY = 1, + SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY, + SYSCOMMON_DEVICED_DISPLAY_ACTOR_API, + SYSCOMMON_DEVICED_DISPLAY_ACTOR_GESTURE, +}; + +struct syscommon_deviced_display_actor_ops { + enum syscommon_deviced_display_actor_id id; + unsigned int caps; +}; + +enum syscommon_deviced_display_capability { + SYSCOMMON_DEVICED_DISPLAY_CAPA_BRIGHTNESS = 1 << 0, + SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON = 1 << 1, + SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF = 1 << 2, + SYSCOMMON_DEVICED_DISPLAY_CAPA_POWEROFF = 1 << 3, +}; + +#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 + +#endif //__SYSCOMMON_PLUGIN_DEVICED_DISPLAY_INTERFACE_H__ diff --git a/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-display.h b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-display.h new file mode 100644 index 0000000..d284e62 --- /dev/null +++ b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-display.h @@ -0,0 +1,51 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_DEVICED_DISPLAY_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_DISPLAY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/** + * @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 +} +#endif + +#endif //__SYSCOMMON_PLUGIN_DEVICED_DISPLAY_H__ diff --git a/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-input-interface.h b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-input-interface.h new file mode 100644 index 0000000..b777152 --- /dev/null +++ b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-input-interface.h @@ -0,0 +1,47 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_DEVICED_INPUT_INTERFACE_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_INPUT_INTERFACE_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SYSCOMMON_DEVICED_INPUT_KEY_RELEASED 0 +#define SYSCOMMON_DEVICED_INPUT_KEY_PRESSED 1 +#define SYSCOMMON_DEVICED_INPUT_KEY_BEING_PRESSED 2 + +typedef struct _syscommon_plugin_backend_deviced_input_funcs { + void (*input_event_cb)(struct timeval time, unsigned short type, + unsigned short keycode, unsigned int keyvalue); +} syscommon_plugin_backend_deviced_input_funcs; + +#ifdef __cplusplus +} +#endif + +#endif //__SYSCOMMON_PLUGIN_DEVICED_input_INTERFACE_H__ diff --git a/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-input.h b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-input.h new file mode 100644 index 0000000..9dda045 --- /dev/null +++ b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-input.h @@ -0,0 +1,57 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_DEVICED_INPUT_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_INPUT_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Get the backend data of deviced-input module + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_deviced_input_get_backend(void); + +/** + * @brief Put the backend data of deviced-input module + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_deviced_input_put_backend(void); + +/** + * @brief Input event callback function + */ +void syscommon_plugin_deviced_input_event_cb(struct timeval time, unsigned short type, + unsigned short keycode, unsigned int keyvalue); + + +#ifdef __cplusplus +} +#endif + +#endif //__SYSCOMMON_PLUGIN_DEVICED_INPUT_H__ diff --git a/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-power-interface.h b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-power-interface.h new file mode 100644 index 0000000..b7eb153 --- /dev/null +++ b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-power-interface.h @@ -0,0 +1,139 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_DEVICED_POWER_INTERFACE_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEVICED_POWER_ATTR_SET_UINT64_4_CURRENT_STATE (1ULL << 0) +#define DEVICED_POWER_ATTR_UINT64_CURRENT_STATE (1ULL << 1) +#define DEVICED_POWER_ATTR_INT_WAKEUP_REASON (1ULL << 2) +#define DEVICED_POWER_ATTR_TUPLE2_SET_WAKELOCK (1ULL << 3) +#define DEVICED_POWER_ATTR_INT_GET_VITAL_MODE (1ULL << 4) +#define DEVICED_POWER_ATTR_TUPLE2_SET_HISTORY_LOG (1ULL << 5) + +enum { + DEVICED_POWER_STATE_MIN_INDEX, + DEVICED_POWER_STATE_START_INDEX = DEVICED_POWER_STATE_MIN_INDEX, + DEVICED_POWER_STATE_NORMAL_INDEX, + DEVICED_POWER_STATE_SLEEP_INDEX, + DEVICED_POWER_STATE_POWEROFF_INDEX, + DEVICED_POWER_STATE_REBOOT_INDEX, + DEVICED_POWER_STATE_EXIT_INDEX, + DEVICED_POWER_STATE_MAX_INDEX, + + DEVICED_POWER_TRANSIENT_STATE_MIN_INDEX, + DEVICED_POWER_TRANSIENT_STATE_RESUMING_EARLY_INDEX = DEVICED_POWER_TRANSIENT_STATE_MIN_INDEX, + DEVICED_POWER_TRANSIENT_STATE_RESUMING_INDEX, + DEVICED_POWER_TRANSIENT_STATE_RESUMING_LATE_INDEX, + DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY_INDEX, + DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_INDEX, + DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE_INDEX, + DEVICED_POWER_TRANSIENT_STATE_MAX_INDEX, +}; + +#define DEVICED_POWER_STATE_UNDEFINED (0) + +#define DEVICED_POWER_STATE_START (1ULL << DEVICED_POWER_STATE_START_INDEX) +#define DEVICED_POWER_STATE_NORMAL (1ULL << DEVICED_POWER_STATE_NORMAL_INDEX) +#define DEVICED_POWER_STATE_SLEEP (1ULL << DEVICED_POWER_STATE_SLEEP_INDEX) +#define DEVICED_POWER_STATE_POWEROFF (1ULL << DEVICED_POWER_STATE_POWEROFF_INDEX) +#define DEVICED_POWER_STATE_REBOOT (1ULL << DEVICED_POWER_STATE_REBOOT_INDEX) +#define DEVICED_POWER_STATE_EXIT (1ULL << DEVICED_POWER_STATE_EXIT_INDEX) +#define DEVICED_POWER_STATE_ALL ((1ULL << DEVICED_POWER_STATE_MAX_INDEX) - (1ULL << DEVICED_POWER_STATE_MIN_INDEX)) + +#define DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY (1ULL << DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_SUSPENDING (1ULL << DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE (1ULL << DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_RESUMING_EARLY (1ULL << DEVICED_POWER_TRANSIENT_STATE_RESUMING_EARLY_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_RESUMING (1ULL << DEVICED_POWER_TRANSIENT_STATE_RESUMING_INDEX) +#define DEVICED_POWER_TRANSIENT_STATE_RESUMING_LATE (1ULL << DEVICED_POWER_TRANSIENT_STATE_RESUMING_LATE_INDEX) + +#define DEVICED_POWER_STATE_INDEX(state) (__builtin_ctzll(state)) + +struct syscommon_plugin_deviced_power_trans_info { + u_int64_t curr; + u_int64_t next; + int reason; + const void *data; +}; + +static inline u_int64_t syscommon_plugin_deviced_power_convert_to_power_state(const char *str) +{ + if (strncmp(str, "start", sizeof("start")) == 0) + return DEVICED_POWER_STATE_START; + else if (strncmp(str, "sleep", sizeof("sleep")) == 0) + return DEVICED_POWER_STATE_SLEEP; + else if (strncmp(str, "normal", sizeof("normal")) == 0) + return DEVICED_POWER_STATE_NORMAL; + else if (strncmp(str, "poweroff", sizeof("poweroff")) == 0) + return DEVICED_POWER_STATE_POWEROFF; + else if (strncmp(str, "reboot", sizeof("reboot")) == 0) + return DEVICED_POWER_STATE_REBOOT; + else if (strncmp(str, "exit", sizeof("exit")) == 0) + return DEVICED_POWER_STATE_EXIT; + else if (strncmp(str, "current", sizeof("current")) == 0) + return DEVICED_POWER_STATE_ALL; + + return DEVICED_POWER_STATE_UNDEFINED; +} + +/* + * Vital state enumeration + */ +enum syscommon_deviced_vital_state { + SYSCOMMON_DEVICED_VITAL_SLEEP, /* suspend state */ + SYSCOMMON_DEVICED_VITAL_WAKEUP, /* resume state */ + SYSCOMMON_DEVICED_VITAL_DISPLAY_WAKEUP, + SYSCOMMON_DEVICED_VITAL_EXIT, +}; + +enum syscommon_deviced_power_log_type { + SYSCOMMON_DEVICED_POWER_LOG_TYPE_MIN = 0, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_KEY_PRESS = SYSCOMMON_DEVICED_POWER_LOG_TYPE_MIN, /* key log */ + SYSCOMMON_DEVICED_POWER_LOG_TYPE_KEY_LONG_PRESS, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_KEY_RELEASE, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_ON, /* lcd log */ + SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_ON_COMPLETE, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_ON_FAIL, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_DIM, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_DIM_FAIL, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_OFF, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_OFF_COMPLETE, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_OFF_FAIL, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_LCD_CONTROL_FAIL, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_SLEEP, + SYSCOMMON_DEVICED_POWER_LOG_TYPE_MAX +}; + +#ifdef __cplusplus +} +#endif + +#endif /*__SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__ */ diff --git a/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-power.h b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-power.h new file mode 100644 index 0000000..0ae2223 --- /dev/null +++ b/src/plugin-api/deviced/include/system/syscommon-plugin-deviced-power.h @@ -0,0 +1,36 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_DEVICED_POWER_H__ +#define __SYSCOMMON_PLUGIN_DEVICED_POWER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*__SYSCOMMON_PLUGIN_DEVICED_POWER_H__ */ diff --git a/src/plugin-api/deviced/src/common.h b/src/plugin-api/deviced/src/common.h deleted file mode 100644 index 236c616..0000000 --- a/src/plugin-api/deviced/src/common.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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 __COMMON_H__ -#define __COMMON_H__ - -#ifdef ENABLE_DLOG -#include - -#define _D(fmt, args...) SLOGD(fmt, ##args) -#define _I(fmt, args...) SLOGI(fmt, ##args) -#define _W(fmt, args...) SLOGW(fmt, ##args) -#define _E(fmt, args...) SLOGE(fmt, ##args) -#else -#define _D(fmt, args...) do { } while(0) -#define _I(fmt, args...) do { } while(0) -#define _W(fmt, args...) do { } while(0) -#define _E(fmt, args...) do { } while(0) -#endif - -#endif /* __COMMON_H__ */ diff --git a/src/plugin-api/deviced/src/syscommon-plugin-deviced-battery.c b/src/plugin-api/deviced/src/syscommon-plugin-deviced-battery.c index f242f2d..bf459ae 100644 --- a/src/plugin-api/deviced/src/syscommon-plugin-deviced-battery.c +++ b/src/plugin-api/deviced/src/syscommon-plugin-deviced-battery.c @@ -23,11 +23,11 @@ */ #include -#include "syscommon-plugin-common.h" +#include -#include "common.h" -#include "syscommon-plugin-deviced-battery.h" -#include "syscommon-plugin-deviced-battery-interface.h" +#include +#include +#include #ifndef EXPORT #define EXPORT __attribute__((visibility("default"))) diff --git a/src/plugin-api/deviced/src/syscommon-plugin-deviced-display.c b/src/plugin-api/deviced/src/syscommon-plugin-deviced-display.c index ba04d4e..8819c47 100644 --- a/src/plugin-api/deviced/src/syscommon-plugin-deviced-display.c +++ b/src/plugin-api/deviced/src/syscommon-plugin-deviced-display.c @@ -23,11 +23,11 @@ */ #include -#include "syscommon-plugin-common.h" +#include -#include "common.h" -#include "syscommon-plugin-deviced-display.h" -#include "syscommon-plugin-deviced-display-interface.h" +#include +#include +#include #ifndef EXPORT #define EXPORT __attribute__((visibility("default"))) diff --git a/src/plugin-api/deviced/src/syscommon-plugin-deviced-input.c b/src/plugin-api/deviced/src/syscommon-plugin-deviced-input.c index 350e574..2e74d8c 100644 --- a/src/plugin-api/deviced/src/syscommon-plugin-deviced-input.c +++ b/src/plugin-api/deviced/src/syscommon-plugin-deviced-input.c @@ -23,11 +23,11 @@ */ #include -#include "syscommon-plugin-common.h" +#include -#include "common.h" -#include "syscommon-plugin-deviced-input.h" -#include "syscommon-plugin-deviced-input-interface.h" +#include +#include +#include #ifndef EXPORT #define EXPORT __attribute__((visibility("default"))) diff --git a/src/plugin-api/resourced/CMakeLists.txt b/src/plugin-api/resourced/CMakeLists.txt index 9060f8e..d595753 100644 --- a/src/plugin-api/resourced/CMakeLists.txt +++ b/src/plugin-api/resourced/CMakeLists.txt @@ -52,7 +52,7 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PLUGIN_API_RESOURCED_ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PLUGIN_API_RESOURCED_MAJORVER}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) -INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/system/ DESTINATION ${INCLUDEDIR} FILES_MATCHING PATTERN "*.h" ) diff --git a/src/plugin-api/resourced/include/syscommon-plugin-resourced-memory-lmk-interface.h b/src/plugin-api/resourced/include/syscommon-plugin-resourced-memory-lmk-interface.h deleted file mode 100644 index a07f0c4..0000000 --- a/src/plugin-api/resourced/include/syscommon-plugin-resourced-memory-lmk-interface.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_RESOURCED_MEMORY_LMK_INTERFACE_H__ -#define __SYSCOMMON_PLUGIN_RESOURCED_MEMORY_LMK_INTERFACE_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _syscommon_plugin_backend_resourced_memory_lmk_funcs { - int (*get_kill_candidates)(GArray *candidates, - GArray *task_info_app_array, - GArray *task_info_proc_array, - unsigned long totalram_kb); - int (*get_kill_candidates_post)(GArray *candidates); - int (*get_kill_candidates_post_with_wss)(GArray *candidates); - int (*get_kill_candidates_post_with_foreground)(GArray *candidates, - enum syscommon_resourced_memory_lmk_oom_level oom_level); -} syscommon_plugin_backend_resourced_memory_lmk_funcs; - -#ifdef __cplusplus -} -#endif - -#endif /* __SYSCOMMON_PLUGIN_RESOURCED_MEMORY_LMK_INTERFACE_H__ */ diff --git a/src/plugin-api/resourced/include/syscommon-plugin-resourced-memory-lmk.h b/src/plugin-api/resourced/include/syscommon-plugin-resourced-memory-lmk.h deleted file mode 100644 index d3d5b67..0000000 --- a/src/plugin-api/resourced/include/syscommon-plugin-resourced-memory-lmk.h +++ /dev/null @@ -1,156 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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_RESOURCED_MEMORY_LMK_H__ -#define __SYSCOMMON_PLUGIN_RESOURCED_MEMORY_LMK_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -enum syscommon_resourced_memory_lmk_oom_level { - OOM_LEVEL_BACKGROUND_LEAST_RECENTLY_USED, - OOM_LEVEL_BACKGROUND_MOST_RECENTLY_USED, - OOM_LEVEL_FOREGROUND, - OOM_LEVEL_FOREGROUND_AND_PROC, - OOM_LEVEL_ALL, -}; - -struct task_info { - /* - * Mostly, there are not multiple processes with the same pgid. - * So, for the frequent case, we use pid variable to avoid - * allocating arrays. - */ - pid_t pid; - GArray *pids; - pid_t pgid; - /* oom_score_adj is smae as /proc//oom_score_adj */ - int oom_score_adj; - /* - * oom_score_lru is same as oom_score_adj or adjusted by - * proc_app_info lru_state for apps that are marked as favourite. - * - * oom_score_lru is the main value used in comparison for LMK. - */ - int oom_score_lru; - int size; - /** - * proc_app_info_oom_killed and proc_app_info_flags - * are not used if task is not an app. - * Especially, proc_app_info_oom_killed is NULL when this task - * is not an app. - */ - bool *proc_app_info_oom_killed; - int proc_app_info_flags; - - /** - * TODO: A process can have more than one window, - * and an app can have more than one process. Therefore, - * a task_info can have more than one window. - */ - int window_pid; - int x; - int y; - int z; - int w; - int h; - int layer; - int opaque; - int visibility; - bool is_transformed; - bool alpha; - bool is_focused; - bool is_mapped; -}; - -/** - * @brief Get the backend data of resourced-memory-lmk module - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_resourced_memory_lmk_get_backend(void); - -/** - * @brief Put the backend data of resourced-memory-lmk module - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_resourced_memory_lmk_put_backend(void); - -/** - * @brief Call the get_kill_candidates function of resourced-memory-lmk module - * @param[in] candidates is an an GArray to return kill candidates - * @param[in] task_info_app_array is a GArray that contains app info - * @param[in] task_info_proc_array is a GArray that contains process info - * @param[in] totalram_kb is the total amount of memory in kibibytes - * @return @c the number of kill candidates on success, - * otherwise a negative error value - */ -int syscommon_plugin_resourced_memory_lmk_get_kill_candidates( - GArray *candidates, - GArray *task_info_app_array, - GArray *task_info_proc_array, - unsigned long totalram_kb); - -/** - * @brief Reorder candidates list, sorted first by get_kill_candidates fuction, - according to custom rule - * @param[in] candidates is a GArray to return kill candidates, it is already - sorted by get_kill_candidates - * @return @c zero on success, - * otherwise a negative error value - */ -int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post( - GArray *candidates); - -/** - * @brief Reorder candidates list sorted first by get_kill_candidates fuction - according to working set size rule - * @param[in] candidates is a GArray to return kill candidates, it is already - sorted by get_kill_candidates - * @return @c zero on success, - * otherwise a negative error value - */ -int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_wss( - GArray *candidates); - -/** - * @brief Reorder candidates list sorted first by get_kill_candidates fuction - according to foreground rule (i.e., rule for foreground apps) - * @param[in] candidates is a GArray to return kill candidates, it is already - sorted by get_kill_candidates - * @return @c zero on success, - * otherwise a negative error value - */ -int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_foreground( - GArray *candidates, - enum syscommon_resourced_memory_lmk_oom_level oom_level); - -#ifdef __cplusplus -} -#endif - -#endif /* __SYSCOMMON_PLUGIN_RESOURCED_MEMORY_LMK_H__ */ diff --git a/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk-interface.h b/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk-interface.h new file mode 100644 index 0000000..a07f0c4 --- /dev/null +++ b/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk-interface.h @@ -0,0 +1,49 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_RESOURCED_MEMORY_LMK_INTERFACE_H__ +#define __SYSCOMMON_PLUGIN_RESOURCED_MEMORY_LMK_INTERFACE_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _syscommon_plugin_backend_resourced_memory_lmk_funcs { + int (*get_kill_candidates)(GArray *candidates, + GArray *task_info_app_array, + GArray *task_info_proc_array, + unsigned long totalram_kb); + int (*get_kill_candidates_post)(GArray *candidates); + int (*get_kill_candidates_post_with_wss)(GArray *candidates); + int (*get_kill_candidates_post_with_foreground)(GArray *candidates, + enum syscommon_resourced_memory_lmk_oom_level oom_level); +} syscommon_plugin_backend_resourced_memory_lmk_funcs; + +#ifdef __cplusplus +} +#endif + +#endif /* __SYSCOMMON_PLUGIN_RESOURCED_MEMORY_LMK_INTERFACE_H__ */ diff --git a/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk.h b/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk.h new file mode 100644 index 0000000..d3d5b67 --- /dev/null +++ b/src/plugin-api/resourced/include/system/syscommon-plugin-resourced-memory-lmk.h @@ -0,0 +1,156 @@ +/** + * MIT License + * + * Copyright (c) 2023 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_RESOURCED_MEMORY_LMK_H__ +#define __SYSCOMMON_PLUGIN_RESOURCED_MEMORY_LMK_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum syscommon_resourced_memory_lmk_oom_level { + OOM_LEVEL_BACKGROUND_LEAST_RECENTLY_USED, + OOM_LEVEL_BACKGROUND_MOST_RECENTLY_USED, + OOM_LEVEL_FOREGROUND, + OOM_LEVEL_FOREGROUND_AND_PROC, + OOM_LEVEL_ALL, +}; + +struct task_info { + /* + * Mostly, there are not multiple processes with the same pgid. + * So, for the frequent case, we use pid variable to avoid + * allocating arrays. + */ + pid_t pid; + GArray *pids; + pid_t pgid; + /* oom_score_adj is smae as /proc//oom_score_adj */ + int oom_score_adj; + /* + * oom_score_lru is same as oom_score_adj or adjusted by + * proc_app_info lru_state for apps that are marked as favourite. + * + * oom_score_lru is the main value used in comparison for LMK. + */ + int oom_score_lru; + int size; + /** + * proc_app_info_oom_killed and proc_app_info_flags + * are not used if task is not an app. + * Especially, proc_app_info_oom_killed is NULL when this task + * is not an app. + */ + bool *proc_app_info_oom_killed; + int proc_app_info_flags; + + /** + * TODO: A process can have more than one window, + * and an app can have more than one process. Therefore, + * a task_info can have more than one window. + */ + int window_pid; + int x; + int y; + int z; + int w; + int h; + int layer; + int opaque; + int visibility; + bool is_transformed; + bool alpha; + bool is_focused; + bool is_mapped; +}; + +/** + * @brief Get the backend data of resourced-memory-lmk module + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_resourced_memory_lmk_get_backend(void); + +/** + * @brief Put the backend data of resourced-memory-lmk module + * @return @c 0 on success, otherwise a negative error value + */ +int syscommon_plugin_resourced_memory_lmk_put_backend(void); + +/** + * @brief Call the get_kill_candidates function of resourced-memory-lmk module + * @param[in] candidates is an an GArray to return kill candidates + * @param[in] task_info_app_array is a GArray that contains app info + * @param[in] task_info_proc_array is a GArray that contains process info + * @param[in] totalram_kb is the total amount of memory in kibibytes + * @return @c the number of kill candidates on success, + * otherwise a negative error value + */ +int syscommon_plugin_resourced_memory_lmk_get_kill_candidates( + GArray *candidates, + GArray *task_info_app_array, + GArray *task_info_proc_array, + unsigned long totalram_kb); + +/** + * @brief Reorder candidates list, sorted first by get_kill_candidates fuction, + according to custom rule + * @param[in] candidates is a GArray to return kill candidates, it is already + sorted by get_kill_candidates + * @return @c zero on success, + * otherwise a negative error value + */ +int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post( + GArray *candidates); + +/** + * @brief Reorder candidates list sorted first by get_kill_candidates fuction + according to working set size rule + * @param[in] candidates is a GArray to return kill candidates, it is already + sorted by get_kill_candidates + * @return @c zero on success, + * otherwise a negative error value + */ +int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_wss( + GArray *candidates); + +/** + * @brief Reorder candidates list sorted first by get_kill_candidates fuction + according to foreground rule (i.e., rule for foreground apps) + * @param[in] candidates is a GArray to return kill candidates, it is already + sorted by get_kill_candidates + * @return @c zero on success, + * otherwise a negative error value + */ +int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_foreground( + GArray *candidates, + enum syscommon_resourced_memory_lmk_oom_level oom_level); + +#ifdef __cplusplus +} +#endif + +#endif /* __SYSCOMMON_PLUGIN_RESOURCED_MEMORY_LMK_H__ */ diff --git a/src/plugin-api/resourced/src/common.h b/src/plugin-api/resourced/src/common.h deleted file mode 100644 index 236c616..0000000 --- a/src/plugin-api/resourced/src/common.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2023 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 __COMMON_H__ -#define __COMMON_H__ - -#ifdef ENABLE_DLOG -#include - -#define _D(fmt, args...) SLOGD(fmt, ##args) -#define _I(fmt, args...) SLOGI(fmt, ##args) -#define _W(fmt, args...) SLOGW(fmt, ##args) -#define _E(fmt, args...) SLOGE(fmt, ##args) -#else -#define _D(fmt, args...) do { } while(0) -#define _I(fmt, args...) do { } while(0) -#define _W(fmt, args...) do { } while(0) -#define _E(fmt, args...) do { } while(0) -#endif - -#endif /* __COMMON_H__ */ diff --git a/src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c b/src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c index 431625a..0d97201 100644 --- a/src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c +++ b/src/plugin-api/resourced/src/syscommon-plugin-resourced-memory-lmk.c @@ -25,11 +25,11 @@ #include #include -#include "syscommon-plugin-common.h" +#include -#include "common.h" -#include "syscommon-plugin-resourced-memory-lmk.h" -#include "syscommon-plugin-resourced-memory-lmk-interface.h" +#include +#include +#include #ifndef EXPORT #define EXPORT __attribute__((visibility("default")))