is_possible_to_notify_battery_full() is used from deviced to decide whether to notify battery full or not.
This function is relocated from deviced plugin module to here.
Change-Id: I02f7d52f0b2d3b5df4b9372c3f136aab2bb36df2
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(system-plugin-backend-deviced-mobile C)
+PROJECT(${PLUGIN_BACKEND_NAME} C)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(PKG_MODULES libsyscommon)
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PKGS REQUIRED ${PKG_MODULES})
-FOREACH(FLAG ${PKGS_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${FLAG}")
-ENDFOREACH(FLAG)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
-SET(SRCS src/battery/battery.c)
-
-ADD_LIBRARY(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS})
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${PLUGIN_LIB_DIR} COMPONENT RuntimeLibraries)
+ADD_SUBDIRECTORY(src/battery)
BuildRequires: cmake
BuildRequires: pkgconfig(libsyscommon)
+BuildRequires: pkgconfig(libsyscommon-plugin-api-deviced)
+BuildRequires: pkgconfig(dlog)
%description
System plugin backend for deviced mobile profile
+%define SYSTEM_PLUGIN_LIBDIR %{_libdir}/system/plugin
+
%prep
%setup -q
cp %{SOURCE1} .
-%define SYSTEM_PLUGIN_LIBDIR %{_libdir}/system/plugin
-
%build
-%cmake . -DPLUGIN_LIB_DIR=%{SYSTEM_PLUGIN_LIBDIR}
+%cmake . -DPLUGIN_BACKEND_NAME=%{name} \
+ -DPLUGIN_LIB_DIR=%{SYSTEM_PLUGIN_LIBDIR} \
+ -DPLUGIN_DEVICED_ENABLE_DLOG=1
make %{?jobs:-j%jobs}
%defattr(-,root,root,-)
%manifest %{name}.manifest
%license LICENSE.Apache-2.0
-%{SYSTEM_PLUGIN_LIBDIR}/*.so
+%{SYSTEM_PLUGIN_LIBDIR}/libplugin-backend-deviced-battery.so
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(plugin-backend-deviced-battery C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+if (${PLUGIN_DEVICED_ENABLE_DLOG})
+ SET(PKG_MODULES
+ libsyscommon
+ libsyscommon-plugin-api-deviced)
+ ADD_DEFINITIONS("-DENABLE_DLOG")
+ ADD_DEFINITIONS("-DLOG_TAG=\"SYSTEM_PLUGIN_DEVICED_BATTERY\"")
+else()
+ SET(PKG_MODULES
+ libsyscommon
+ libsyscommon-plugin-api-deviced)
+endif()
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(PKGS REQUIRED ${PKG_MODULES})
+FOREACH(flag ${PKGS_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED battery.c)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${PLUGIN_LIB_DIR} COMPONENT RuntimeLibraries)
\ No newline at end of file
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <stdlib.h>
+#include <errno.h>
+
+#include <system/syscommon-plugin-common-interface.h>
+#include <system/syscommon-plugin-deviced-battery.h>
+#include <system/syscommon-plugin-deviced-battery-interface.h>
+
+#define EXPORT __attribute__ ((visibility("default")))
+
+static bool is_possible_to_notify_battery_full(void)
+{
+ return true;
+}
+
+static int deviced_plugin_battery_init(void **data)
+{
+ syscommon_plugin_backend_deviced_battery_funcs *funcs = NULL;
+
+ funcs = calloc(1, sizeof(*funcs));
+ if (!funcs)
+ return -ENOMEM;
+
+ funcs->is_possible_to_notify_battery_full = is_possible_to_notify_battery_full;
+
+ *data = (void *)funcs;
+
+ return 0;
+}
+
+static int deviced_plugin_battery_exit(void *data)
+{
+ free(data);
+ return 0;
+}
+
+syscommon_plugin_backend EXPORT system_plugin_backend_deviced_battery = {
+ .name = "deviced-battery",
+ .vendor = "Samsung",
+ .abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
+ .init = deviced_plugin_battery_init,
+ .exit = deviced_plugin_battery_exit,
+};
\ No newline at end of file