From 469fb8f70107c5971277391c1bdfb4ccf34895b6 Mon Sep 17 00:00:00 2001 From: Daehyeon Jung Date: Wed, 8 Jan 2020 20:15:10 +0900 Subject: [PATCH] Add ambient-viewer skeleton - ambient-viewer skeleton Change-Id: Ic9e42dbf615c1bd807f509034bd9354a56c70cd0 --- CMakeLists.txt | 1 + ambient-viewer/CMakeLists.txt | 42 +++++++++++++++++++++++++++++ ambient-viewer/ambient-viewer.pc.in | 12 +++++++++ ambient-viewer/include/ambient_viewer.h | 48 +++++++++++++++++++++++++++++++++ ambient-viewer/src/ambient_viewer.c | 41 ++++++++++++++++++++++++++++ packaging/ambient-viewer.manifest | 5 ++++ packaging/libwidget_viewer.spec | 34 +++++++++++++++++++++++ 7 files changed, 183 insertions(+) create mode 100644 ambient-viewer/CMakeLists.txt create mode 100644 ambient-viewer/ambient-viewer.pc.in create mode 100644 ambient-viewer/include/ambient_viewer.h create mode 100644 ambient-viewer/src/ambient_viewer.c create mode 100644 packaging/ambient-viewer.manifest diff --git a/CMakeLists.txt b/CMakeLists.txt index e78d534..5de1b93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,7 @@ ADD_SUBDIRECTORY(watch-holder) ADD_SUBDIRECTORY(watch-control) ADD_SUBDIRECTORY(frame-broker) ADD_SUBDIRECTORY(frame-provider) +ADD_SUBDIRECTORY(ambient-viewer) ADD_SUBDIRECTORY(tool) ADD_SUBDIRECTORY(unittest) diff --git a/ambient-viewer/CMakeLists.txt b/ambient-viewer/CMakeLists.txt new file mode 100644 index 0000000..37efc30 --- /dev/null +++ b/ambient-viewer/CMakeLists.txt @@ -0,0 +1,42 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(ambient-viewer C) + +SET(PREFIX "${CMAKE_INSTALL_PREFIX}") +SET(PROJECT_NAME "${PROJECT_NAME}") +SET(LIBDIR ${LIB_INSTALL_DIR}) +SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") +SET(VERSION_MAJOR "${MAJORVER}") +SET(VERSION "${FULLVER}") + +AUX_SOURCE_DIRECTORY(src BUILD_SOURCE) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) + +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(ambient-viewer REQUIRED + dlog + glib-2.0 + elementary + bundle +) + +FOREACH(flag ${ambient-viewer_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Wall -Werror") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") +SET(CMAKE_C_FLAGS_RELEASE "-O2") + +ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) + +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${ambient-viewer_LDFLAGS}) + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc") + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ambient_viewer.h DESTINATION include/${PROJECT_NAME}) diff --git a/ambient-viewer/ambient-viewer.pc.in b/ambient-viewer/ambient-viewer.pc.in new file mode 100644 index 0000000..72a973d --- /dev/null +++ b/ambient-viewer/ambient-viewer.pc.in @@ -0,0 +1,12 @@ +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: ui_app_ambient_viewer +Description: Support development of the ambient viewer +Version: @VERSION@ +Libs: -L${libdir} -lui_app_ambient_viewer +Cflags: -I${includedir} +cppflags: -I${includedir} + diff --git a/ambient-viewer/include/ambient_viewer.h b/ambient-viewer/include/ambient_viewer.h new file mode 100644 index 0000000..8859bbd --- /dev/null +++ b/ambient-viewer/include/ambient_viewer.h @@ -0,0 +1,48 @@ +#include +#include +#include + +typedef void *ambient_viewer_h; + +typedef enum { + AMBIENT_EVENT_CHANGE_READY, +} ambient_event_type_e; + +typedef void (*ambient_viewer_lifecycle_added_cb)(const char *appid, + const char *inst_id, bool is_watch, void *user_data); + +typedef void (*ambient_viewer_lifecycle_removed_cb)(const char *appid, + const char *inst_id, bool is_watch, void *user_data); + +typedef void (*ambient_viewer_lifecycle_updated_cb)(const char *appid, + const char *inst_id, Evas_Object *image, bool is_watch, + void *user_data); + + +typedef struct { + ambient_viewer_lifecycle_added_cb added; + ambient_viewer_lifecycle_removed_cb deleted; + ambient_viewer_lifecycle_updated_cb updated; +} ambient_viewer_lifecycle_s; + +int ambient_viewer_create(Evas_Object *win, ambient_viewer_h *handle); + +int ambient_viewer_destroy(ambient_viewer_h handle); + +int ambient_viewer_notify_ambient_changed_event(ambient_viewer_h handle, + const char *appid, const char *instance_id, bool enter, + bundle *extra); + +int ambient_viewer_monitor(ambient_viewer_h handle, + ambient_viewer_lifecycle_s lifecycle, void *user_data); + +int ambient_viewer_unmonitor(ambient_viewer_h handle); + +typedef void (*ambient_viewer_event_cb)(ambient_event_type_e event, + const char *sender, bundle *extra, void *user_data); + +int ambient_viewer_set_event_listener(ambient_viewer_h handle, + ambient_viewer_event_cb callback, void *user_data); + +int ambient_viewer_unset_event_listener(ambient_viewer_h handle); + diff --git a/ambient-viewer/src/ambient_viewer.c b/ambient-viewer/src/ambient_viewer.c new file mode 100644 index 0000000..f22f941 --- /dev/null +++ b/ambient-viewer/src/ambient_viewer.c @@ -0,0 +1,41 @@ +#include + + +int ambient_viewer_create(Evas_Object *win, ambient_viewer_h *handle) +{ + return 0; +} + +int ambient_viewer_destroy(ambient_viewer_h handle) +{ + return 0; +} + +int ambient_viewer_notify_ambient_changed_event(ambient_viewer_h handle, + const char *appid, const char *instance_id, bool enter, + bundle *extra) +{ + return 0; +} + +int ambient_viewer_monitor(ambient_viewer_h handle, + ambient_viewer_lifecycle_s lifecycle, void *user_data) +{ + return 0; +} + +int ambient_viewer_unmonitor(ambient_viewer_h handle) +{ + return 0; +} + +int ambient_viewer_set_event_listener(ambient_viewer_h handle, + ambient_viewer_event_cb callback, void *user_data) +{ + return 0; +} + +int ambient_viewer_unset_event_listener(ambient_viewer_h handle) +{ + return 0; +} diff --git a/packaging/ambient-viewer.manifest b/packaging/ambient-viewer.manifest new file mode 100644 index 0000000..a76fdba --- /dev/null +++ b/packaging/ambient-viewer.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/libwidget_viewer.spec b/packaging/libwidget_viewer.spec index 21f2f8f..545bad3 100644 --- a/packaging/libwidget_viewer.spec +++ b/packaging/libwidget_viewer.spec @@ -13,6 +13,7 @@ Source1004: watch-control.manifest Source1005: frame-broker.manifest Source1006: frame-provider.manifest Source1007: watch-holder.manifest +Source1008: ambient-viewer.manifest BuildRequires: cmake, gettext-tools, coreutils, edje-bin BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(aul) @@ -56,6 +57,7 @@ cp %{SOURCE1004} . cp %{SOURCE1005} . cp %{SOURCE1006} . cp %{SOURCE1007} . +cp %{SOURCE1008} . %build %if 0%{?gcov:1} @@ -190,6 +192,7 @@ Header & package configuration of watch-control ################################################ # libwatch_holder +################################################ %package -n watch-holder Summary: APIs to control watch applications Version: 0.0.1 @@ -258,6 +261,29 @@ Header & package configuration for the callee (devel) %postun -n frame-provider -p /sbin/ldconfig ################################################ +# libambient-viewer +################################################ +%package -n ambient-viewer +Summary: APIs to control ambient viewer +Version: 0.0.1 +License: apache-2.0 +Group: Applications/Core Applications + +%description -n ambient-viewer +A set of APIs to control viewer applications + +%package -n ambient-viewer-devel +Summary: APIs to control watch applications +Group: Development/Libraries +Requires: ambient-viewer + +%description -n ambient-viewer-devel +Header & package configuration of ambient-viewer + +%post -n ambient-viewer -p /sbin/ldconfig +%postun -n ambient-viewer -p /sbin/ldconfig + +################################################ # files ################################################ %files -n %{name}_evas @@ -320,4 +346,12 @@ Header & package configuration for the callee (devel) %{_libdir}/pkgconfig/frame-provider.pc %{_libdir}/libframe-provider.so +%files -n ambient-viewer +%manifest ambient-viewer.manifest +%{_libdir}/libambient-viewer.so.* + +%files -n ambient-viewer-devel +%{_includedir}/ambient-viewer/*.h +%{_libdir}/pkgconfig/ambient-viewer.pc +%{_libdir}/libambient-viewer.so # End of a file -- 2.7.4