From cf4be8bb15d827cab3b4c4fcd9ef84c6dfa55490 Mon Sep 17 00:00:00 2001 From: "jk7744.park" Date: Sat, 24 Oct 2015 15:40:04 +0900 Subject: [PATCH] tizen 2.4 release --- CMakeLists.txt | 8 +- LICENSE | 0 TC/_export_env.sh | 10 - TC/_export_target_env.sh | 9 - TC/clean.sh | 11 - TC/config | 3 - TC/push.sh | 13 - TC/run.sh | 15 - TC/testcase/Makefile | 35 -- TC/testcase/tslist | 1 - TC/testcase/utc_minicontrol | Bin 41173 -> 0 bytes TC/testcase/utc_minicontrol.c | 303 ----------------- TC/tet_scen | 7 - TC/tetbuild.cfg | 5 - TC/tetclean.cfg | 5 - TC/tetexec.cfg | 5 - debian/changelog | 15 - debian/compat | 1 - debian/control | 25 -- debian/dirs | 2 - debian/docs | 1 - debian/libminicontrol-dev.install.in | 2 - debian/libminicontrol.install.in | 1 - debian/rules | 116 ------- doc/doxygen.conf | 2 +- doc/minicontrol_doc.h | 24 +- include/minicontrol-error.h | 22 +- include/minicontrol-handler.h | 359 -------------------- include/minicontrol-internal-handler.h | 67 ---- include/minicontrol-internal.h | 70 +++- include/minicontrol-log.h | 0 include/minicontrol-monitor.h | 57 +--- include/minicontrol-provider-internal.h | 35 ++ include/minicontrol-provider.h | 74 +++-- include/minicontrol-type.h | 133 +++++--- include/minicontrol-viewer-internal.h | 15 + include/minicontrol-viewer.h | 64 +++- include/minicontrol.h | 5 +- minicontrol-handler.pc.in | 0 minicontrol-monitor.pc.in | 0 packaging/minicontrol.spec | 7 +- src/minicontrol-handler.c | 118 ------- src/minicontrol-internal-handler.c | 506 ---------------------------- src/minicontrol-internal.c | 119 ++++--- src/minicontrol-monitor.c | 428 +++--------------------- src/minicontrol-provider.c | 561 +++++++++++++++----------------- src/minicontrol-viewer.c | 228 ++++++++++--- 47 files changed, 902 insertions(+), 2585 deletions(-) mode change 100755 => 100644 CMakeLists.txt mode change 100755 => 100644 LICENSE delete mode 100755 TC/_export_env.sh delete mode 100755 TC/_export_target_env.sh delete mode 100755 TC/clean.sh delete mode 100755 TC/config delete mode 100755 TC/push.sh delete mode 100755 TC/run.sh delete mode 100755 TC/testcase/Makefile delete mode 100755 TC/testcase/tslist delete mode 100755 TC/testcase/utc_minicontrol delete mode 100755 TC/testcase/utc_minicontrol.c delete mode 100755 TC/tet_scen delete mode 100755 TC/tetbuild.cfg delete mode 100755 TC/tetclean.cfg delete mode 100755 TC/tetexec.cfg delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/dirs delete mode 100644 debian/docs delete mode 100644 debian/libminicontrol-dev.install.in delete mode 100644 debian/libminicontrol.install.in delete mode 100755 debian/rules mode change 100755 => 100644 doc/doxygen.conf mode change 100755 => 100644 doc/minicontrol_doc.h mode change 100755 => 100644 include/minicontrol-error.h delete mode 100755 include/minicontrol-handler.h delete mode 100755 include/minicontrol-internal-handler.h mode change 100755 => 100644 include/minicontrol-internal.h mode change 100755 => 100644 include/minicontrol-log.h mode change 100755 => 100644 include/minicontrol-monitor.h create mode 100644 include/minicontrol-provider-internal.h mode change 100755 => 100644 include/minicontrol-provider.h mode change 100755 => 100644 include/minicontrol-type.h create mode 100644 include/minicontrol-viewer-internal.h mode change 100755 => 100644 include/minicontrol-viewer.h mode change 100755 => 100644 include/minicontrol.h mode change 100755 => 100644 minicontrol-handler.pc.in mode change 100755 => 100644 minicontrol-monitor.pc.in mode change 100755 => 100644 packaging/minicontrol.spec delete mode 100755 src/minicontrol-handler.c delete mode 100755 src/minicontrol-internal-handler.c mode change 100755 => 100644 src/minicontrol-internal.c mode change 100755 => 100644 src/minicontrol-monitor.c mode change 100755 => 100644 src/minicontrol-provider.c mode change 100755 => 100644 src/minicontrol-viewer.c diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index ff1e4f7..690d3b0 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,17 +14,18 @@ SET(CMAKE_SKIP_BUILD_RPATH true) SET(INSTALL_HEADERS minicontrol-error.h minicontrol-type.h + minicontrol-internal.h minicontrol-monitor.h minicontrol-provider.h + minicontrol-provider-internal.h minicontrol-viewer.h - minicontrol-handler.h + minicontrol-viewer-internal.h ) SET(SUBMODULES minicontrol-provider minicontrol-viewer minicontrol-monitor - minicontrol-handler ) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) @@ -43,7 +44,7 @@ FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -g -Wall -fPIC") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -g -Wall -fPIC ") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") @@ -52,7 +53,6 @@ ADD_DEFINITIONS("-DMINICTRL_USE_DLOG") ADD_LIBRARY(${PROJECT_NAME}-inter STATIC src/minicontrol-internal.c - src/minicontrol-internal-handler.c ) TARGET_LINK_LIBRARIES(${PROJECT_NAME}-inter ${pkgs_LDFLAGS}) diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/TC/_export_env.sh b/TC/_export_env.sh deleted file mode 100755 index 7a317f8..0000000 --- a/TC/_export_env.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -source ./config - -export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path -#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware target path -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh deleted file mode 100755 index 5e005cf..0000000 --- a/TC/_export_target_env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -. ./config - -export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path -#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/clean.sh b/TC/clean.sh deleted file mode 100755 index 29743e0..0000000 --- a/TC/clean.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -. ./_export_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -RESULT_DIR=results - -tcc -c -p ./ # executing tcc, with clean option (-c) -rm -r $RESULT_DIR -rm -r tet_tmp_dir -rm testcase/tet_captured diff --git a/TC/config b/TC/config deleted file mode 100755 index e4fd50a..0000000 --- a/TC/config +++ /dev/null @@ -1,3 +0,0 @@ -PKG_NAME=minicontrol -TET_INSTALL_HOST_PATH=/var/tmp/dts_fw/TC/TETware -TET_INSTALL_TARGET_PATH=/opt/home/$PKG_NAME/TETware diff --git a/TC/push.sh b/TC/push.sh deleted file mode 100755 index 5eb9510..0000000 --- a/TC/push.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -. ./config - -TC_PATH=/opt/home/$PKG_NAME - -echo $TC_PATH - -sdb shell "mkdir -p $TC_PATH" - -sdb push . $TC_PATH - - diff --git a/TC/run.sh b/TC/run.sh deleted file mode 100755 index cec5778..0000000 --- a/TC/run.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -source ./_export_target_env.sh - -export TET_SUITE_ROOT=`pwd` -FILE_NAME_EXTENSION=`date +%s` - -RESULT_DIR=results -HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -e -j $JOURNAL_RESULT -p ./ -grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile deleted file mode 100755 index ae79127..0000000 --- a/TC/testcase/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -include ../config - -CC ?= gcc - -C_FILES = $(shell ls *.c) - -PKGS += minicontrol-monitor -PKGS += minicontrol-provider -PKGS += minicontrol-viewer -PKGS += minicontrol-viewer -PKGS += dlog -PKGS += elementary -PKGS += evas -PKGS += ecore-evas -PKGS += dbus-1 -PKGS += dbus-glib-1 -PKGS += glib-2.0 -LDFLAGS = `pkg-config --libs $(PKGS)` -LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s - -CFLAGS = -I. `pkg-config --cflags $(PKGS)` -CFLAGS += -I$(TET_ROOT)/inc/tet3 -CFLAGS += -Wall - -TCS := $(shell ls -1 *.c | cut -d. -f1) - -all: $(TCS) - -%: %.c - $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) - -clean: - rm -f $(TCS) diff --git a/TC/testcase/tslist b/TC/testcase/tslist deleted file mode 100755 index dc1d735..0000000 --- a/TC/testcase/tslist +++ /dev/null @@ -1 +0,0 @@ -/testcase/utc_minicontrol \ No newline at end of file diff --git a/TC/testcase/utc_minicontrol b/TC/testcase/utc_minicontrol deleted file mode 100755 index 871e6b18207a151acded152fa6e38f1ba546c1be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 41173 zcmeIbe|*%%wg3O#Bxnp#B1T1^x+qk%5En#=UerWDKoKHD%WbinUmFtHWY_ElL(6T0 zP^B%jD5&&SWxb`Xx7Dh**wPkTw6vF6+H$YfT7UGCgsrIb7F%oWRm<6lfzm)Z`jMeF9uJ(DDcM+s_dk0-y4Dy8WiLgDi3(la^If>EU)q;8&BYQ z-M$Y~m%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=T|DOYZ^ig z5GG9!;3J@#x+W9lRuI=WOmohcI2$`V(yeVVk0wm61Y8_EXn~@1B-8d04EvOOlxv(k z{vNgI!6QTI#@6Qg##p}*pFU?AHar?NPhMbxHR}Ahv87&g+COuNV%AiW2iRZXISB#s zjM;N9ubv&9d&L#=r*lc8`tsS+qxShE8fT(h`D|U%nqF!EB+J-`%AEH)Q@4x))((dPp$Oj-++ zLX*7aR4lgGEu~t5DKI)~F0rQ8_Go8{3j#bu)85#YbddvAeQ_9on=od)#^PtOlop9^u+mYr6r1$F;bx(3*B>(=qK$be5%5-IOK@Y!RAFw}_?2l=^{4KXNoY#g$+i7Um!Tdt^b<5ZW*RkA?>^5v#6)XxpN8cnq% zZZfzUSSAvm*fpSnfVccLkHM|goToY)b>%(Zx<;dox<4Onh{BO8?5NQ|BQ1umFDdTU z(VKLROkrYxzA=s+b0c%yY&zE^DI&U~57BgIFlhZHL$ooYq203-2%<5x|H zPpl8FT;^8{Tg|PDm|*JOaqDB z%}g)Nv&DXcQ_a39U?8N;jAbVXt<`A>i=RVO>8rjbH#aljKdL*I@Sode<_3uw`M#`K dshLP)3pd+MOshFF&xjCL+|6}W!)CB*`hOXAUsnJC diff --git a/TC/testcase/utc_minicontrol.c b/TC/testcase/utc_minicontrol.c deleted file mode 100755 index cf890d0..0000000 --- a/TC/testcase/utc_minicontrol.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TEST_PKG "org.tizen.tetware" - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -static void startup(void); -static void cleanup(void); - -static void utc_minicontrol_monitor_start_n(void); -static void utc_minicontrol_monitor_start_p(void); -static void utc_minicontrol_monitor_stop_p(void); -static void utc_minicontrol_win_add_n(void); -static void utc_minicontrol_win_add_p(void); -static void utc_minicontrol_request_n(void); -static void utc_minicontrol_request_p(void); -static void utc_minicontrol_viewer_add_n(void); -static void utc_minicontrol_viewer_add_p(void); -static void utc_minicontrol_viewer_image_object_get_n(void); -static void utc_minicontrol_viewer_image_object_get_p(void); -static void utc_minicontrol_viewer_request_n(void); -static void utc_minicontrol_viewer_request_p(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -struct tet_testlist tet_testlist[] = { - {utc_minicontrol_monitor_start_n, NEGATIVE_TC_IDX}, - {utc_minicontrol_monitor_start_p, POSITIVE_TC_IDX}, - {utc_minicontrol_monitor_stop_p, POSITIVE_TC_IDX}, - {utc_minicontrol_win_add_n, NEGATIVE_TC_IDX}, - {utc_minicontrol_win_add_p, POSITIVE_TC_IDX}, - {utc_minicontrol_request_n, NEGATIVE_TC_IDX}, - {utc_minicontrol_request_p, POSITIVE_TC_IDX}, - {utc_minicontrol_viewer_add_n, NEGATIVE_TC_IDX}, - {utc_minicontrol_viewer_add_p, POSITIVE_TC_IDX}, - {utc_minicontrol_viewer_image_object_get_n, NEGATIVE_TC_IDX}, - {utc_minicontrol_viewer_image_object_get_p, POSITIVE_TC_IDX}, - {utc_minicontrol_viewer_request_n, NEGATIVE_TC_IDX}, - {utc_minicontrol_viewer_request_p, POSITIVE_TC_IDX}, - { NULL, 0 }, -}; - -static void _minicontrol_monitor_cb(minicontrol_action_e action, - const char *name, - unsigned int width, - unsigned int height, - minicontrol_priority_e priority, - void *data) { - -} - -static Evas_Object *_ui_window_add(void) -{ - Evas_Object *eo = NULL; - - eo = elm_win_add(NULL, "TETware", ELM_WIN_BASIC); - - if (eo != NULL) { - elm_win_title_set(eo, "TETware"); - elm_win_borderless_set(eo, EINA_TRUE); - elm_win_autodel_set(eo, EINA_TRUE); - evas_object_show(eo); - } - - return eo; -} - -static void startup(void) -{ - /* start of TC */ - tet_printf("\n TC start"); -} - - -static void cleanup(void) -{ - /* end of TC */ - tet_printf("\n TC end"); -} - -/** - * @brief Negative test case of minicontrol_monitor_start() - */ -static void utc_minicontrol_monitor_start_n(void) -{ - int ret; - - ret = minicontrol_monitor_start(NULL, NULL); - - dts_check_eq("minicontrol_monitor_start", ret, MINICONTROL_ERROR_INVALID_PARAMETER, - "Must return MINICONTROL_ERROR_INVALID_PARAMETER in case of invalid parameter"); -} - -/** - * @brief Positive test case of minicontrol_monitor_start() - */ -static void utc_minicontrol_monitor_start_p(void) -{ - int ret; - - ret = minicontrol_monitor_start(_minicontrol_monitor_cb, NULL); - - dts_check_eq("minicontrol_monitor_start", ret, MINICONTROL_ERROR_NONE, - "Must return MINICONTROL_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of minicontrol_monitor_stop() - */ -static void utc_minicontrol_monitor_stop_p(void) -{ - int ret; - - ret = minicontrol_monitor_start(_minicontrol_monitor_cb, NULL); - ret = minicontrol_monitor_stop(); - - dts_check_eq("minicontrol_monitor_start", ret, MINICONTROL_ERROR_NONE, - "Must return MINICONTROL_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of minicontrol_win_add() - */ -static void utc_minicontrol_win_add_n(void) -{ - int ret; - Evas_Object *win = NULL; - - win = minicontrol_win_add(NULL); - dts_check_eq("minicontrol_win_add", win, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of minicontrol_win_add() - */ -static void utc_minicontrol_win_add_p(void) -{ - int ret; - Evas_Object *win = NULL; - - elm_init(0, NULL); - win = minicontrol_win_add("TETWARE-minicontrol"); - dts_check_eq("minicontrol_win_add", win, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Negative test case of minicontrol_request() - */ -static void utc_minicontrol_request_n(void) -{ - int ret; - Evas_Object *win = NULL; - - ret = minicontrol_request(NULL, MINICONTROL_REQ_HIDE_VIEWER); - dts_check_eq("minicontrol_request", ret, MINICONTROL_ERROR_INVALID_PARAMETER, - "Must return MINICONTROL_ERROR_INVALID_PARAMETER in case of invalid parameter"); -} - -/** - * @brief Positive test case of minicontrol_request() - */ -static void utc_minicontrol_request_p(void) -{ - int ret; - Evas_Object *win = NULL; - - elm_init(0, NULL); - win = minicontrol_win_add("TETWARE-minicontrol"); - ret = minicontrol_request(win, MINICONTROL_REQ_HIDE_VIEWER); - dts_check_eq("minicontrol_request", ret, MINICONTROL_ERROR_INVALID_PARAMETER, - "Must return MINICONTROL_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of minicontrol_viewer_add() - */ -static void utc_minicontrol_viewer_add_n(void) -{ - int ret; - Evas_Object *win = NULL; - - win = minicontrol_viewer_add(NULL, NULL); - dts_check_eq("minicontrol_viewer_add", win, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of minicontrol_viewer_add() - */ -static void utc_minicontrol_viewer_add_p(void) -{ - int ret; - Evas_Object *win = NULL; - Evas_Object *viewer = NULL; -#if TBD - Evas_Object *parent = _ui_window_add(); -#else - Evas_Object *parent = NULL; -#endif - - win = minicontrol_win_add("TETWARE-minicontrol"); - viewer = minicontrol_viewer_add(parent, "TETWARE-minicontrol"); - - dts_check_eq("minicontrol_viewer_add", viewer, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Negative test case of minicontrol_viewer_image_object_get() - */ -static void utc_minicontrol_viewer_image_object_get_n(void) -{ - int ret; - Evas_Object *image = NULL; - Evas_Object *viewer = NULL; - Evas_Object *parent = NULL; - - image = minicontrol_viewer_image_object_get(NULL); - - dts_check_eq("minicontrol_viewer_image_object_get", image, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of minicontrol_viewer_image_object_get() - */ -static void utc_minicontrol_viewer_image_object_get_p(void) -{ - int ret; - Evas_Object *win = NULL; - Evas_Object *viewer = NULL; -#if TBD - Evas_Object *parent = _ui_window_add(); -#else - Evas_Object *parent = NULL; -#endif - Evas_Object *image = NULL; - - win = minicontrol_win_add("TETWARE-minicontrol"); - viewer = minicontrol_viewer_add(parent, "TETWARE-minicontrol"); - image = minicontrol_viewer_image_object_get(viewer); - - dts_check_eq("minicontrol_viewer_image_object_get", image, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Negative test case of minicontrol_viewer_request() - */ -static void utc_minicontrol_viewer_request_n(void) -{ - int ret; - - ret = minicontrol_viewer_request(NULL, MINICONTROL_REQ_HIDE_VIEWER, 0); - - dts_check_eq("minicontrol_viewer_request", ret, MINICONTROL_ERROR_INVALID_PARAMETER, - "Must return MINICONTROL_ERROR_INVALID_PARAMETER in case of invalid parameter"); -} - -/** - * @brief Positive test case of minicontrol_viewer_request() - */ -static void utc_minicontrol_viewer_request_p(void) -{ - int ret; - - ret = minicontrol_viewer_request("org.tizen.quickpanel", MINICONTROL_REQ_HIDE_VIEWER, 0); - - dts_check_eq("minicontrol_viewer_request", ret, MINICONTROL_ERROR_INVALID_PARAMETER, - "Must return MINICONTROL_ERROR_NONE in case of invalid parameter"); -} diff --git a/TC/tet_scen b/TC/tet_scen deleted file mode 100755 index 03f029a..0000000 --- a/TC/tet_scen +++ /dev/null @@ -1,7 +0,0 @@ -all - ^TEST -##### Scenarios for TEST ##### - -# Test scenario -TEST - :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg deleted file mode 100755 index f7eda55..0000000 --- a/TC/tetbuild.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option for build operation checking -TET_BUILD_TOOL=make # build with using make command -TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build -TET_API_COMPLIANT=True # use TET API in Test Case ? -TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg deleted file mode 100755 index 2a0477a..0000000 --- a/TC/tetclean.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option -TET_CLEAN_TOOL= make clean # clean tool -TET_CLEAN_FILE= Makefile # file for clean -TET_API_COMPLIANT=True # TET API useage -TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg deleted file mode 100755 index ef3e452..0000000 --- a/TC/tetexec.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capturing execution or not -TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional -TET_EXEC_FILE= # ex) exectool : execution file/ Optional -TET_API_COMPLIANT=True # Test case or Tool usesTET API? -TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index e1156cc..0000000 --- a/debian/changelog +++ /dev/null @@ -1,15 +0,0 @@ -minicontrol (0.0.1-2) unstable; urgency=low - - * apply minicontrol priority - * Git: slp/pkgs/m/minicontrol - * Tag: minicontrol_0.0.1-2 - - -- Jeonghoon Park Thu, 05 Apr 2012 12:12:49 +0900 - -minicontrol (0.0.1-1) unstable; urgency=low - - * Initial Release. - * Git: slp/pkgs/m/minicontrol - * Tag: minicontrol_0.0.1-1 - - -- Jeonghoon Park Mon, 27 Feb 2012 14:14:00 +0900 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100644 index 4fb4138..0000000 --- a/debian/control +++ /dev/null @@ -1,25 +0,0 @@ -Source: minicontrol -Section: libs -Priority: optional -Maintainer: Jeonghoon Park , Young-joo Park -Build-Depends: debhelper (>= 5), libecore-dev, libevas-dev, dlog-dev, libaul-1-dev, libelm-dev, libdbus-1-dev, libdbus-glib-1-dev -Standards-Version: 3.7.2 - -Package: libminicontrol -Section: libs -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Minicontrol supporting library (shared object) - -Package: libminicontrol-dev -Section: libs -Architecture: any -Depends: libminicontrol (= ${Source-Version}) -Description: Minicontrol supporting library (development) - -Package: libminicontrol-dbg -Section: debug -Architecture: any -Depends: ${misc:Depends}, libminicontrol (= ${Source-Version}) -Description: Minicontrol supporting library (unstripped) - diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index ca882bb..0000000 --- a/debian/dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin -usr/sbin diff --git a/debian/docs b/debian/docs deleted file mode 100644 index a0f0008..0000000 --- a/debian/docs +++ /dev/null @@ -1 +0,0 @@ -CMakeLists.txt diff --git a/debian/libminicontrol-dev.install.in b/debian/libminicontrol-dev.install.in deleted file mode 100644 index 1bc0c16..0000000 --- a/debian/libminicontrol-dev.install.in +++ /dev/null @@ -1,2 +0,0 @@ -@PREFIX@/include/@PROJECT_NAME@/*.h -@PREFIX@/lib/pkgconfig/*.pc diff --git a/debian/libminicontrol.install.in b/debian/libminicontrol.install.in deleted file mode 100644 index bf766f0..0000000 --- a/debian/libminicontrol.install.in +++ /dev/null @@ -1 +0,0 @@ -@PREFIX@/lib/*.so* diff --git a/debian/rules b/debian/rules deleted file mode 100755 index a8ed3d6..0000000 --- a/debian/rules +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -CFLAGS ?= -Wall -Werror -Winline -LDFLAGS ?= -PREFIX ?= /usr -DATADIR ?= /opt -PROJECT_NAME ?= minicontrol - -BUILDDIR ?= $(CURDIR)/cmake-tmp - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif - -LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -lm - -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. - mkdir -p $(BUILDDIR) && cd $(BUILDDIR) && CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX) - - touch configure-stamp - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - - # Add here commands to compile the package. - cd $(BUILDDIR) && $(MAKE) - #docbook-to-man debian/wavplayer.sgml > wavplayer.1 - - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - cat $$f > $${f%.in}; \ - sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ - sed -i -e "s#@PROJECT_NAME@#$(PROJECT_NAME)#g" $${f%.in}; \ - sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ - done - - - touch $@ - -clean: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - # Add here commands to clean up after the build process. - rm -rf $(BUILDDIR) - #rm -rf CMakeCache.txt CMakeFiles cmake_install.cmake Makefile install_manifest.txt - - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - rm -f $${f%.in}; \ - done - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/wavplayer. - cd $(BUILDDIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples - dh_install --sourcedir=debian/tmp -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_python -# dh_installinit -# dh_installcron -# dh_installinfo - dh_installman - dh_link - dh_strip --dbg-package=libminicontrol-dbg - dh_compress - dh_fixperms -# dh_perl - dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/doc/doxygen.conf b/doc/doxygen.conf old mode 100755 new mode 100644 index 6931c0f..e071192 --- a/doc/doxygen.conf +++ b/doc/doxygen.conf @@ -648,7 +648,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = ./minicontrol_doc.h ../include/minicontrol-error.h ../include/minicontrol.h ../include/minicontrol-monitor.h ../include/minicontrol-provider.h ../include/minicontrol-handler.h ../include/minicontrol-type.h ../include/minicontrol-viewer.h +INPUT = ./minicontrol_doc.h ../include/minicontrol-error.h ../include/minicontrol.h ../include/minicontrol-monitor.h ../include/minicontrol-provider.h ../include/minicontrol-type.h ../include/minicontrol-viewer.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/doc/minicontrol_doc.h b/doc/minicontrol_doc.h old mode 100755 new mode 100644 index 0535b1f..693235f --- a/doc/minicontrol_doc.h +++ b/doc/minicontrol_doc.h @@ -26,34 +26,17 @@ * Description * * - * @ref MINICONTROL_MONITOR_MODULE - * Provides functions for monitoring and viewing EFL socket window. - * - * * @ref MINICONTROL_PROVIDER_MODULE - * Provides functions for creating EFL socket window. + * Provides functions for creating EFL socket window. Application developers can make a minicontrol by composing ELF objects on this socket window * * * @ref MINICONTROL_VIEWER_MODULE - * Provides functions for displaying EFL socket window. + * Provides functions for displaying EFL socket window.
+ * minicontrol holders calls this functions to attach minicontrols on UI area. * * */ - -/** - * @defgroup MINICONTROL_MONITOR_MODULE Monitor - * @brief Minicontrol Monitor APIs - * @ingroup MINICONTROL_LIBRARY - * - * @section MINICONTROL_MONITOR_MODULE_HEADER Required Header - * \#include - * @section MINICONTROL_MONITOR_MODULE_OVERVIEW Overview - * It provides functions for monitoring and viewing EFL socket window. - * - */ - - /** * @defgroup MINICONTROL_PROVIDER_MODULE Provider * @brief Minicontrol Provider APIs @@ -66,7 +49,6 @@ * */ - /** * @defgroup MINICONTROL_VIEWER_MODULE Viewer * @brief Minicontrol Viewer APIs diff --git a/include/minicontrol-error.h b/include/minicontrol-error.h old mode 100755 new mode 100644 index 53d2909..ffa7d4c --- a/include/minicontrol-error.h +++ b/include/minicontrol-error.h @@ -17,28 +17,32 @@ #ifndef _MINICTRL_ERROR_H_ #define _MINICTRL_ERROR_H_ +#include + /** * @file minicontrol-error.h * @brief Minicontrol library error type. */ /** - * @addtogroup MINICONTROL_MONITOR_MODULE + * @addtogroup MINICONTROL_LIBRARY * @{ */ /** * @brief Enumeration for describing error code of minicontrol library. + * @since_tizen 2.4 */ typedef enum _minicontrol_error { - MINICONTROL_ERROR_NONE = 0, /**< MiniControl error none */ - MINICONTROL_ERROR_INVALID_PARAMETER = -1, /**< Invalid parameter */ - MINICONTROL_ERROR_OUT_OF_MEMORY = -2, /**< Out of memory */ - MINICONTROL_ERROR_DBUS = -3, /**< Dbus error */ - MINICONTROL_ERROR_BUNDLE = -4, - MINICONTROL_ERROR_NO_DATA = -5, - MINICONTROL_ERROR_UNKNOWN = -100, /**< Unknown error */ -}minicontrol_error_e; + MINICONTROL_ERROR_NONE = TIZEN_ERROR_NONE, /**< MiniControl error none */ + MINICONTROL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + MINICONTROL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + MINICONTROL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + MINICONTROL_ERROR_IPC_FAILURE = TIZEN_ERROR_MINICONTROL | 0x02, /**< IPC error */ + MINICONTROL_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< This function is not supported */ + MINICONTROL_ERROR_ELM_FAILURE = TIZEN_ERROR_MINICONTROL | 0x03, /**< Some error occurred when creating a minicontrol window */ + MINICONTROL_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN, /**< Unknown error */ +} minicontrol_error_e; /** * @} diff --git a/include/minicontrol-handler.h b/include/minicontrol-handler.h deleted file mode 100755 index f42cfd0..0000000 --- a/include/minicontrol-handler.h +++ /dev/null @@ -1,359 +0,0 @@ -/* - * Copyright (c) 2013-2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _MINICTRL_HANDLER_H_ -#define _MINICTRL_HANDLER_H_ - -#include -#include "minicontrol-error.h" -#include "minicontrol-type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file minicontrol-handler.h - * @brief This minicontrol handler library used to manage handler created with a minicontrol window - */ - -/** - * @addtogroup MINICONTROL_HANDLER_MODULE - * @{ - */ - -/** - * @brief minicontrol category : "UNKNOWN" is treated as "CLOCK" - */ -#define MINICONTROL_HDL_CATEGORY_UNKNOWN "UNKNOWN" -/** - * @brief minicontrol category : CLOCK - */ -#define MINICONTROL_HDL_CATEGORY_CLOCK "CLOCK" -/** - * @brief minicontrol category : NOTIFICATION - */ -#define MINICONTROL_HDL_CATEGORY_NOTIFICATION "NOTIFICATION" -/** - * @brief minicontrol category : DASHBOARD - */ -#define MINICONTROL_HDL_CATEGORY_DASHBOARD "DASHBOARD" - -/** - * @brief minicontrol operation : NONE(do nothing) - */ -#define MINICONTROL_HDL_OPERATION_NONE "NONE" -/** - * @brief minicontrol operation : add a minicontrol - */ -#define MINICONTROL_HDL_OPERATION_ADD "ADD" - /** - * @brief minicontrol operation : show a minicontrol - */ -#define MINICONTROL_HDL_OPERATION_SHOW "SHOW" -/** - * @brief minicontrol operation : remove a minicontrol - */ -#define MINICONTROL_HDL_OPERATION_REMOVE "REMOVE" -/** - * @brief minicontrol operation : reload(rearrange) a minicontrol on the viewer - */ -#define MINICONTROL_HDL_OPERATION_RELOAD "RELOAD" - -/** - * @brief minicontrol priority : LV1(TOP) - */ -#define MINICONTROL_HDL_PRIORITY_LV1 "LV1" -/** - * @brief minicontrol priority : LV2 - */ -#define MINICONTROL_HDL_PRIORITY_LV2 "LV2" -/** - * @brief minicontrol priority : LV3(BOTTOM) - */ -#define MINICONTROL_HDL_PRIORITY_LV3 "LV3" - -/** - * @addtogroup MINICONTROL_HANDLER_MODULE - * @{ - */ - -/** - * @brief Creates a minicontrol handle. - * - * @remarks The @a minicontrol handler must be released with minicontrol_handler_destroy() by you. - * @param [out] handler A minicontrol handle to be newly created on success - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MINICONTROL_ERROR_OUT_OF_MEMORY Out of memory - * @see minicontrol_handler_destroy() - */ -minicontrol_error_e minicontrol_handler_create(minicontrol_h *handler); - -/** - * @brief Destroys the minicontrol handler and releases all its resources. - * - * @param [in] handler The minicontrol handler - * @return MINICONTROL_ERROR_NONE on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MINICONTROL_ERROR_OUT_OF_MEMORY Out of memory - * @see minicontrol_handler_create() - */ -minicontrol_error_e minicontrol_handler_destroy(minicontrol_h handler); - -/** - * @brief clone a minicontrol handler - * - * @param [in] handler The minicontrol handler - * @param [in] handler_new The cloned minicontrol handler - * @return MINICONTROL_ERROR_NONE on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MINICONTROL_ERROR_OUT_OF_MEMORY Out of memory - * @see minicontrol_handler_create() - */ -minicontrol_error_e minicontrol_handler_clone(minicontrol_h handler, minicontrol_h *handler_new); - -/** - * @brief Sets the service name - * - * @remarks service name should be unique. - * @param [in] handler The minicontrol handle - * @param [in] name the service name - * If the @a name is NULL, it clears the previous value. - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @see minicontrol_handler_get_service_name() - */ -minicontrol_error_e minicontrol_handler_set_service_name(minicontrol_h handler, const char *name); - -/** - * @brief Gets the service name - * - * @remarks The @a name must be released with free() by you. - * @param [in] handler The minicontrol handle - * @param [out] name The service name - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MINICONTROL_ERROR_OUT_OF_MEMORY Out of memory - * @see minicontrol_handler_set_service_name() - */ -minicontrol_error_e minicontrol_handler_get_service_name(minicontrol_h handler, char **name); - -/** - * @brief Sets the category - * - * @param [in] handler The minicontrol handle - * @param [in] category the category - * If the @a category is NULL, it clears the previous value. - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @see minicontrol_handler_set_category() - * @see MINICONTROL_HDL_CATEGORY_UNKNOWN - * @see MINICONTROL_HDL_CATEGORY_CLOCK - * @see MINICONTROL_HDL_CATEGORY_NOTIFICATION - */ -minicontrol_error_e minicontrol_handler_set_category(minicontrol_h handler, const char *category); - -/** - * @brief Gets the category - * - * @remarks The @a category must be released with free() by you. - * @param [in] handler The minicontrol handle - * @param [out] category The category - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @see minicontrol_handler_set_service_name() - * @see MINICONTROL_HDL_CATEGORY_UNKNOWN - * @see MINICONTROL_HDL_CATEGORY_CLOCK - * @see MINICONTROL_HDL_CATEGORY_NOTIFICATION - */ -minicontrol_error_e minicontrol_handler_get_category(minicontrol_h handler, char **category); - -/** - * @brief Sets the operation - * - * @param [in] handler The minicontrol handle - * @param [in] operation the operation - * If the @a operation is NULL, it clears the previous value. - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @see minicontrol_handler_get_operation() - * @see MINICONTROL_HDL_OPERATION_NONE - * @see MINICONTROL_HDL_OPERATION_ADD - * @see MINICONTROL_HDL_OPERATION_REMOVE - * @see MINICONTROL_HDL_OPERATION_RELOAD - */ -minicontrol_error_e minicontrol_handler_set_operation(minicontrol_h handler, const char *operation); - -/** - * @brief Gets the operation - * - * @remarks The @a operation must be released with free() by you. - * @param [in] handler The minicontrol handle - * @param [out] operation The operation - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @see minicontrol_handler_set_operation() - */ -minicontrol_error_e minicontrol_handler_get_operation(minicontrol_h handler, char **operation); - -/** - * @brief Sets the operation - * - * @param [in] handler The minicontrol handle - * @param [in] priority the priority - * If the @a priority is NULL, it clears the previous value. - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @see minicontrol_handler_get_priority() - * @see MINICONTROL_HDL_PRIORITY_LV1 - * @see MINICONTROL_HDL_PRIORITY_LV1 - * @see MINICONTROL_HDL_PRIORITY_LV1 - */ -minicontrol_error_e minicontrol_handler_set_priority(minicontrol_h handler, const char *priority); - -/** - * @brief Gets the priority - * - * @remarks The @a priority must be released with free() by you. - * @param [in] handler The minicontrol handle - * @param [out] priority The priority - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @see MINICONTROL_HDL_PRIORITY_LV1 - * @see MINICONTROL_HDL_PRIORITY_LV1 - * @see MINICONTROL_HDL_PRIORITY_LV1 - * @see minicontrol_handler_set_priority() - */ -minicontrol_error_e minicontrol_handler_get_priority(minicontrol_h handler, char **priority); - -/** - * @brief Sets the timestamp - * - * @param [in] handler The minicontrol handle - * @param [in] timestamp the timestamp - * If the @a timestamp is NULL, it clears the previous value. - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @see minicontrol_handler_get_timestamp() - */ -minicontrol_error_e minicontrol_handler_set_timestamp(minicontrol_h handler, time_t timestamp); - -/** - * @brief Gets the timestamp - * - * @param [in] handler The minicontrol handle - * @param [out] timestamp The timestamp - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MINICONTROL_ERROR_OUT_OF_MEMORY Out of memory - * @see minicontrol_handler_set_timestamp() - */ -minicontrol_error_e minicontrol_handler_get_timestamp(minicontrol_h handler, time_t *timestamp); - -/** - * @brief Gets the pid which create the minicontrol - * - * @param [in] handler The minicontrol handle - * @param [out] pid The pid - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - */ -minicontrol_error_e minicontrol_handler_get_pid(minicontrol_h handler, int *pid); - -/** - * @brief Gets the state which create the minicontrol - * - * @param [in] handler The minicontrol handle - * @param [out] state The state - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - */ -minicontrol_error_e minicontrol_handler_state_get(minicontrol_h handler, int *state); - -/** - * @brief Adds the extra data to the handler. - * - * @remarks The function replaces any existing value for the given key. - * @remarks The function returns #MINICONTROL_ERROR_INVALID_PARAMETER if key or value is zero-length string. - * @remarks The function returns #MINICONTROL_ERROR_INVALID_PARAMETER if the application tries to use same key with system-defined key - * @param [in] handler The minicontrol handle - * @param [in] key The name of the extra data - * @param [in] value The value associated with given key - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Not available key - * @see minicontrol_handler_get_data() - * @see minicontrol_handler_remove_data() - */ -minicontrol_error_e minicontrol_handler_add_data(minicontrol_h handler, const char *key, const char *value); - -/** - * @brief Gets the extra data from the handler. - * - * @remarks The @a value must be released with free() by you. - * @remarks The function returns #MINICONTROL_ERROR_INVALID_PARAMETER if the value is array data type. - * @param [in] handler The minicontrol handle - * @param [int] key The name of the extra data - * @param [out] value The value associated with given key - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Specified key not found - * @retval #MINICONTROL_ERROR_OUT_OF_MEMORY Out of memory - * @see minicontrol_handler_add_data() - * @see minicontrol_handler_remove_data() - */ -minicontrol_error_e minicontrol_handler_get_data(minicontrol_h handler, const char *key, char **value); - -/** - * @brief Removes the extra data from the handler. - * - * @param [in] handler The minicontrol handle - * @param [in] key The name of the extra data - * @return 0 on success, otherwise a negative error value. - * @retval #MINICONTROL_ERROR_NONE Successful - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Specified key not found - * @see minicontrol_handler_add_data() - * @see minicontrol_handler_get_data() - */ -minicontrol_error_e minicontrol_handler_remove_data(minicontrol_h handler, const char *key); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif -#endif /* _MINICTRL_HANDLER_H_ */ diff --git a/include/minicontrol-internal-handler.h b/include/minicontrol-internal-handler.h deleted file mode 100755 index 3a4e661..0000000 --- a/include/minicontrol-internal-handler.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _MINICTRL_HANDLER_INTERNAL_H_ -#define _MINICTRL_HANDLER_INTERNAL_H_ - -#include -#include -#include "minicontrol-type.h" -#include "minicontrol-handler.h" - -struct _minicontrol_h { - bundle *data; -}; - -/*! - * contructor/deconstructor - */ -minicontrol_error_e _minictrl_handler_create(minicontrol_h *handler); -minicontrol_error_e _minictrl_handler_destroy(minicontrol_h handler); -minicontrol_error_e _minictrl_handler_clone(minicontrol_h handler, minicontrol_h *handler_new); -minicontrol_error_e _minictrl_handler_check_validation(minicontrol_h handler); - -/*! - * pre-defined properties - */ -minicontrol_error_e _minictrl_handler_set_service_name(minicontrol_h handler, const char *name); -minicontrol_error_e _minictrl_handler_get_service_name(minicontrol_h handler, char **name); -minicontrol_error_e _minictrl_handler_set_category(minicontrol_h handler, const char *category); -minicontrol_error_e _minictrl_handler_get_category(minicontrol_h handler, char **category); -minicontrol_error_e _minictrl_handler_set_operation(minicontrol_h handler, const char *operation); -minicontrol_error_e _minictrl_handler_get_operation(minicontrol_h handler, char **operation); -minicontrol_error_e _minictrl_handler_set_priority(minicontrol_h handler, const char *priority); -minicontrol_error_e _minictrl_handler_get_priority(minicontrol_h handler, char **priority); -minicontrol_error_e _minictrl_handler_set_pid(minicontrol_h handler); -minicontrol_error_e _minictrl_handler_get_pid(minicontrol_h handler, int *pid); -minicontrol_error_e _minictrl_handler_set_timestamp(minicontrol_h handler, time_t timestamp); -minicontrol_error_e _minictrl_handler_get_timestamp(minicontrol_h handler, time_t *timestamp); - -/*! - * user-defined properties - */ -minicontrol_error_e _minictrl_handler_add_extradata(minicontrol_h handler, const char *key, const char *value); -minicontrol_error_e _minictrl_handler_remove_extradata(minicontrol_h handler, const char *key); -minicontrol_error_e _minictrl_handler_get_extradata(minicontrol_h handler, const char *key, char **value); - -/*! - * utility functions - */ -minicontrol_error_e _minictrl_handler_get_raw_data(minicontrol_h handler, char **raw_data, int *length); -minicontrol_error_e _minictrl_handler_get_handler_from_raw_data(minicontrol_h *handler, char *raw_data, int length); - -#endif /* _MINICTRL_INTERNAL_H_ */ - diff --git a/include/minicontrol-internal.h b/include/minicontrol-internal.h old mode 100755 new mode 100644 index 1f3e9ea..da75883 --- a/include/minicontrol-internal.h +++ b/include/minicontrol-internal.h @@ -18,27 +18,72 @@ #define _MINICTRL_INTERNAL_H_ #include +#include +#include +#include #include "minicontrol-type.h" -#include "minicontrol-internal-handler.h" -#include "minicontrol-handler.h" #ifndef EXPORT_API #define EXPORT_API __attribute__ ((visibility("default"))) #endif /* EXPORT_API */ -#define MINICTRL_DBUS_SIG_START "minicontrol_start" -#define MINICTRL_DBUS_SIG_REALIZE "minicontrol_realize" -#define MINICTRL_DBUS_SIG_STOP "minicontrol_stop" -#define MINICTRL_DBUS_SIG_RESIZE "minicontrol_resize" #define MINICTRL_DBUS_SIG_RUNNING_REQ "minicontrol_running_request" -#define MINICTRL_DBUS_SIG_REQUEST "minicontrol_request" + +#define MINICTRL_DBUS_SIG_TO_PROVIDER "minicontrol_signal_to_provider" +#define MINICTRL_DBUS_SIG_TO_VIEWER "minicontrol_signal_to_viewer" + +#define BUNDLE_BUFFER_LENGTH 100 + +/** + * @brief Enumeration for describing type of dbus. + */ + +enum _minictrl_PROC_DBUS_TYPE { + MINICONTROL_DBUS_PROC_EXCLUDE, /**< Request to exclude from the unfreezing process list */ + MINICONTROL_DBUS_PROC_INCLUDE, /**< Request to include to the unfreezing process list */ +}; + +/** + * @brief Enumeration for describing type of actions allowed to inhouse apps. + * @since_tizen 2.4 + */ +typedef enum { + MINICONTROL_REQ_NONE = 0, + MINICONTROL_REQ_HIDE_VIEWER = 100, /**< Requests that the minicontrol viewer(s) close the provider's minicontrol */ + MINICONTROL_REQ_FREEZE_SCROLL_VIEWER, /**< Requests that the minicontrol viewer(s) freeze its window scroll */ + MINICONTROL_REQ_UNFREEZE_SCROLL_VIEWER, /**< Requests that the minicontrol viewer(s) unfreeze its window scroll */ + MINICONTROL_REQ_REPORT_VIEWER_ANGLE, /**< Requests the current angle of the minicontrol viewer */ + MINICONTROL_REQ_ROTATE_PROVIDER = 200, /**< Requests that the minicontrol provider rotate the provider's minicontrol */ +} minicontrol_request_e; + +/** + * @brief Enumeration for describing priority of a minicontrol provider. + * @since_tizen 2.4 + */ +typedef enum { + MINICONTROL_PRIORITY_TOP = 1000, /**< Top priority */ + MINICONTROL_PRIORITY_MIDDLE = 100, /**< Middle priority */ + MINICONTROL_PRIORITY_LOW = 1, /**< Low priority */ +} minicontrol_priority_e; + +/** + * @brief Enumeration for describing type of events originated by a minicontrol provider. + * @since_tizen 2.4 + */ +typedef enum _minicontrol_action { + MINICONTROL_ACTION_START = 0, /**< A minicontrol object is created */ + MINICONTROL_ACTION_STOP, /**< A minicontrol object is deleted */ + MINICONTROL_ACTION_RESIZE, /**< A minicontrol object is resized */ + MINICONTROL_ACTION_REQUEST, /**< the viewer of the minicontrol object is asked to do something */ +} minicontrol_action_e; + +typedef enum { + MINICONTROL_EVENT_REQUEST_LOCK = 1001, /**< A minicontrol object should not be removed by user */ +} minicontrol_internal_provider_event_e; typedef struct _minictrl_sig_handle minictrl_sig_handle; -int _minictrl_provider_message_send(const char *sig_name, const char *svr_name, - unsigned int witdh, unsigned int height, - minicontrol_priority_e priority, - minicontrol_h handler); +int _minictrl_provider_message_send(int event, const char *minicontrol_name, unsigned int witdh, unsigned int height, minicontrol_priority_e priority); int _minictrl_viewer_req_message_send(void); @@ -50,5 +95,8 @@ void _minictrl_dbus_sig_handle_dettach(minictrl_sig_handle *handle); int _minictrl_provider_proc_send(int type); +/* new */ +int _minictrl_send_event(const char *signal_name, const char *minicontrol_name, int event, bundle *signal_arg); + #endif /* _MINICTRL_INTERNAL_H_ */ diff --git a/include/minicontrol-log.h b/include/minicontrol-log.h old mode 100755 new mode 100644 diff --git a/include/minicontrol-monitor.h b/include/minicontrol-monitor.h old mode 100755 new mode 100644 index fc86817..404dd9e --- a/include/minicontrol-monitor.h +++ b/include/minicontrol-monitor.h @@ -19,73 +19,22 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { #endif -/** - * @file minicontrol-monitor.h - * @brief This minicontrol monitor library used to manage events triggered by minicontrol provider. - */ - -/** - * @addtogroup MINICONTROL_MONITOR_MODULE - * @{ - */ - - /** - * @brief Called when event is triggered. - * @param[in] action The type of fired event - * @param[in] name The name of provider - * @param[in] width The width of provider - * @param[in] height The height of provider - * @param[in] priority The priority of provider - * @param[in] data User data - * @pre minicontrol_monitor_start() used to register this callback. - * @see #minicontrol_action_e - * @see #minicontrol_priority_e - */ typedef void (*minicontrol_monitor_cb) (minicontrol_action_e action, const char *name, unsigned int width, unsigned int height, minicontrol_priority_e priority, void *data); -typedef void (*minicontrol_monitor_with_handler_cb) (minicontrol_action_e action, - const char *name, - unsigned int width, - unsigned int height, - minicontrol_priority_e priority, - minicontrol_h handler, - void *data); - -/** - * @brief Registers a callback for events originated by minicontrol provider. - * @param[in] callback Callback function - * @param[in] data User data - */ -minicontrol_error_e minicontrol_monitor_start(minicontrol_monitor_cb callback, - void *data); -/** - * @brief Register a callback for events originated by minicontrol provider - * @param[in] callback callback function - * @param[in] data user data - */ -minicontrol_error_e minicontrol_monitor_start_with_handler( - minicontrol_monitor_with_handler_cb callback, void *data); -/** - * @brief Unregisters a callback for events originated by minicontrol provider. - * @return #MINICONTROL_ERROR_NONE if success, other value if failure - * @see #minicontrol_error_e - */ -minicontrol_error_e minicontrol_monitor_stop(void); +int minicontrol_monitor_start(minicontrol_monitor_cb callback, void *data) DEPRECATED; -/** - * @} - */ +int minicontrol_monitor_stop(void) DEPRECATED; #ifdef __cplusplus } diff --git a/include/minicontrol-provider-internal.h b/include/minicontrol-provider-internal.h new file mode 100644 index 0000000..952db84 --- /dev/null +++ b/include/minicontrol-provider-internal.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2013-2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _MINICONTROL_PROVIDER_INTERNAL_H_ +#define _MINICONTROL_PROVIDER_INTERNAL_H_ + +#include +#include "minicontrol-error.h" +#include "minicontrol-type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +Evas_Object *minicontrol_win_add(const char *name) DEPRECATED; + +int minicontrol_request(Evas_Object *mincontrol, minicontrol_request_e request) DEPRECATED; + +#ifdef __cplusplus +} +#endif +#endif /* _MINICONTROL_PROVIDER_INTERNAL_H_ */ diff --git a/include/minicontrol-provider.h b/include/minicontrol-provider.h old mode 100755 new mode 100644 index 71e65e8..b02dc59 --- a/include/minicontrol-provider.h +++ b/include/minicontrol-provider.h @@ -18,6 +18,7 @@ #define _MINICTRL_PROVIDER_H_ #include +#include #include "minicontrol-error.h" #include "minicontrol-type.h" @@ -25,10 +26,12 @@ extern "C" { #endif - /** * @file minicontrol-provider.h - * @brief This minicontrol provider library used to create evas socket window. + * @brief This minicontrol provider library used to create evas socket window.\n + * This library is providing functions for create a remote evas object to draw a minicontrol on a minicontrol viewer and\n + * sending some requests to the minicontrol viewer.\n + * Drawings on this remote evas object will be shown on the place ofthe minicontrol viewer. */ /** @@ -37,45 +40,48 @@ extern "C" { */ /** - * @brief Creates evas socket window. - * @param[in] name Name of socket window - * @return Evas object of socket window - */ -Evas_Object *minicontrol_win_add(const char *name); - -/** - * @brief This function create evas socket window with a minicontrol handler - * - * @remarks minicontrol service name should be set before call this function - * @param[in] handler handler of socket window - * @return evas object of socket window - */ -Evas_Object *minicontrol_win_add_by_handler(minicontrol_h handler); - -/** - * @brief Requests various actions to the viewer. - * @param[in] minicontrol Evas object of socket window - * @param[in] action Type of action - * @return Evas object of socket window + * @brief Called when a event comes from viewer + * @since_tizen 2.4 + * @param[in] event_type The type of fired event + * @param[in] event_arg argument of the event + * @pre minicontrol_viewer_register_event_callback() used to register this callback. + * @see #minicontrol_create_window + * @see #minicontrol_viewer_event_e */ -minicontrol_error_e minicontrol_request(Evas_Object *mincontrol, minicontrol_request_e request); +typedef void (*minicontrol_event_cb) (minicontrol_viewer_event_e event_type, bundle *event_arg); /** - * @remarks you don't have to destory handler, the handler will be referenced by minicontrol lib - * @brief This function gets a minicontrol handler from the minicontrol object - * @param[in] minicontrol evas object of socket window - * @param[in] handler handler of socket window - * @return minicontrol handler + * @brief Creates a window for minicontrol. + * @since_tizen 2.4 + * @privlevel public + * @privilege %http://tizen.org/privilege/minicontrol.provider + * @param[in] name Name of minicontrol socket window + * @param[in] target_viewer Target viewer for minicontrol. You can select multiple viewers by using bitwise OR operator. + * @param[in] callback a callback function for events originated by minicontrol viewer. + * @return Evas object of socket window. @c NULL failed to create, get_last_result() will returns reason of failure. + * @see #minicontrol_target_viewer_e + * @see #minicontrol_event_cb */ -minicontrol_error_e minicontrol_win_handler_get(Evas_Object *mincontrol, minicontrol_h *handler); +Evas_Object* minicontrol_create_window(const char *name, minicontrol_target_viewer_e target_viewer, minicontrol_event_cb callback); /** - * @brief This function send request for updating with the updaed minicontrol handler - * @param[in] minicontrol evas object of socket window - * @param[in] handler handler of socket window - * @return evas object of socket window + * @brief Sends a event to the viewer. + * @remarks When a viewer doesn't handle some events, it can be ignored. + * @since_tizen 2.4 + * @privlevel public + * @privilege %http://tizen.org/privilege/minicontrol.provider + * @param[in] minicontrol minicontrol window + * @param[in] event Type of the event + * @param[in] event_arg Bundle argument of the event + * @return #MINICONTROL_ERROR_NONE on success, + * otherwise an error code (see #MINICONTROL_ERROR_XXX) on failure + * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid argument + * @retval #MINICONTROL_ERROR_PERMISSION_DENIED Permission denied + * @see #minicontrol_provider_event_e + * @see #minicontrol_create_window + * @see #minicontrol_request_to_viewer_e */ -minicontrol_error_e minicontrol_win_handler_update(Evas_Object *mincontrol, minicontrol_h handler); +int minicontrol_send_event(Evas_Object *mincontrol, minicontrol_provider_event_e event, bundle *event_arg); /** * @} diff --git a/include/minicontrol-type.h b/include/minicontrol-type.h old mode 100755 new mode 100644 index 019a6b0..8a9de09 --- a/include/minicontrol-type.h +++ b/include/minicontrol-type.h @@ -23,63 +23,116 @@ */ /** - * @addtogroup MINICONTROL_MONITOR_MODULE + * @addtogroup MINICONTROL_LIBRARY * @{ */ -typedef struct _minicontrol_h *minicontrol_h; +#ifndef DEPRECATED +#define DEPRECATED __attribute__((deprecated)) +#endif /* DEPRECATED */ /** - * @brief Enumeration for describing type of events originated by a minicontrol provider. - */ -typedef enum _minicontrol_action { - MINICONTROL_ACTION_START = 0, /**< A minicontrol object is created */ - MINICONTROL_ACTION_STOP, /**< A minicontrol object is deleted */ - MINICONTROL_ACTION_RESIZE, /**< A minicontrol object is resized */ - MINICONTROL_ACTION_REQUEST, /**< the viewer of the minicontrol object is asked to do something */ - MINICONTROL_ACTION_REALIZE, /**< the viewer of the minicontrol object is realized */ -} minicontrol_action_e; +@section MINICONTROL_LIBRARY_EVENTS Events + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event TypeOriginated byArgument 1 KeyArgument 1 TypeArgument 2 KeyArgument 2 TypeArgument 3 KeyArgument 3 Type
MINICONTROL_EVENT_STARTproviderminicontrol_namestringwidthintegerheightinteger
MINICONTROL_EVENT_STOPprovider
MINICONTROL_EVENT_RESIZEproviderminicontrol_namestringwidthintegerheightinteger
MINICONTROL_EVENT_REQUEST_HIDEprovider
MINICONTROL_EVENT_REQUEST_ANGLEprovider
MINICONTROL_EVENT_REPORT_ANGLEvieweranglestring
MINICONTROL_VIEWER_EVENT_SHOWviewer
MINICONTROL_VIEWER_EVENT_HIDEviewer
+*/ /** - * @brief Enumeration for describing priority of a minicontrol provider. + * @brief Enumerations for describing types of events originated by a minicontrol provider. + * @since_tizen 2.4 */ typedef enum { - MINICONTROL_PRIORITY_TOP = 1000, /**< Top priority */ - MINICONTROL_PRIORITY_MIDDLE = 100, /**< Middle priority */ - MINICONTROL_PRIORITY_LOW = 1, /**< Low priority */ -}minicontrol_priority_e; + MINICONTROL_EVENT_START, /**< A minicontrol object is created */ + MINICONTROL_EVENT_STOP, /**< A minicontrol object is deleted */ + MINICONTROL_EVENT_RESIZE, /**< A minicontrol object is resized */ + MINICONTROL_EVENT_REQUEST_HIDE = 100, /**< Requests that the minicontrol viewer(s) close the provider's minicontrol */ + MINICONTROL_EVENT_REQUEST_ANGLE = 103, /**< Requests the current angle of the minicontrol viewer */ + MINICONTROL_EVENT_REPORT_ANGLE = 200, /**< Reports the current angle of the minicontrol viewer */ +} minicontrol_event_e; /** - * @brief Enumeration for describing type of actions. + * @brief Enumerations for types of events which will be sent by minicontrol_send_event. + * @since_tizen 2.4 */ typedef enum { - MINICONTROL_REQ_NONE = 0,/**< Request to viewer */ - - /*! - * request to viewer - */ - MINICONTROL_REQ_HIDE_VIEWER = 100, /**< Request to hide the minicontrol viewer */ - MINICONTROL_REQ_FREEZE_SCROLL_VIEWER, /**< Request to freeze scroll of the minicontrol viewer */ - MINICONTROL_REQ_UNFREEZE_SCROLL_VIEWER, /**< Request to unfreeze scroll of the minicontrol viewer */ - MINICONTROL_REQ_REPORT_VIEWER_ANGLE, /**< Request to report the current angle of the minicontrol viewer */ - MINICONTROL_REQ_UPDATE_HANDLER, - - /*! - * request to provider - */ - MINICONTROL_REQ_ROTATE_PROVIDER = 200, /**< Request to provider */ - MINICONTROL_REQ_PROVIDER_PAUSE = 201, - MINICONTROL_REQ_PROVIDER_RESUME = 202, -}minicontrol_request_e; + MINICONTROL_PROVIDER_EVENT_REQUEST_HIDE = MINICONTROL_EVENT_REQUEST_HIDE, /**< Requests that the minicontrol viewer(s) close the provider's minicontrol. Required bundle argument : NULL. */ + MINICONTROL_PROVIDER_EVENT_REQUEST_ANGLE = MINICONTROL_EVENT_REQUEST_ANGLE, /**< Requests the current angle of the minicontrol viewer. Required bundle argument : NULL. */ +} minicontrol_provider_event_e; /** - * @brief Enumeration for describing type of dbus. + * @brief Enumerations for types of events which will be sent by minicontrol_viewer_send_event. + * @since_tizen 2.4 */ +typedef enum { + MINICONTROL_VIEWER_EVENT_REPORT_ANGLE = MINICONTROL_EVENT_REPORT_ANGLE, /**< Reports the current angle of the minicontrol viewer. Required argument : Angle of minicontrol viewer, Bundle Key : "angle", Bundle Value Type : string.*/ + MINICONTROL_VIEWER_EVENT_SHOW = 201, /**< The minicontrol viewer is shown. Required argument : NULL.*/ + MINICONTROL_VIEWER_EVENT_HIDE = 202, /**< The minicontrol viewer is hidden. Required argument : NULL.*/ +} minicontrol_viewer_event_e; -enum _minictrl_PROC_DBUS_TYPE { - MINICONTROL_DBUS_PROC_EXCLUDE, /**< Request to exclude from the unfreezing process list */ - MINICONTROL_DBUS_PROC_INCLUDE, /**< Request to include to the unfreezing process list */ -}; +/** + * @brief Enumerations for selecting target viewers. + * @since_tizen 2.4 + */ +typedef enum { + MINICONTROL_TARGET_VIEWER_QUICK_PANEL = 0x0001, /**< Request to place the minicontrol on the quickpanel */ + MINICONTROL_TARGET_VIEWER_STOCK_LOCK_SCREEN = 0x0002, /**< Request to place the minicontrol on the stock lock screen */ + MINICONTROL_TARGET_VIEWER_CUSTOM_LOCK_SCREEN = 0x0004, /**< Request to place the minicontrol on a lock screen replacement application */ +} minicontrol_target_viewer_e; /** * @} diff --git a/include/minicontrol-viewer-internal.h b/include/minicontrol-viewer-internal.h new file mode 100644 index 0000000..2d93f7e --- /dev/null +++ b/include/minicontrol-viewer-internal.h @@ -0,0 +1,15 @@ +/* + * minicontrol-viewer-internal.h + * + * Created on: 2015. 4. 13. + * Author: kyuho.jo + */ + +#ifndef _MINICONTROL_VIEWER_INTERNAL_H_ +#define _MINICONTROL_VIEWER_INTERNAL_H_ + +int minicontrol_viewer_request(const char *appid, minicontrol_request_e request, int value) DEPRECATED; + +Evas_Object *minicontrol_viewer_image_object_get(const Evas_Object *obj) DEPRECATED; + +#endif /* _MINICONTROL_VIEWER_INTERNAL_H_ */ diff --git a/include/minicontrol-viewer.h b/include/minicontrol-viewer.h old mode 100755 new mode 100644 index 755b992..67e87a3 --- a/include/minicontrol-viewer.h +++ b/include/minicontrol-viewer.h @@ -18,6 +18,7 @@ #define _MINICTRL_VIEWER_H_ #include +#include #include "minicontrol-error.h" #include "minicontrol-type.h" @@ -27,7 +28,9 @@ extern "C" { /** * @file minicontrol-viewer.h - * @brief This minicontrol viewer library used to display minicontrol which created by minicontrol provider. + * @brief This minicontrol viewer library used to display minicontrol which created by the minicontrol provider.\n + * This library is providing functions for attach a minicontrol viewer to a parent evas object and sending some requests to a minicontrol provider.\n + * The minicontrol viewer places a space which will be used by the minicontrol provider to draw minicontrol. */ /** @@ -36,27 +39,60 @@ extern "C" { */ /** - * @brief Adds minicontrol named as "svr_name" to a given parent evas object and returns it. + * @brief Adds minicontrol named as "minicontrol_name" to a given parent evas object and returns it. + * @since_tizen 2.4 * @param[in] parent Minicontrol object will be added to this parent evas object - * @param[in] svr_name Name of minicontrol - * @return Evas object of minicontrol + * @param[in] minicontrol_name Name of minicontrol + * @return Evas object of minicontrol. @c NULL failed to add, get_last_result() will returns reason of failure. */ -Evas_Object *minicontrol_viewer_add(Evas_Object *parent, const char *svr_name); +Evas_Object *minicontrol_viewer_add(Evas_Object *parent, const char *minicontrol_name); /** - * @brief Gets the basic evas image object from given minicontrol object. - * @param[in] obj Minicontrol object - * @return Basic evas image object of minicontrol object + * @brief Sends a event to the provider. + * @since_tizen 2.4 + * @param[in] minicontrol_name The name of the minicontrol window + * @param[in] event Type of the event + * @param[in] event_arg A bundle of arguments + * @return #MINICONTROL_ERROR_NONE on success, + * otherwise an error code (see #MINICONTROL_ERROR_XXX) on failure + * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid argument + * @see #minicontrol_viewer_event_e */ -Evas_Object *minicontrol_viewer_image_object_get(const Evas_Object *obj); +int minicontrol_viewer_send_event(const char *minicontrol_name, minicontrol_viewer_event_e event, bundle *event_arg); /** - * @brief Requests various actions to the provider. - * @param[in] minicontrol Evas object of socket window - * @param[in] action Type of action - * @return Evas object of socket window + * @brief Called when a event comes from the provider + * @since_tizen 2.4 + * @param[in] event The type of fired event + * @param[in] minicontrol_name The name of the minicontrol window + * @param[in] event_arg A bundle of arguments + * @param[in] data User data + * @see #minicontrol_viewer_set_event_cb */ -minicontrol_error_e minicontrol_viewer_request(const char *appid, minicontrol_request_e request, int value); +typedef void (*minicontrol_viewer_event_cb) (minicontrol_event_e event, const char *minicontrol_name, bundle *event_arg, void *data); + +/** + * @brief Registers a callback for events originated by minicontrol provider. + * @since_tizen 2.4 + * @param[in] callback Callback function + * @param[in] user_data User data + * @return #MINICONTROL_ERROR_NONE on success, + * otherwise an error code (see #MINICONTROL_ERROR_XXX) on failure + * @retval #MINICONTROL_ERROR_INVALID_PARAMETER Invalid argument + * @retval #MINICONTROL_ERROR_IPC_FAILURE IPC failure + * @retval #MINICONTROL_ERROR_OUT_OF_MEMORY out of memory + * @see #minicontrol_viewer_unset_event_cb + * @see #minicontrol_viewer_event_cb + */ +int minicontrol_viewer_set_event_cb(minicontrol_viewer_event_cb callback, void *user_data); + +/** + * @brief Unregisters a callback for events originated by minicontrol provider. + * @since_tizen 2.4 + * @return #MINICONTROL_ERROR_NONE if success, other value if failure + * @see #minicontrol_viewer_set_event_cb + */ +int minicontrol_viewer_unset_event_cb(void); /** * @} diff --git a/include/minicontrol.h b/include/minicontrol.h old mode 100755 new mode 100644 index 4eb3d41..c626c20 --- a/include/minicontrol.h +++ b/include/minicontrol.h @@ -17,8 +17,11 @@ #ifndef _MINICONTROL_H_DEF_ #define _MINICONTROL_H_DEF_ +#include #include +#include #include -#include +#include + #endif /* _MINICONTROL_H_DEF_ */ diff --git a/minicontrol-handler.pc.in b/minicontrol-handler.pc.in old mode 100755 new mode 100644 diff --git a/minicontrol-monitor.pc.in b/minicontrol-monitor.pc.in old mode 100755 new mode 100644 diff --git a/packaging/minicontrol.spec b/packaging/minicontrol.spec old mode 100755 new mode 100644 index dfbd7a0..b3061a0 --- a/packaging/minicontrol.spec +++ b/packaging/minicontrol.spec @@ -1,9 +1,9 @@ Name: minicontrol Summary: minicontrol library -Version: 0.0.16 +Version: 0.1.2 Release: 1 Group: TBD -License: Apache +License: Apache-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-glib-1) @@ -40,6 +40,7 @@ export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" %endif +export CFLAGS+=" -fPIC " export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--as-needed" LDFLAGS="$LDFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} make %{?jobs:-j%jobs} @@ -62,7 +63,6 @@ cp -f LICENSE %{buildroot}/usr/share/license/%{name} %{_libdir}/libminicontrol-provider.so* %{_libdir}/libminicontrol-viewer.so* %{_libdir}/libminicontrol-monitor.so* -%{_libdir}/libminicontrol-handler.so* /usr/share/license/%{name} %files devel @@ -71,5 +71,4 @@ cp -f LICENSE %{buildroot}/usr/share/license/%{name} %{_libdir}/pkgconfig/minicontrol-provider.pc %{_libdir}/pkgconfig/minicontrol-monitor.pc %{_libdir}/pkgconfig/minicontrol-viewer.pc -%{_libdir}/pkgconfig/minicontrol-handler.pc diff --git a/src/minicontrol-handler.c b/src/minicontrol-handler.c deleted file mode 100755 index a20dfb0..0000000 --- a/src/minicontrol-handler.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2013-2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include - -#include "minicontrol-error.h" -#include "minicontrol-internal.h" -#include "minicontrol-monitor.h" -#include "minicontrol-log.h" -#include "minicontrol-handler.h" - -/*! - * handler APIs - */ -EXPORT_API minicontrol_error_e minicontrol_handler_create(minicontrol_h *handler) -{ - return _minictrl_handler_create(handler); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_destroy(minicontrol_h handler) -{ - return _minictrl_handler_destroy(handler); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_clone(minicontrol_h handler, minicontrol_h *handler_new) -{ - return _minictrl_handler_clone(handler, handler_new); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_set_service_name(minicontrol_h handler, const char *name) -{ - return _minictrl_handler_set_service_name(handler, name); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_get_service_name(minicontrol_h handler, char **name) -{ - return _minictrl_handler_get_service_name(handler, name); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_set_category(minicontrol_h handler, const char *category) -{ - return _minictrl_handler_set_category(handler, category); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_get_category(minicontrol_h handler, char **category) -{ - return _minictrl_handler_get_category(handler, category); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_set_operation(minicontrol_h handler, const char *operation) -{ - return _minictrl_handler_set_operation(handler, operation); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_get_operation(minicontrol_h handler, char **operation) -{ - return _minictrl_handler_get_operation(handler, operation); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_set_priority(minicontrol_h handler, const char *priority) -{ - return _minictrl_handler_set_priority(handler, priority); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_get_priority(minicontrol_h handler, char **priority) -{ - return _minictrl_handler_get_priority(handler, priority); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_set_timestamp(minicontrol_h handler, time_t timestamp) -{ - return _minictrl_handler_set_timestamp(handler, timestamp); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_get_timestamp(minicontrol_h handler, time_t *timestamp) -{ - return _minictrl_handler_get_timestamp(handler, timestamp); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_get_pid(minicontrol_h handler, int *pid) -{ - return _minictrl_handler_get_pid(handler, pid); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_get_state(minicontrol_h handler, int *state) -{ - return _minictrl_handler_get_state(handler, state); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_add_extradata(minicontrol_h handler, const char *key, const char *value) -{ - return _minictrl_handler_add_extradata(handler, key, value); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_remove_extradata(minicontrol_h handler, const char *key) -{ - return _minictrl_handler_remove_extradata(handler, key); -} - -EXPORT_API minicontrol_error_e minicontrol_handler_get_extradata(minicontrol_h handler, const char *key, char **value) -{ - return _minictrl_handler_get_extradata(handler, key, value); -} diff --git a/src/minicontrol-internal-handler.c b/src/minicontrol-internal-handler.c deleted file mode 100755 index 2977da6..0000000 --- a/src/minicontrol-internal-handler.c +++ /dev/null @@ -1,506 +0,0 @@ -/* - * Copyright (c) 2013-2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include - -#include "minicontrol-error.h" -#include "minicontrol-type.h" -#include "minicontrol-internal.h" -#include "minicontrol-monitor.h" -#include "minicontrol-log.h" -#include "minicontrol-handler.h" - -#define BUNDLE_KEY_PID "__KEY_PID__" -#define BUNDLE_KEY_STATE "__KEY_STATE__" -#define BUNDLE_KEY_SERVICE_NAME "__KEY_SERVICE_NAME__" -#define BUNDLE_KEY_CATEGORY "__KEY_CATEGORY__" -#define BUNDLE_KEY_OPERATION "__KEY_OPERATION__" -#define BUNDLE_KEY_PRIORITY "__KEY_PRIORITY__" -#define BUNDLE_KEY_TIMESTAMP "__KEY_TIMESTAMP__" - -/*! - * bundle utility - */ -static int _bundle_set_byte(bundle *b, const char *key, void *value, int length) -{ - int ret = 0; - size_t ret_size = 0; - void *ret_byte = NULL; - - ret = bundle_get_byte(b, key, &ret_byte, &ret_size); - if (ret == 0 && ret_byte != NULL) { - if(bundle_del(b, key) != 0) { - ERR("Failed to del a previous value(key):%s", key); - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - } - - if (value == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if (bundle_add_byte(b, key, value, length) != 0) { - ERR("Failed to set a new value(key):%s", key); - return MINICONTROL_ERROR_BUNDLE; - } - - return MINICONTROL_ERROR_NONE; -} - -static int _bundle_set_str(bundle *b, const char *key, const char *value) -{ - const char *val = NULL; - - val = bundle_get_val(b, key); - if(val != NULL){ - if(bundle_del(b, key) != 0) { - ERR("Failed to del a previous value(key):%s", key); - return MINICONTROL_ERROR_BUNDLE; - } - } - - if(value == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if(bundle_add(b, key, value) != 0){ - ERR("Failed to set a new value(key):%s", key); - return MINICONTROL_ERROR_BUNDLE; - } - - return MINICONTROL_ERROR_NONE; -} - -/*! - * handler utility - */ -static int _handler_validation_check(minicontrol_h handler) { - if (handler != NULL) { - if (handler->data != NULL) { - return MINICONTROL_ERROR_NONE; - } - } - return MINICONTROL_ERROR_INVALID_PARAMETER; -} - -static int _handler_extradata_key_validation_check(const char *key) { - if (key != NULL) { - if (strcmp(key, BUNDLE_KEY_PID) == 0) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - - } else if (strcmp(key, BUNDLE_KEY_SERVICE_NAME) == 0) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - - } else if (strcmp(key, BUNDLE_KEY_SERVICE_NAME) == 0) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - - } else if (strcmp(key, BUNDLE_KEY_OPERATION) == 0) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - - } else if (strcmp(key, BUNDLE_KEY_PRIORITY) == 0) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - - } else if (strcmp(key, BUNDLE_KEY_TIMESTAMP) == 0) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - return MINICONTROL_ERROR_INVALID_PARAMETER; -} - -/*! - * handler bundle utility - */ -static minicontrol_error_e __set_str_to_handler(minicontrol_h handler, const char *key, const char *value) -{ - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE - || key == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if (value != NULL) { - return _bundle_set_str(handler->data, key, value); - } else { - bundle_del(handler->data, key); - } - - return MINICONTROL_ERROR_NONE; -} - -static minicontrol_error_e __get_str_from_handler(minicontrol_h handler, const char *key, char **value) -{ - const char *data_value; - - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE - || key == NULL - || value == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER;; - } - - data_value = bundle_get_val(handler->data, key); - if (data_value == NULL) { - if (errno == ENOTSUP) { - return MINICONTROL_ERROR_BUNDLE; - } else { - return MINICONTROL_ERROR_NO_DATA; - } - } - - *value = strdup(data_value); - - return MINICONTROL_ERROR_NONE; -} - -/*! - * handler APIs - */ -minicontrol_error_e _minictrl_handler_create(minicontrol_h *handler) -{ - minicontrol_h handler_new = NULL; - if (handler == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - handler_new = calloc(1, sizeof(struct _minicontrol_h)); - if (handler_new == NULL) { - ERR("Failed to create a handler"); - return MINICONTROL_ERROR_OUT_OF_MEMORY; - } - - handler_new->data = bundle_create(); - if (handler_new->data == NULL) - { - free(handler_new); - ERR("Failed to create a bundle"); - return MINICONTROL_ERROR_OUT_OF_MEMORY; - } - - if (_minictrl_handler_set_pid(handler_new) != MINICONTROL_ERROR_NONE) { - ERR("Failed to set PID to handler"); - } - if (_minictrl_handler_set_state(handler_new, 0) != MINICONTROL_ERROR_NONE) { - ERR("Failed to set state to handler"); - } - if (_minictrl_handler_set_category(handler_new, MINICONTROL_HDL_CATEGORY_UNKNOWN) != MINICONTROL_ERROR_NONE) { - ERR("Failed to set category to handler"); - } - - *handler = handler_new; - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_destroy(minicontrol_h handler) -{ - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - bundle_free(handler->data); - handler->data = NULL; - free(handler); - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_clone(minicontrol_h handler, minicontrol_h *handler_new) -{ - int ret = 0; - - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE || handler_new == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if ((ret = _minictrl_handler_create(handler_new)) == MINICONTROL_ERROR_NONE) { - (*handler_new)->data = bundle_dup(handler->data); - if ((*handler_new)->data == NULL) { - _minictrl_handler_destroy(*handler_new); - return MINICONTROL_ERROR_OUT_OF_MEMORY; - } - } else { - return ret; - } - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_check_validation(minicontrol_h handler) -{ - return _handler_validation_check(handler); -} - -minicontrol_error_e _minictrl_handler_set_service_name(minicontrol_h handler, const char *name) -{ - return __set_str_to_handler(handler, BUNDLE_KEY_SERVICE_NAME, name); -} - -minicontrol_error_e _minictrl_handler_get_service_name(minicontrol_h handler, char **name) -{ - return __get_str_from_handler(handler, BUNDLE_KEY_SERVICE_NAME, name); -} - -minicontrol_error_e _minictrl_handler_set_category(minicontrol_h handler, const char *category) -{ - return __set_str_to_handler(handler, BUNDLE_KEY_CATEGORY, category); -} - -minicontrol_error_e _minictrl_handler_get_category(minicontrol_h handler, char **category) -{ - return __get_str_from_handler(handler, BUNDLE_KEY_CATEGORY, category); -} - -minicontrol_error_e _minictrl_handler_set_operation(minicontrol_h handler, const char *operation) -{ - return __set_str_to_handler(handler, BUNDLE_KEY_OPERATION, operation); -} - -minicontrol_error_e _minictrl_handler_get_operation(minicontrol_h handler, char **operation) -{ - return __get_str_from_handler(handler, BUNDLE_KEY_OPERATION, operation); -} - -minicontrol_error_e _minictrl_handler_set_priority(minicontrol_h handler, const char *priority) -{ - return __set_str_to_handler(handler, BUNDLE_KEY_PRIORITY, priority); -} - -minicontrol_error_e _minictrl_handler_get_priority(minicontrol_h handler, char **priority) -{ - return __get_str_from_handler(handler, BUNDLE_KEY_PRIORITY, priority); -} - -minicontrol_error_e _minictrl_handler_set_timestamp(minicontrol_h handler, time_t timestamp) -{ - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if (timestamp > 0) { - return _bundle_set_byte(handler->data, BUNDLE_KEY_TIMESTAMP, (void *)×tamp, sizeof(time_t)); - } else { - bundle_del(handler->data, BUNDLE_KEY_TIMESTAMP); - } - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_get_timestamp(minicontrol_h handler, time_t *timestamp) -{ - int ret = 0; - size_t ret_size = 0; - void *ret_value = NULL; - - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE || timestamp == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - ret = bundle_get_byte(handler->data, BUNDLE_KEY_TIMESTAMP, &ret_value, &ret_size); - if (ret == 0 && ret_value != NULL && ret_size == sizeof(time_t)) { - *timestamp = *((time_t *)ret_value); - } else { - *timestamp = 0; - } - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_set_pid(minicontrol_h handler) -{ - int pid = 0; - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - pid = getpid(); - if (pid > 0) { - return _bundle_set_byte(handler->data, BUNDLE_KEY_PID, (void *)&pid, sizeof(int)); - } else { - bundle_del(handler->data, BUNDLE_KEY_PID); - } - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_get_pid(minicontrol_h handler, int *pid) -{ - int ret = 0; - size_t ret_size = 0; - void *ret_value = NULL; - - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE || pid == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - ret = bundle_get_byte(handler->data, BUNDLE_KEY_PID, &ret_value, &ret_size); - if (ret == 0 && ret_value != NULL && ret_size == sizeof(int)) { - *pid = *((int *)ret_value); - } else { - *pid = 0; - } - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_set_state(minicontrol_h handler, int state) -{ - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if (state >= 0) { - return _bundle_set_byte(handler->data, BUNDLE_KEY_STATE, (void *)&state, sizeof(int)); - } else { - bundle_del(handler->data, BUNDLE_KEY_STATE); - } - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_get_state(minicontrol_h handler, int *state) -{ - int ret = 0; - size_t ret_size = 0; - void *ret_value = NULL; - - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE || state == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - ret = bundle_get_byte(handler->data, BUNDLE_KEY_STATE, &ret_value, &ret_size); - if (ret == 0 && ret_value != NULL && ret_size == sizeof(int)) { - *state = *((int *)ret_value); - } else { - *state = 0; - } - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_add_extradata(minicontrol_h handler, const char *key, const char *value) -{ - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE - || _handler_extradata_key_validation_check(key) != MINICONTROL_ERROR_NONE - || value == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER;; - } - - return _bundle_set_str(handler->data, key, value); -} - -minicontrol_error_e _minictrl_handler_remove_extradata(minicontrol_h handler, const char *key) -{ - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE - || _handler_extradata_key_validation_check(key) != MINICONTROL_ERROR_NONE) { - return MINICONTROL_ERROR_INVALID_PARAMETER;; - } - - if (bundle_del(handler->data, key)) { - return MINICONTROL_ERROR_NO_DATA; - } - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_get_extradata(minicontrol_h handler, const char *key, char **value) -{ - const char *data_value; - - if (_handler_validation_check(handler) != MINICONTROL_ERROR_NONE - || _handler_extradata_key_validation_check(key) != MINICONTROL_ERROR_NONE - || value == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER;; - } - - data_value = bundle_get_val(handler->data, key); - if (data_value == NULL) { - if (errno == ENOTSUP) { - return MINICONTROL_ERROR_BUNDLE; - } else { - return MINICONTROL_ERROR_NO_DATA; - } - } - - *value = strdup(data_value); - - return MINICONTROL_ERROR_NONE; -} - -minicontrol_error_e _minictrl_handler_get_raw_data(minicontrol_h handler, char **raw_data, int *length) -{ - if (handler == NULL || raw_data == NULL || length == NULL) { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if (handler->data != NULL) { - bundle_encode(handler->data, - (bundle_raw **) raw_data, length); - } else { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - return MINICONTROL_ERROR_NONE; -} - -static void iterate_bundleforeach(const char *key,const int type, bundle_keyval_t *kv, void *data) -{ - switch(type) - { - case BUNDLE_TYPE_STR: - { - size_t size; - char *basic_val = NULL; - - bundle_keyval_get_basic_val(kv,(void *)&basic_val,&size); - ERR("Key: %s ---- Val: %s\n",key,basic_val); - - break; - } - case BUNDLE_TYPE_BYTE: - { - size_t size; - char *basic_val = NULL; - - bundle_keyval_get_basic_val(kv,(void *)&basic_val,&size); - ERR("Key: %s ---- Val: %d\n",key, *((int *)basic_val)); - - break; - } - default: - { - DBG("\n no match found"); - DBG("Key: %s is of type %d\n",key, type); - break; - } - } -} - -minicontrol_error_e _minictrl_handler_get_handler_from_raw_data(minicontrol_h *handler, char *raw_data, int length) -{ - if (_minictrl_handler_create(handler) == MINICONTROL_ERROR_NONE) { - (*handler)->data = bundle_decode((bundle_raw *)raw_data, length); - bundle_foreach((*handler)->data,(void *)iterate_bundleforeach,NULL); - } else { - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - return MINICONTROL_ERROR_NONE; -} diff --git a/src/minicontrol-internal.c b/src/minicontrol-internal.c old mode 100755 new mode 100644 index 9b0d1a6..25ceb4a --- a/src/minicontrol-internal.c +++ b/src/minicontrol-internal.c @@ -15,15 +15,14 @@ */ #include -#include #include #include +#include #include "minicontrol-error.h" #include "minicontrol-type.h" #include "minicontrol-internal.h" #include "minicontrol-log.h" -#include "minicontrol-handler.h" #define MINICTRL_DBUS_PATH "/org/tizen/minicontrol" #define MINICTRL_DBUS_INTERFACE "org.tizen.minicontrol.signal" @@ -53,7 +52,7 @@ int _minictrl_viewer_req_message_send(void) connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err); if (!connection) { ERR("Fail to dbus_bus_get : %s", err.message); - ret = MINICONTROL_ERROR_DBUS; + ret = MINICONTROL_ERROR_IPC_FAILURE; goto release_n_return; } @@ -69,7 +68,7 @@ int _minictrl_viewer_req_message_send(void) dbus_ret = dbus_connection_send(connection, message, NULL); if (!dbus_ret) { ERR("fail to send dbus viewer req message"); - ret = MINICONTROL_ERROR_DBUS; + ret = MINICONTROL_ERROR_IPC_FAILURE; goto release_n_return; } @@ -109,7 +108,7 @@ int _minictrl_provider_proc_send(int type) conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); if (!conn) { ERR("Fail to dbus_bus_get : %s", err.message); - ret = MINICONTROL_ERROR_DBUS; + ret = MINICONTROL_ERROR_IPC_FAILURE; goto release_n_return; } msg = dbus_message_new_signal(PROC_DBUS_OBJECT, // object name of the signal @@ -139,44 +138,30 @@ release_n_return: } -int _minictrl_provider_message_send(const char *sig_name, const char *svr_name, - unsigned int witdh, unsigned int height, - minicontrol_priority_e priority, - minicontrol_h handler) +int _minictrl_send_event(const char *signal_name, const char *minicontrol_name, int event, bundle *signal_arg) { DBusConnection *connection = NULL; DBusMessage *message = NULL; DBusError err; dbus_bool_t dbus_ret; + bundle_raw *serialized_arg = NULL; + unsigned int serialized_arg_length = 0; int ret = MINICONTROL_ERROR_NONE; - int handler_raw_data_len = 0; - char *handler_raw_data = NULL; - if (!sig_name) { - ERR("sig_name is NULL, invaild parameter"); + if (minicontrol_name == NULL) { + ERR("Invaild parameter"); return MINICONTROL_ERROR_INVALID_PARAMETER; } - if (!svr_name) { - ERR("svr_name is NULL, invaild parameter"); - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if (handler != NULL) { - _minictrl_handler_get_raw_data(handler, &handler_raw_data, &handler_raw_data_len); - } - dbus_error_init(&err); connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err); if (!connection) { ERR("Fail to dbus_bus_get : %s", err.message); - ret = MINICONTROL_ERROR_DBUS; + ret = MINICONTROL_ERROR_IPC_FAILURE; goto release_n_return; } - message = dbus_message_new_signal(MINICTRL_DBUS_PATH, - MINICTRL_DBUS_INTERFACE, - sig_name); + message = dbus_message_new_signal(MINICTRL_DBUS_PATH, MINICTRL_DBUS_INTERFACE, signal_name); if (!message) { ERR("fail to create dbus message"); @@ -184,34 +169,36 @@ int _minictrl_provider_message_send(const char *sig_name, const char *svr_name, goto release_n_return; } - - if (handler_raw_data != NULL && handler_raw_data_len > 0) { - dbus_ret = dbus_message_append_args(message, - DBUS_TYPE_STRING, &svr_name, - DBUS_TYPE_UINT32, &witdh, - DBUS_TYPE_UINT32, &height, - DBUS_TYPE_UINT32, &priority, - DBUS_TYPE_STRING, &handler_raw_data, - DBUS_TYPE_UINT32, &handler_raw_data_len, - DBUS_TYPE_INVALID); - } else { - dbus_ret = dbus_message_append_args(message, - DBUS_TYPE_STRING, &svr_name, - DBUS_TYPE_UINT32, &witdh, - DBUS_TYPE_UINT32, &height, - DBUS_TYPE_UINT32, &priority, - DBUS_TYPE_INVALID); + if (signal_arg != NULL) { + if (bundle_encode(signal_arg, &serialized_arg, (int*)&serialized_arg_length) != BUNDLE_ERROR_NONE) { + ERR("fail to serialize bundle argument"); + ret = MINICONTROL_ERROR_OUT_OF_MEMORY; + goto release_n_return; + } } + else { + serialized_arg = (bundle_raw*)strdup(""); + serialized_arg_length = 0; + } + + dbus_ret = dbus_message_append_args(message, + DBUS_TYPE_STRING, &minicontrol_name, + DBUS_TYPE_INT32, &event, + DBUS_TYPE_STRING, &serialized_arg, + DBUS_TYPE_UINT32, &serialized_arg_length, + DBUS_TYPE_INVALID); + if (!dbus_ret) { - ERR("fail to append name to dbus message : %s", svr_name); + ERR("fail to append arguments to dbus message : [%s][%d]", minicontrol_name, event); ret = MINICONTROL_ERROR_OUT_OF_MEMORY; goto release_n_return; } dbus_ret = dbus_connection_send(connection, message, NULL); + if (!dbus_ret) { - ERR("fail to send dbus message : %s", svr_name); - ret = MINICONTROL_ERROR_DBUS; + ERR("fail to send dbus message : %s", minicontrol_name); + ret = MINICONTROL_ERROR_IPC_FAILURE; goto release_n_return; } @@ -220,6 +207,9 @@ int _minictrl_provider_message_send(const char *sig_name, const char *svr_name, release_n_return: dbus_error_free(&err); + if (serialized_arg) + free(serialized_arg); + if (message) dbus_message_unref(message); @@ -229,8 +219,38 @@ release_n_return: return ret; } -static DBusHandlerResult _minictrl_signal_filter(DBusConnection *conn, - DBusMessage *msg, void *user_data) + +int _minictrl_provider_message_send(int event, const char *minicontrol_name, unsigned int witdh, unsigned int height, minicontrol_priority_e priority) +{ + bundle *event_arg_bundle = NULL; + int ret = MINICONTROL_ERROR_NONE; + char bundle_value_buffer[BUNDLE_BUFFER_LENGTH] = { 0, }; + + event_arg_bundle = bundle_create(); + + if (event_arg_bundle == NULL) { + ERR("fail to create a bundle instance"); + ret = MINICONTROL_ERROR_OUT_OF_MEMORY; + goto out; + } + + snprintf(bundle_value_buffer, BUNDLE_BUFFER_LENGTH, "%s", minicontrol_name); + + bundle_add_str(event_arg_bundle, "minicontrol_name", bundle_value_buffer); + bundle_add_byte(event_arg_bundle, "width", (void*)&witdh, sizeof(int)); + bundle_add_byte(event_arg_bundle, "height", (void*)&height, sizeof(int)); + bundle_add_byte(event_arg_bundle, "priority", (void*)&priority, sizeof(int)); + + _minictrl_send_event(MINICTRL_DBUS_SIG_TO_VIEWER, minicontrol_name, event, event_arg_bundle); + +out: + if (event_arg_bundle) + bundle_free(event_arg_bundle); + + return ret; +} + +static DBusHandlerResult _minictrl_signal_filter(DBusConnection *conn, DBusMessage *msg, void *user_data) { minictrl_sig_handle *handle = NULL; const char *interface; @@ -353,8 +373,7 @@ void _minictrl_dbus_sig_handle_dettach(minictrl_sig_handle *handle) dbus_error_init(&err); - dbus_connection_remove_filter(handle->conn, - _minictrl_signal_filter, handle); + dbus_connection_remove_filter(handle->conn, _minictrl_signal_filter, handle); snprintf(rule, 1024, "path='%s',type='signal',interface='%s',member='%s'", diff --git a/src/minicontrol-monitor.c b/src/minicontrol-monitor.c old mode 100755 new mode 100644 index 50f9609..2f94835 --- a/src/minicontrol-monitor.c +++ b/src/minicontrol-monitor.c @@ -20,20 +20,16 @@ #include "minicontrol-error.h" #include "minicontrol-internal.h" #include "minicontrol-monitor.h" +#include "minicontrol-viewer.h" #include "minicontrol-log.h" struct _minicontrol_monitor { - minictrl_sig_handle *start_sh; - minictrl_sig_handle *realize_sh; - minictrl_sig_handle *stop_sh; - minictrl_sig_handle *resize_sh; - minictrl_sig_handle *request_sh; + minictrl_sig_handle *event_sh; minicontrol_monitor_cb callback; - minicontrol_monitor_with_handler_cb callback_with_handler; void *user_data; }; -static struct _minicontrol_monitor *g_monitor_h; +static struct _minicontrol_monitor *g_monitor_h = NULL; static minicontrol_priority_e _int_to_priority(unsigned int value) { @@ -53,384 +49,74 @@ static minicontrol_priority_e _int_to_priority(unsigned int value) return priority; } -static int _provider_get_data_from_dbus_message( - DBusMessage *msg, char **name, - unsigned int *w, unsigned int *h, unsigned int *pri, - minicontrol_h *handler) +static void _sig_to_viewer_handler_cb(minicontrol_event_e event, const char *minicontrol_name, bundle *event_arg, void *data) { + minicontrol_action_e action; + int width = 0; + int height = 0; + int priority_from_signal = 0; + minicontrol_priority_e priority = 0; + size_t n_size; + + switch(event) { + case MINICONTROL_EVENT_START: + action = MINICONTROL_ACTION_START; + break; - DBusError err; - dbus_bool_t dbus_ret; - char *raw_data = NULL; - int raw_data_len = 0; - - if (msg != NULL && name != NULL && - w != NULL && h != NULL && pri != NULL && - handler != NULL) { - dbus_error_init(&err); - dbus_ret = dbus_message_get_args(msg, &err, - DBUS_TYPE_STRING, name, - DBUS_TYPE_UINT32, w, - DBUS_TYPE_UINT32, h, - DBUS_TYPE_UINT32, pri, - DBUS_TYPE_STRING, &raw_data, - DBUS_TYPE_UINT32, &raw_data_len, - DBUS_TYPE_INVALID); - if (!dbus_ret) { - ERR("fail to get args : %s", err.message); - if (*name == NULL) { - ERR("Failed to get a service name, give up"); - dbus_error_free(&err); - return MINICONTROL_ERROR_DBUS; - } - } - - if (raw_data != NULL && raw_data_len > 0) { - _minictrl_handler_get_handler_from_raw_data(handler, raw_data, raw_data_len); - } else { - ERR("failed to get handler from DBUS message"); - } - dbus_error_free(&err); - } - - return MINICONTROL_ERROR_NONE; -} - -static void _provider_start_cb(void *data, DBusMessage *msg) -{ - char *svr_name = NULL; - unsigned int w = 0; - unsigned int h = 0; - unsigned int pri = 0; - minicontrol_h handler = NULL; - minicontrol_priority_e priority; - - if (_provider_get_data_from_dbus_message(msg, &svr_name, &w, &h, &pri, &handler) != MINICONTROL_ERROR_NONE) { - ERR("fail to data from DBUS message"); - return ; - } - - priority = _int_to_priority(pri); - - if (g_monitor_h->callback) { - g_monitor_h->callback(MINICONTROL_ACTION_START, - svr_name, w, h, priority, - g_monitor_h->user_data); - } - if (g_monitor_h->callback_with_handler) { - g_monitor_h->callback_with_handler(MINICONTROL_ACTION_START, - svr_name, w, h, priority, - handler, - g_monitor_h->user_data); - } - - if (handler != NULL) { - _minictrl_handler_destroy(handler); - } -} - -static void _provider_realized_cb(void *data, DBusMessage *msg) -{ - char *svr_name = NULL; - unsigned int w = 0; - unsigned int h = 0; - unsigned int pri = 0; - minicontrol_h handler = NULL; - minicontrol_priority_e priority; - - if (_provider_get_data_from_dbus_message(msg, &svr_name, &w, &h, &pri, &handler) != MINICONTROL_ERROR_NONE) { - ERR("fail to data from DBUS message"); - return ; - } - - priority = _int_to_priority(pri); - - if (g_monitor_h->callback) { - g_monitor_h->callback(MINICONTROL_ACTION_REALIZE, - svr_name, w, h, priority, - g_monitor_h->user_data); - } - if (g_monitor_h->callback_with_handler) { - g_monitor_h->callback_with_handler(MINICONTROL_ACTION_REALIZE, - svr_name, w, h, priority, - handler, - g_monitor_h->user_data); - } - - if (handler != NULL) { - _minictrl_handler_destroy(handler); - } -} - -static void _provider_stop_cb(void *data, DBusMessage *msg) -{ - char *svr_name = NULL; - unsigned int w = 0; - unsigned int h = 0; - unsigned int pri = 0; - minicontrol_h handler = NULL; - minicontrol_priority_e priority; - - if (_provider_get_data_from_dbus_message(msg, &svr_name, &w, &h, &pri, &handler) != MINICONTROL_ERROR_NONE) { - ERR("fail to data from DBUS message"); - return ; - } - - priority = _int_to_priority(pri); - - if (g_monitor_h->callback) { - g_monitor_h->callback(MINICONTROL_ACTION_STOP, - svr_name, w, h, priority, - g_monitor_h->user_data); - } - if (g_monitor_h->callback_with_handler) { - g_monitor_h->callback_with_handler(MINICONTROL_ACTION_STOP, - svr_name, w, h, priority, - handler, - g_monitor_h->user_data); - } - - if (handler != NULL) { - _minictrl_handler_destroy(handler); - } -} - -static void _provider_resize_cb(void *data, DBusMessage *msg) -{ - char *svr_name = NULL; - unsigned int w = 0; - unsigned int h = 0; - unsigned int pri = 0; - minicontrol_h handler = NULL; - minicontrol_priority_e priority; - - if (_provider_get_data_from_dbus_message(msg, &svr_name, &w, &h, &pri, &handler) != MINICONTROL_ERROR_NONE) { - ERR("fail to data from DBUS message"); - return ; - } - - priority = _int_to_priority(pri); - - if (g_monitor_h->callback) { - g_monitor_h->callback(MINICONTROL_ACTION_RESIZE, - svr_name, w, h, priority, - g_monitor_h->user_data); - } - if (g_monitor_h->callback_with_handler) { - g_monitor_h->callback_with_handler(MINICONTROL_ACTION_RESIZE, - svr_name, w, h, priority, - handler, - g_monitor_h->user_data); - } + case MINICONTROL_EVENT_STOP: + action = MINICONTROL_ACTION_STOP; + break; - if (handler != NULL) { - _minictrl_handler_destroy(handler); - } -} + case MINICONTROL_EVENT_RESIZE: + action = MINICONTROL_ACTION_RESIZE; + break; -static void _provider_request_cb(void *data, DBusMessage *msg) -{ - char *svr_name = NULL; - unsigned int w = 0; - unsigned int h = 0; - unsigned int pri = 0; - minicontrol_h handler = NULL; - minicontrol_priority_e priority; + case MINICONTROL_EVENT_REQUEST_HIDE: + case MINICONTROL_EVENT_REQUEST_ANGLE: + action = MINICONTROL_ACTION_REQUEST; + break; - if (_provider_get_data_from_dbus_message(msg, &svr_name, &w, &h, &pri, &handler) != MINICONTROL_ERROR_NONE) { - ERR("fail to data from DBUS message"); - return ; + default: + WARN("Not supported event [%d]", event); + action = event; + break; } - priority = _int_to_priority(pri); - - if (g_monitor_h->callback) { - g_monitor_h->callback(MINICONTROL_ACTION_REQUEST, - svr_name, w, h, priority, - g_monitor_h->user_data); + if (action == MINICONTROL_ACTION_START || action == MINICONTROL_ACTION_RESIZE || action == MINICONTROL_ACTION_REQUEST) { + bundle_get_byte(event_arg, "width", (void*)&width, &n_size); + bundle_get_byte(event_arg, "height", (void*)&height, &n_size); + bundle_get_byte(event_arg, "priority", (void*)&priority_from_signal, &n_size); + priority = _int_to_priority(priority_from_signal); } - if (g_monitor_h->callback_with_handler) { - g_monitor_h->callback_with_handler(MINICONTROL_ACTION_REQUEST, - svr_name, w, h, priority, - handler, - g_monitor_h->user_data); + else { + priority = MINICONTROL_PRIORITY_LOW; } - if (handler != NULL) { - _minictrl_handler_destroy(handler); - } + g_monitor_h->callback(action, minicontrol_name, width, height, priority, g_monitor_h->user_data); } -EXPORT_API minicontrol_error_e minicontrol_monitor_start( - minicontrol_monitor_cb callback, void *data) +EXPORT_API minicontrol_error_e minicontrol_monitor_start(minicontrol_monitor_cb callback, void *data) { if (!callback) return MINICONTROL_ERROR_INVALID_PARAMETER; - if (!g_monitor_h) { - minictrl_sig_handle *start_sh; - minictrl_sig_handle *realize_sh; - minictrl_sig_handle *stop_sh; - minictrl_sig_handle *resize_sh; - minictrl_sig_handle *request_sh; - struct _minicontrol_monitor *monitor_h; - - start_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_START, - _provider_start_cb, NULL); - if (!start_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_START); - return MINICONTROL_ERROR_DBUS; - } - - realize_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_REALIZE, - _provider_realized_cb, NULL); - if (!realize_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_REALIZE); - return MINICONTROL_ERROR_DBUS; - } - - stop_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_STOP, - _provider_stop_cb, NULL); - if (!stop_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_STOP); - return MINICONTROL_ERROR_DBUS; - } - - resize_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_RESIZE, - _provider_resize_cb, NULL); - if (!resize_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_RESIZE); - return MINICONTROL_ERROR_DBUS; - } - - request_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_REQUEST, - _provider_request_cb, NULL); - if (!request_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_REQUEST); - return MINICONTROL_ERROR_DBUS; - } - - monitor_h = calloc(1, sizeof(struct _minicontrol_monitor)); - if (!monitor_h) { - ERR("fail to alloc monitor_h"); - _minictrl_dbus_sig_handle_dettach(start_sh); - _minictrl_dbus_sig_handle_dettach(realize_sh); - _minictrl_dbus_sig_handle_dettach(stop_sh); - _minictrl_dbus_sig_handle_dettach(resize_sh); - _minictrl_dbus_sig_handle_dettach(request_sh); - return MINICONTROL_ERROR_OUT_OF_MEMORY; - } - - monitor_h->start_sh = start_sh; - monitor_h->realize_sh = realize_sh; - monitor_h->stop_sh = stop_sh; - monitor_h->resize_sh = resize_sh; - monitor_h->request_sh = request_sh; - monitor_h->callback = NULL; - monitor_h->callback_with_handler = NULL; - g_monitor_h = monitor_h; - } - - g_monitor_h->callback = callback; - g_monitor_h->user_data = data; INFO("callback[%p], data[%p]", callback, data); - return _minictrl_viewer_req_message_send(); -} - -EXPORT_API minicontrol_error_e minicontrol_monitor_start_with_handler( - minicontrol_monitor_with_handler_cb callback, void *data) -{ - if (!callback) - return MINICONTROL_ERROR_INVALID_PARAMETER; - - if (!g_monitor_h) { - minictrl_sig_handle *start_sh; - minictrl_sig_handle *realize_sh; - minictrl_sig_handle *stop_sh; - minictrl_sig_handle *resize_sh; - minictrl_sig_handle *request_sh; - struct _minicontrol_monitor *monitor_h; - - start_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_START, - _provider_start_cb, NULL); - if (!start_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_START); - return MINICONTROL_ERROR_DBUS; - } - - realize_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_REALIZE, - _provider_realized_cb, NULL); - if (!realize_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_REALIZE); - return MINICONTROL_ERROR_DBUS; - } - - stop_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_STOP, - _provider_stop_cb, NULL); - if (!stop_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_STOP); - return MINICONTROL_ERROR_DBUS; - } - - resize_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_RESIZE, - _provider_resize_cb, NULL); - if (!resize_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_RESIZE); - return MINICONTROL_ERROR_DBUS; - } - - request_sh = _minictrl_dbus_sig_handle_attach( - MINICTRL_DBUS_SIG_REQUEST, - _provider_request_cb, NULL); - if (!request_sh) { - ERR("fail to _minictrl_dbus_sig_handle_attach - %s", - MINICTRL_DBUS_SIG_REQUEST); - return MINICONTROL_ERROR_DBUS; - } - - monitor_h = calloc(1, sizeof(struct _minicontrol_monitor)); - if (!monitor_h) { - ERR("fail to alloc monitor_h"); - _minictrl_dbus_sig_handle_dettach(start_sh); - _minictrl_dbus_sig_handle_dettach(realize_sh); - _minictrl_dbus_sig_handle_dettach(stop_sh); - _minictrl_dbus_sig_handle_dettach(resize_sh); - _minictrl_dbus_sig_handle_dettach(request_sh); - return MINICONTROL_ERROR_OUT_OF_MEMORY; - } + if (g_monitor_h) { + ERR("Already started"); + return MINICONTROL_ERROR_UNKNOWN; + } - monitor_h->start_sh = start_sh; - monitor_h->realize_sh = realize_sh; - monitor_h->stop_sh = stop_sh; - monitor_h->resize_sh = resize_sh; - monitor_h->request_sh = request_sh; - monitor_h->callback = NULL; - monitor_h->callback_with_handler = NULL; - g_monitor_h = monitor_h; + g_monitor_h = malloc(sizeof(struct _minicontrol_monitor)); + if (g_monitor_h == NULL) { + ERR("fail to alloc monitor_h"); + return MINICONTROL_ERROR_OUT_OF_MEMORY; } - g_monitor_h->callback_with_handler = callback; + minicontrol_viewer_set_event_cb(_sig_to_viewer_handler_cb, data); + + g_monitor_h->callback = callback; g_monitor_h->user_data = data; - INFO("callback[%p], data[%p]", callback, data); return _minictrl_viewer_req_message_send(); } @@ -440,24 +126,10 @@ EXPORT_API minicontrol_error_e minicontrol_monitor_stop(void) if (!g_monitor_h) return MINICONTROL_ERROR_NONE; - if (g_monitor_h->start_sh) - _minictrl_dbus_sig_handle_dettach(g_monitor_h->start_sh); - - if (g_monitor_h->realize_sh) - _minictrl_dbus_sig_handle_dettach(g_monitor_h->realize_sh); - - if (g_monitor_h->stop_sh) - _minictrl_dbus_sig_handle_dettach(g_monitor_h->stop_sh); - - if (g_monitor_h->resize_sh) - _minictrl_dbus_sig_handle_dettach(g_monitor_h->resize_sh); - - if (g_monitor_h->request_sh) - _minictrl_dbus_sig_handle_dettach(g_monitor_h->request_sh); + minicontrol_viewer_unset_event_cb(); free(g_monitor_h); g_monitor_h = NULL; return MINICONTROL_ERROR_NONE; } - diff --git a/src/minicontrol-provider.c b/src/minicontrol-provider.c old mode 100755 new mode 100644 index bda4b06..3a45721 --- a/src/minicontrol-provider.c +++ b/src/minicontrol-provider.c @@ -15,13 +15,14 @@ */ #include +#include #include "minicontrol-error.h" #include "minicontrol-type.h" #include "minicontrol-internal.h" #include "minicontrol-provider.h" +#include "minicontrol-provider-internal.h" #include "minicontrol-log.h" -#include "minicontrol-handler.h" #define MINICTRL_PRIORITY_SUFFIX_TOP "__minicontrol_top" #define MINICTRL_PRIORITY_SUFFIX_LOW "__minicontrol_low" @@ -32,54 +33,39 @@ enum { MINICTRL_STATE_RUNNING, }; -struct _provider_data { +struct _minicontrol_provider { char *name; int state; - minicontrol_priority_e priority; Evas_Object *obj; - minictrl_sig_handle *sh; - minicontrol_h handler; + minictrl_sig_handle *running_sh; + minictrl_sig_handle *event_sh; + minicontrol_event_cb event_callback; }; -static void __provider_data_free(struct _provider_data *pd) +static void _minictrl_win_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _minictrl_win_hide_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _minictrl_win_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _minictrl_win_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static void __minicontrol_provider_free(struct _minicontrol_provider *pd) { if (pd) { if (pd->name) free(pd->name); - if (pd->sh) - _minictrl_dbus_sig_handle_dettach(pd->sh); + if (pd->running_sh) + _minictrl_dbus_sig_handle_dettach(pd->running_sh); - if (pd->handler) - _minictrl_handler_destroy(pd->handler); + if (pd->event_sh) + _minictrl_dbus_sig_handle_dettach(pd->event_sh); free(pd); } } -static int __str_has_suffix(const char *str, const char *suffix) -{ - int str_len; - int suffix_len; - - if (!str) - return -1; - - if (!suffix) - return -1; - - str_len = strlen (str); - suffix_len = strlen (suffix); - - if (str_len < suffix_len) - return -1; - - return strcmp(str + str_len - suffix_len, suffix); -} - static void _running_req_cb(void *data, DBusMessage *msg) { - struct _provider_data *pd; + struct _minicontrol_provider *pd; if (!data) { ERR("data is NULL"); @@ -91,14 +77,188 @@ static void _running_req_cb(void *data, DBusMessage *msg) Evas_Coord w = 0; Evas_Coord h = 0; evas_object_geometry_get(pd->obj, NULL, NULL, &w, &h); - _minictrl_provider_message_send(MINICTRL_DBUS_SIG_START, - pd->name, w, h, pd->priority, pd->handler); + _minictrl_provider_message_send(MINICONTROL_EVENT_START, pd->name, w, h, 0); } } -static int minicontrol_win_start(Evas_Object *mincontrol) +static void _sig_to_provider_handler_cb(void *data, DBusMessage *msg) +{ + struct _minicontrol_provider *pd; + DBusError err; + char *minicontrol_name = NULL; + minicontrol_viewer_event_e event; + dbus_bool_t dbus_ret; + bundle *event_arg_bundle = NULL; + bundle_raw *serialized_arg = NULL; + unsigned int serialized_arg_length = 0; + + if (!data) { + ERR("data is NULL"); + return; + } + pd = data; + + dbus_error_init(&err); /* Does not allocate any memory. the error only needs to be freed if it is set at some point. */ + + dbus_ret = dbus_message_get_args(msg, &err, + DBUS_TYPE_STRING, &minicontrol_name, + DBUS_TYPE_INT32, &event, + DBUS_TYPE_STRING, &serialized_arg, + DBUS_TYPE_UINT32, &serialized_arg_length, + DBUS_TYPE_INVALID); + + if (!dbus_ret) { + ERR("fail to get args : %s", err.message); + dbus_error_free(&err); + return; + } + + INFO("minicontrol_name[%s] event[%d] pd->name[%s]", minicontrol_name, event, pd->name); + + if (minicontrol_name && pd->name && strcmp(minicontrol_name, pd->name) == 0) { + event_arg_bundle = bundle_decode(serialized_arg, serialized_arg_length); + /* event argument can be null */ + + if (event == MINICONTROL_VIEWER_EVENT_SHOW) { + Evas_Coord width; + Evas_Coord height; + evas_object_geometry_get (pd->obj, NULL, NULL, &width, &height); + INFO("width[%d] height[%d]", width, height); + _minictrl_provider_message_send(MINICONTROL_EVENT_RESIZE, pd->name, width, height, 0); + } + + if (pd->event_callback) + pd->event_callback(event, event_arg_bundle); + + if (event_arg_bundle) + bundle_free(event_arg_bundle); + } +} + + + +static char *_minictrl_create_name(const char *name) +{ + char *buf; + int size = 0; + + if (!name) { + ERR("name is NULL, invaild parameter"); + set_last_result(MINICONTROL_ERROR_INVALID_PARAMETER); + return NULL; + } + + size = snprintf(NULL, 0, "[%s]", name) + 1; + buf = (char *)malloc(sizeof(char) * size); + if (!buf) { + ERR("fail to alloc buf"); + set_last_result(MINICONTROL_ERROR_OUT_OF_MEMORY); + return NULL; + } + + snprintf(buf, size, "[%s]", name); + + return buf; +} + +static void _access_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + if (ee != NULL) { + if (elm_config_access_get()) { + /* TODO : Check this API is supported + ecore_evas_extn_socket_events_block_set(ee, EINA_TRUE); + */ + } + else { + /* TODO : Check this API is supported + ecore_evas_extn_socket_events_block_set(ee, EINA_FALSE); + */ + } + } +} + + +EXPORT_API Evas_Object* minicontrol_create_window(const char *name, minicontrol_target_viewer_e target_viewer, minicontrol_event_cb event_callback) +{ + Evas_Object *win = NULL; + char *name_inter = NULL; + struct _minicontrol_provider *pd; + + if (!name) { + ERR("invalid parameter"); + set_last_result(MINICONTROL_ERROR_INVALID_PARAMETER); + return NULL; + } + + win = elm_win_add(NULL, "minicontrol", ELM_WIN_SOCKET_IMAGE); + if (!win) { + ERR("elm_win_add failed"); + set_last_result(MINICONTROL_ERROR_ELM_FAILURE); + return NULL; + } + + if (elm_config_access_get()) { + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win)); + + if (ee != NULL) { + /* TODO : Check this API is supported + ecore_evas_extn_socket_events_block_set(ee, EINA_TRUE); + */ + } + + } + evas_object_smart_callback_add(win, "access,changed", _access_changed_cb, NULL); + + name_inter = _minictrl_create_name(name); + if (!name_inter) { + ERR("Fail to create name_inter for : %s", name); + evas_object_del(win); + return NULL; + } + + if (!elm_win_socket_listen(win, name_inter, 0, EINA_TRUE)) { + ERR("Fail to elm win socket listen"); + set_last_result(MINICONTROL_ERROR_ELM_FAILURE); + evas_object_del(win); + free(name_inter); + return NULL; + } + + pd = malloc(sizeof(struct _minicontrol_provider)); + if (!pd) { + ERR("Fail to alloc memory"); + set_last_result(MINICONTROL_ERROR_OUT_OF_MEMORY); + evas_object_del(win); + free(name_inter); + return NULL; + + } + memset(pd, 0x00, sizeof(struct _minicontrol_provider)); + pd->name = name_inter; + pd->state = MINICTRL_STATE_READY; + pd->obj = win; + + evas_object_data_set(win ,MINICTRL_DATA_KEY,pd); + + elm_win_autodel_set(win, EINA_TRUE); + + evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _minictrl_win_del_cb, pd); + evas_object_event_callback_add(win, EVAS_CALLBACK_SHOW, _minictrl_win_show_cb, pd); + evas_object_event_callback_add(win, EVAS_CALLBACK_HIDE, _minictrl_win_hide_cb, pd); + evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _minictrl_win_resize_cb, pd); + + pd->running_sh = _minictrl_dbus_sig_handle_attach(MINICTRL_DBUS_SIG_RUNNING_REQ, _running_req_cb, pd); + pd->event_sh = _minictrl_dbus_sig_handle_attach(MINICTRL_DBUS_SIG_TO_PROVIDER, _sig_to_provider_handler_cb, pd); + pd->event_callback = event_callback; + + INFO("new minicontrol created - %s", pd->name); + return win; +} + +EXPORT_API int minicontrol_send_event(Evas_Object *mincontrol, minicontrol_provider_event_e event, bundle *event_arg) { - struct _provider_data *pd; + struct _minicontrol_provider *pd; int ret = MINICONTROL_ERROR_NONE; if (!mincontrol) { @@ -117,23 +277,16 @@ static int minicontrol_win_start(Evas_Object *mincontrol) return MINICONTROL_ERROR_INVALID_PARAMETER; } - if (pd->state != MINICTRL_STATE_RUNNING) { - Evas_Coord w = 0; - Evas_Coord h = 0; - pd->state = MINICTRL_STATE_RUNNING; - - evas_object_geometry_get(mincontrol, NULL, NULL, &w, &h); - _minictrl_provider_proc_send(MINICONTROL_DBUS_PROC_EXCLUDE); - ret = _minictrl_provider_message_send(MINICTRL_DBUS_SIG_START, - pd->name, w, h, pd->priority, pd->handler); + if (pd->state == MINICTRL_STATE_RUNNING) { + ret = _minictrl_send_event(MINICTRL_DBUS_SIG_TO_VIEWER, pd->name, event, event_arg); } return ret; } -static int minicontrol_win_realize(Evas_Object *mincontrol) +static int minicontrol_win_start(Evas_Object *mincontrol) { - struct _provider_data *pd; + struct _minicontrol_provider *pd; int ret = MINICONTROL_ERROR_NONE; if (!mincontrol) { @@ -152,22 +305,22 @@ static int minicontrol_win_realize(Evas_Object *mincontrol) return MINICONTROL_ERROR_INVALID_PARAMETER; } - Evas_Coord w = 0; - Evas_Coord h = 0; if (pd->state != MINICTRL_STATE_RUNNING) { + Evas_Coord w = 0; + Evas_Coord h = 0; pd->state = MINICTRL_STATE_RUNNING; - } - evas_object_geometry_get(mincontrol, NULL, NULL, &w, &h); - ret = _minictrl_provider_message_send(MINICTRL_DBUS_SIG_REALIZE, - pd->name, w, h, pd->priority, pd->handler); + evas_object_geometry_get(mincontrol, NULL, NULL, &w, &h); + _minictrl_provider_proc_send(MINICONTROL_DBUS_PROC_EXCLUDE); + ret = _minictrl_provider_message_send(MINICONTROL_EVENT_START, pd->name, w, h, 0); + } return ret; } static int minicontrol_win_stop(Evas_Object *mincontrol) { - struct _provider_data *pd; + struct _minicontrol_provider *pd; int ret = MINICONTROL_ERROR_NONE; if (!mincontrol) { @@ -188,71 +341,40 @@ static int minicontrol_win_stop(Evas_Object *mincontrol) if (pd->state != MINICTRL_STATE_READY) { pd->state = MINICTRL_STATE_READY; _minictrl_provider_proc_send(MINICONTROL_DBUS_PROC_INCLUDE); - ret = _minictrl_provider_message_send(MINICTRL_DBUS_SIG_STOP, - pd->name, 0, 0, pd->priority, pd->handler); + ret = _minictrl_provider_message_send(MINICONTROL_EVENT_STOP, pd->name, 0, 0, 0); } return ret; } -static void _minictrl_win_del(void *data, Evas *e, - Evas_Object *obj, void *event_info) +static void _minictrl_win_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { - struct _provider_data *pd = NULL; + struct _minicontrol_provider *pd = NULL; minicontrol_win_stop(obj); pd = evas_object_data_get(obj, MINICTRL_DATA_KEY); - __provider_data_free(pd); + __minicontrol_provider_free(pd); evas_object_data_set(obj, MINICTRL_DATA_KEY, NULL); } -static void _minictrl_win_hide(void *data, Evas *e, - Evas_Object *obj, void *event_info) +static void _minictrl_win_hide_cb(void *data, Evas *e, + Evas_Object *obj, void *event_info) { minicontrol_win_stop(obj); } -static void _minictrl_win_show(void *data, Evas *e, - Evas_Object *obj, void *event_info) +static void _minictrl_win_show_cb(void *data, Evas *e, + Evas_Object *obj, void *event_info) { minicontrol_win_start(obj); } -static void _minictrl_win_realize(void *data, Evas *e, - Evas_Object *obj, void *event_info) -{ - struct _provider_data *pd; - - if (!data) { - ERR("data is NULL, invaild parameter"); - return; - } - pd = data; - - if (!pd->obj) { - ERR("minicontrol object is NULL, invalid parameter"); - return; - } - - Evas *win_e = evas_object_evas_get(pd->obj); - if (win_e != NULL) { - evas_event_callback_del(win_e, EVAS_CALLBACK_RENDER_POST, - _minictrl_win_realize); - } - - minicontrol_win_realize(pd->obj); - - if (pd->handler != NULL) { - _minictrl_handler_set_state(pd->handler, 1); - } -} - -static void _minictrl_win_resize(void *data, Evas *e, - Evas_Object *obj, void *event_info) +static void _minictrl_win_resize_cb(void *data, Evas *e, + Evas_Object *obj, void *event_info) { - struct _provider_data *pd; + struct _minicontrol_provider *pd; if (!data) { ERR("data is NULL, invaild parameter"); @@ -265,219 +387,94 @@ static void _minictrl_win_resize(void *data, Evas *e, Evas_Coord h = 0; evas_object_geometry_get(obj, NULL, NULL, &w, &h); - _minictrl_provider_message_send(MINICTRL_DBUS_SIG_RESIZE, - pd->name, w, h, pd->priority, pd->handler); + _minictrl_provider_message_send(MINICONTROL_EVENT_RESIZE, pd->name, w, h, 0); } } -static char *_minictrl_create_name(const char *name) -{ - char *buf; - int size = 0; - - if (!name) { - ERR("name is NULL, invaild parameter"); - return NULL; - } - - size = snprintf(NULL, 0, "[%s]", name) + 1; - buf = (char *)malloc(sizeof(char) * size); - if (!buf) { - ERR("fail to alloc buf"); - return NULL; - } - - snprintf(buf, size, "[%s]", name); - - return buf; -} - -static minicontrol_priority_e _minictrl_get_priroty_by_name(const char *name) -{ - minicontrol_priority_e priority = MINICONTROL_PRIORITY_MIDDLE; - - if (!__str_has_suffix(name, MINICTRL_PRIORITY_SUFFIX_TOP)) - priority = MINICONTROL_PRIORITY_TOP; - else if (!__str_has_suffix(name, MINICTRL_PRIORITY_SUFFIX_LOW)) - priority = MINICONTROL_PRIORITY_LOW; - - return priority; -} - EXPORT_API Evas_Object *minicontrol_win_add(const char *name) { - minicontrol_h handler = NULL; Evas_Object *win = NULL; - - if (_minictrl_handler_create(&handler) == MINICONTROL_ERROR_NONE) { - if (_minictrl_handler_set_service_name(handler, name) != MINICONTROL_ERROR_NONE) { - ERR("failed to service name"); - _minictrl_handler_destroy(handler); - return NULL; - } - if (_minictrl_handler_set_timestamp(handler, time(NULL)) != MINICONTROL_ERROR_NONE) { - ERR("failed to set timestamp"); - } - if (_minictrl_handler_set_priority(handler, MINICONTROL_HDL_PRIORITY_LV3) != MINICONTROL_ERROR_NONE) { - ERR("failed to set priority"); - } - } else { - ERR("Failed to create minicontrol handler"); - return NULL; - } - - win = minicontrol_win_add_by_handler(handler); - _minictrl_handler_destroy(handler); - - return win; -} - -EXPORT_API Evas_Object *minicontrol_win_add_by_handler(minicontrol_h handler) -{ - Evas_Object *win = NULL; - char *name = NULL; char *name_inter = NULL; - char *priority = NULL; - struct _provider_data *pd; - time_t timestamp_value = 0; + struct _minicontrol_provider *pd; - if (_minictrl_handler_check_validation(handler) != MINICONTROL_ERROR_NONE) { - ERR("handler is invalid, invaild parameter"); - return NULL; - } + INFO("minicontrol_win_add [%s]", name); - _minictrl_handler_get_service_name(handler, &name); - if (name == NULL) { - ERR("service name cannot be NULL"); + if (!name) { + ERR("name is null"); return NULL; } - _minictrl_handler_get_timestamp(handler, ×tamp_value); - if (timestamp_value == 0) { - if (_minictrl_handler_set_timestamp(handler, time(NULL)) != MINICONTROL_ERROR_NONE) { - ERR("failed to set timestamp"); - } - } - _minictrl_handler_get_priority(handler, &priority); - if (priority == NULL) { - if (_minictrl_handler_set_priority(handler, MINICONTROL_HDL_PRIORITY_LV3) != MINICONTROL_ERROR_NONE) { - ERR("failed to set priority"); - } - } else { - free(priority); - } win = elm_win_add(NULL, "minicontrol", ELM_WIN_SOCKET_IMAGE); if (!win) { - free(name); + ERR("elm_win_add returns null for [%s]", name); return NULL; } + if (elm_config_access_get()) { + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win)); + + if (ee != NULL) { + /* TODO : Check this API is supported + ecore_evas_extn_socket_events_block_set(ee, EINA_TRUE); + */ + } + + } + evas_object_smart_callback_add(win, "access,changed", _access_changed_cb, NULL); + name_inter = _minictrl_create_name(name); if (!name_inter) { + ERR("Fail to create name_inter for : %s", name); - free(name); evas_object_del(win); return NULL; } if (!elm_win_socket_listen(win, name_inter, 0, EINA_TRUE)) { ERR("Fail to elm win socket listen"); - free(name); evas_object_del(win); free(name_inter); return NULL; } - pd = malloc(sizeof(struct _provider_data)); + pd = malloc(sizeof(struct _minicontrol_provider)); if (!pd) { ERR("Fail to alloc memory"); - free(name); evas_object_del(win); free(name_inter); return NULL; } - memset(pd, 0x00, sizeof(struct _provider_data)); + memset(pd, 0x00, sizeof(struct _minicontrol_provider)); pd->name = name_inter; pd->state = MINICTRL_STATE_READY; pd->obj = win; - pd->priority = _minictrl_get_priroty_by_name(name); - - if (_minictrl_handler_clone(handler, &(pd->handler)) != MINICONTROL_ERROR_NONE) { - ERR("Fail to clone handler"); - free(name); - evas_object_del(win); - free(name_inter); - free(pd); - return NULL; - } evas_object_data_set(win ,MINICTRL_DATA_KEY,pd); elm_win_autodel_set(win, EINA_TRUE); - evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, - _minictrl_win_del, pd); - - evas_object_event_callback_add(win, EVAS_CALLBACK_SHOW, - _minictrl_win_show, pd); + evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _minictrl_win_del_cb, pd); + evas_object_event_callback_add(win, EVAS_CALLBACK_SHOW, _minictrl_win_show_cb, pd); + evas_object_event_callback_add(win, EVAS_CALLBACK_HIDE, _minictrl_win_hide_cb, pd); + evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _minictrl_win_resize_cb, pd); - evas_object_event_callback_add(win, EVAS_CALLBACK_HIDE, - _minictrl_win_hide, pd); - - evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, - _minictrl_win_resize, pd); - - Evas *win_e = evas_object_evas_get(win); - if (win_e != NULL) { - evas_event_callback_add(win_e, EVAS_CALLBACK_RENDER_POST, - _minictrl_win_realize, pd); - } - - pd->sh = _minictrl_dbus_sig_handle_attach(MINICTRL_DBUS_SIG_RUNNING_REQ, - _running_req_cb, pd); + pd->running_sh = _minictrl_dbus_sig_handle_attach(MINICTRL_DBUS_SIG_RUNNING_REQ, _running_req_cb, pd); INFO("new minicontrol created - %s", pd->name); - - free(name); - return win; } -EXPORT_API minicontrol_error_e minicontrol_win_handler_get(Evas_Object *mincontrol, minicontrol_h *handler) -{ - if (!mincontrol) { - ERR("invaild mincontrol object"); - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - if (!handler) { - ERR("invaild mincontrol handler"); - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - struct _provider_data *pd = evas_object_data_get(mincontrol, MINICTRL_DATA_KEY); - if (pd != NULL) { - *handler = pd->handler; - } else { - return MINICONTROL_ERROR_NO_DATA; - } - - return MINICONTROL_ERROR_NONE; -} - -EXPORT_API minicontrol_error_e minicontrol_win_handler_update(Evas_Object *mincontrol, minicontrol_h handler) +EXPORT_API int minicontrol_request(Evas_Object *mincontrol, minicontrol_request_e request) { - struct _provider_data *pd; + struct _minicontrol_provider *pd; int ret = MINICONTROL_ERROR_NONE; + minicontrol_event_e event; if (!mincontrol) { ERR("mincontrol is NULL, invaild parameter"); return MINICONTROL_ERROR_INVALID_PARAMETER; } - if (_minictrl_handler_check_validation(handler) != MINICONTROL_ERROR_NONE) { - ERR("handler is invalid, invaild parameter"); - return MINICONTROL_ERROR_INVALID_PARAMETER; - } pd = evas_object_data_get(mincontrol, MINICTRL_DATA_KEY); if (!pd) { @@ -490,51 +487,33 @@ EXPORT_API minicontrol_error_e minicontrol_win_handler_update(Evas_Object *minco return MINICONTROL_ERROR_INVALID_PARAMETER; } - if (pd->handler != handler) { - if (pd->handler != NULL) { - _minictrl_handler_destroy(pd->handler); - pd->handler = NULL; - } - if (_minictrl_handler_clone(handler, &(pd->handler)) != MINICONTROL_ERROR_NONE) { - ERR("failed to clone a minicontrol handler"); - return MINICONTROL_ERROR_OUT_OF_MEMORY; + if (pd->state == MINICTRL_STATE_RUNNING) { + switch(request) { + case MINICONTROL_REQ_HIDE_VIEWER : + event = MINICONTROL_EVENT_REQUEST_HIDE; + break; + + case MINICONTROL_REQ_REPORT_VIEWER_ANGLE : + event = MINICONTROL_EVENT_REQUEST_ANGLE; + break; + + case MINICONTROL_REQ_FREEZE_SCROLL_VIEWER : + case MINICONTROL_REQ_UNFREEZE_SCROLL_VIEWER : + case MINICONTROL_REQ_ROTATE_PROVIDER : + WARN("Could be not supported [%d]", request); + event = request; + break; + + case MINICONTROL_REQ_NONE : + default : + ERR("Not supported request[%d]", request); + ret = MINICONTROL_ERROR_NOT_SUPPORTED; + goto out; } - } - if (pd->state == MINICTRL_STATE_RUNNING) { - ret = _minictrl_provider_message_send(MINICTRL_DBUS_SIG_REQUEST, - pd->name, MINICONTROL_REQ_UPDATE_HANDLER, MINICONTROL_REQ_UPDATE_HANDLER - , pd->priority, pd->handler); + _minictrl_send_event(MINICTRL_DBUS_SIG_TO_VIEWER, pd->name, event, NULL); } - +out: return ret; } -EXPORT_API minicontrol_error_e minicontrol_request(Evas_Object *mincontrol, minicontrol_request_e request) -{ - struct _provider_data *pd; - int ret = MINICONTROL_ERROR_NONE; - - if (!mincontrol) { - ERR("mincontrol is NULL, invaild parameter"); - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - pd = evas_object_data_get(mincontrol, MINICTRL_DATA_KEY); - if (!pd) { - ERR("pd is NULL, invaild parameter"); - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if (!pd->name) { - ERR("pd name is NULL, invaild parameter"); - return MINICONTROL_ERROR_INVALID_PARAMETER; - } - - if (pd->state == MINICTRL_STATE_RUNNING) { - ret = _minictrl_provider_message_send(MINICTRL_DBUS_SIG_REQUEST, - pd->name, request, request, pd->priority, pd->handler); - } - - return ret; -} diff --git a/src/minicontrol-viewer.c b/src/minicontrol-viewer.c old mode 100755 new mode 100644 index 5e6e5dd..4d024f4 --- a/src/minicontrol-viewer.c +++ b/src/minicontrol-viewer.c @@ -20,67 +20,188 @@ #include "minicontrol-internal.h" #include "minicontrol-type.h" #include "minicontrol-viewer.h" +#include "minicontrol-viewer-internal.h" #include "minicontrol-log.h" #define MINICTRL_PLUG_DATA_KEY "__minictrl_plug_name" -static void _minictrl_plug_server_del(Ecore_Evas *ee) +struct _minicontrol_viewer { + minictrl_sig_handle *event_sh; + minicontrol_viewer_event_cb callback; + void *user_data; +}; + +static struct _minicontrol_viewer *g_minicontrol_viewer_h = NULL; + +EXPORT_API int minicontrol_viewer_send_event(const char *minicontrol_name, minicontrol_viewer_event_e event, bundle *event_arg) +{ + int ret = MINICONTROL_ERROR_NONE; + + if (minicontrol_name == NULL) { + ERR("appid is NULL, invaild parameter"); + return MINICONTROL_ERROR_INVALID_PARAMETER; + } + + ret = _minictrl_send_event(MINICTRL_DBUS_SIG_TO_PROVIDER, minicontrol_name, event, event_arg); + + return ret; +} + + +static void _sig_to_viewer_handler_cb(void *data, DBusMessage *msg) { - char *svr_name = NULL; + DBusError err; + char *minicontrol_name = NULL; + minicontrol_event_e event; + dbus_bool_t dbus_ret; + bundle *event_arg_bundle = NULL; + bundle_raw *serialized_arg = NULL; + unsigned int serialized_arg_length = 0; + + dbus_error_init(&err); /* Does not allocate any memory. the error only needs to be freed if it is set at some point. */ - svr_name = ecore_evas_data_get(ee, MINICTRL_PLUG_DATA_KEY); - if (!svr_name) { - ERR("fail to get svr_name"); + dbus_ret = dbus_message_get_args(msg, &err, + DBUS_TYPE_STRING, &minicontrol_name, + DBUS_TYPE_INT32, &event, + DBUS_TYPE_STRING, &serialized_arg, + DBUS_TYPE_UINT32, &serialized_arg_length, + DBUS_TYPE_INVALID); + + if (!dbus_ret) { + ERR("fail to get args : %s", err.message); + dbus_error_free(&err); return; } - INFO("server - %s is deleted", svr_name); + if (serialized_arg_length != 0) { + event_arg_bundle = bundle_decode(serialized_arg, serialized_arg_length); - /* send message to remve plug */ - _minictrl_provider_message_send(MINICTRL_DBUS_SIG_STOP, - svr_name, 0, 0, - MINICONTROL_PRIORITY_LOW, NULL); - _minictrl_provider_proc_send(MINICONTROL_DBUS_PROC_INCLUDE); + if (event_arg_bundle == NULL) { + ERR("fail to deserialize arguments"); + return; + } + } + + if (g_minicontrol_viewer_h->callback) + g_minicontrol_viewer_h->callback(event, minicontrol_name, event_arg_bundle, g_minicontrol_viewer_h->user_data); + + bundle_free(event_arg_bundle); + dbus_error_free(&err); } -static void _minictrl_plug_del(void *data, Evas *e, - Evas_Object *obj, void *event_info) + +EXPORT_API int minicontrol_viewer_set_event_cb(minicontrol_viewer_event_cb callback, void *data) { - Ecore_Evas *ee = NULL; - char *svr_name = NULL; + if (!callback) { + ERR("MINICONTROL_ERROR_INVALID_PARAMETER"); + return MINICONTROL_ERROR_INVALID_PARAMETER; + } - ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - if (!ee) + INFO("g_minicontrol_viewer_h [%p]", g_minicontrol_viewer_h); + + if (g_minicontrol_viewer_h == NULL) { + minictrl_sig_handle *event_sh; + struct _minicontrol_viewer *minicontrol_viewer_h; + + event_sh = _minictrl_dbus_sig_handle_attach(MINICTRL_DBUS_SIG_TO_VIEWER, _sig_to_viewer_handler_cb, NULL); + if (!event_sh) { + ERR("fail to _minictrl_dbus_sig_handle_attach - %s", MINICTRL_DBUS_SIG_TO_VIEWER); + return MINICONTROL_ERROR_IPC_FAILURE; + } + + minicontrol_viewer_h = malloc(sizeof(struct _minicontrol_viewer)); + if (!minicontrol_viewer_h) { + ERR("fail to alloc minicontrol_viewer_h"); + _minictrl_dbus_sig_handle_dettach(event_sh); + return MINICONTROL_ERROR_OUT_OF_MEMORY; + } + + minicontrol_viewer_h->event_sh = event_sh; + g_minicontrol_viewer_h = minicontrol_viewer_h; + } + + g_minicontrol_viewer_h->callback = callback; + g_minicontrol_viewer_h->user_data = data; + INFO("callback[%p], data[%p]", callback, data); + + return _minictrl_viewer_req_message_send(); +} + +EXPORT_API int minicontrol_viewer_unset_event_cb(void) +{ + if (!g_minicontrol_viewer_h) + return MINICONTROL_ERROR_NONE; + + if (g_minicontrol_viewer_h->event_sh) + _minictrl_dbus_sig_handle_dettach(g_minicontrol_viewer_h->event_sh); + + free(g_minicontrol_viewer_h); + g_minicontrol_viewer_h = NULL; + + return MINICONTROL_ERROR_NONE; +} + +static void _minictrl_plug_server_del(Ecore_Evas *ee) +{ + char *minicontrol_name = NULL; + + minicontrol_name = ecore_evas_data_get(ee, MINICTRL_PLUG_DATA_KEY); + if (!minicontrol_name) { + ERR("fail to get minicontrol_name"); return; + } - svr_name = ecore_evas_data_get(ee, MINICTRL_PLUG_DATA_KEY); - if (svr_name) - free(svr_name); + INFO("server - %s is deleted", minicontrol_name); + /* To avoid retrying to free minicontrol_name again, set MINICTRL_PLUG_DATA_KEY as NULL */ ecore_evas_data_set(ee, MINICTRL_PLUG_DATA_KEY, NULL); + + /* send message to remove plug */ + _minictrl_provider_message_send(MINICONTROL_EVENT_STOP, minicontrol_name, 0, 0, MINICONTROL_PRIORITY_LOW); + _minictrl_provider_proc_send(MINICONTROL_DBUS_PROC_INCLUDE); + free(minicontrol_name); } -EXPORT_API -Evas_Object *minicontrol_viewer_image_object_get(const Evas_Object *obj) +static void _minictrl_plug_del(void *data, Evas *e, Evas_Object *obj, void *event_info) { - return elm_plug_image_object_get(obj); + Ecore_Evas *ee = data; + char *minicontrol_name = NULL; + + if (!ee) + return; + + minicontrol_name = ecore_evas_data_get(ee, MINICTRL_PLUG_DATA_KEY); + + if (minicontrol_name) { + /* Sending an event 'MINICONTROL_EVENT_REQUEST_HIDE' should be done by minicontrol viewer manually */ + free(minicontrol_name); + ecore_evas_data_set(ee, MINICTRL_PLUG_DATA_KEY, NULL); + } } -EXPORT_API Evas_Object *minicontrol_viewer_add(Evas_Object *parent, - const char *svr_name) +EXPORT_API Evas_Object *minicontrol_viewer_add(Evas_Object *parent, const char *minicontrol_name) { Evas_Object *plug = NULL; Evas_Object *plug_img = NULL; Ecore_Evas *ee = NULL; + if (parent == NULL || minicontrol_name == NULL) { + ERR("invalid parameter"); + set_last_result(MINICONTROL_ERROR_INVALID_PARAMETER); + return NULL; + } + plug = elm_plug_add(parent); + if (!plug) { ERR("fail to create plug"); + set_last_result(MINICONTROL_ERROR_ELM_FAILURE); return NULL; } - if (!elm_plug_connect(plug, svr_name, 0, EINA_TRUE)) { - ERR("Cannot connect plug[%s]", svr_name); + if (!elm_plug_connect(plug, minicontrol_name, 0, EINA_TRUE)) { + ERR("Cannot connect plug[%s]", minicontrol_name); + set_last_result(MINICONTROL_ERROR_ELM_FAILURE); evas_object_del(plug); return NULL; } @@ -88,31 +209,62 @@ EXPORT_API Evas_Object *minicontrol_viewer_add(Evas_Object *parent, plug_img = elm_plug_image_object_get(plug); ee = ecore_evas_object_ecore_evas_get(plug_img); - ecore_evas_data_set(ee, MINICTRL_PLUG_DATA_KEY, strdup(svr_name)); + ecore_evas_data_set(ee, MINICTRL_PLUG_DATA_KEY, strdup(minicontrol_name)); ecore_evas_callback_delete_request_set(ee, _minictrl_plug_server_del); - evas_object_event_callback_add(plug, EVAS_CALLBACK_DEL, - _minictrl_plug_del, plug); + evas_object_event_callback_add(plug, EVAS_CALLBACK_DEL, _minictrl_plug_del, ee); return plug; } -EXPORT_API minicontrol_error_e minicontrol_viewer_request(const char *appid, minicontrol_request_e request, int value) +EXPORT_API Evas_Object *minicontrol_viewer_image_object_get(const Evas_Object *obj) +{ + return elm_plug_image_object_get(obj); +} + +EXPORT_API int minicontrol_viewer_request(const char *minicontrol_name, minicontrol_request_e request, int value) { int ret = MINICONTROL_ERROR_NONE; + minicontrol_viewer_event_e event = 0; + bundle *event_arg_bundle = NULL; + char bundle_value_buffer[BUNDLE_BUFFER_LENGTH] = { 0, }; - if (appid == NULL) { + if (minicontrol_name == NULL) { ERR("appid is NULL, invaild parameter"); return MINICONTROL_ERROR_INVALID_PARAMETER; } - if (request != MINICONTROL_REQ_ROTATE_PROVIDER - && request != MINICONTROL_REQ_PROVIDER_PAUSE - && request != MINICONTROL_REQ_PROVIDER_RESUME) { - return MINICONTROL_ERROR_INVALID_PARAMETER; + + switch(request) { + case MINICONTROL_REQ_ROTATE_PROVIDER: { + event = MINICONTROL_EVENT_REPORT_ANGLE; + event_arg_bundle = bundle_create(); + + if (event_arg_bundle == NULL) { + ERR("fail to create a bundle instance"); + ret = MINICONTROL_ERROR_OUT_OF_MEMORY; + goto out; + } + + snprintf(bundle_value_buffer, BUNDLE_BUFFER_LENGTH, "%d", value); + + bundle_add_str(event_arg_bundle, "angle", bundle_value_buffer); + break; } + case MINICONTROL_REQ_NONE: + case MINICONTROL_REQ_HIDE_VIEWER: + case MINICONTROL_REQ_FREEZE_SCROLL_VIEWER: + case MINICONTROL_REQ_UNFREEZE_SCROLL_VIEWER: + case MINICONTROL_REQ_REPORT_VIEWER_ANGLE: + default : + ret = MINICONTROL_ERROR_INVALID_PARAMETER; + goto out; + } + + _minictrl_send_event(MINICTRL_DBUS_SIG_TO_PROVIDER, minicontrol_name, event, event_arg_bundle); - ret = _minictrl_provider_message_send(MINICTRL_DBUS_SIG_REQUEST, - appid, request, value, MINICONTROL_PRIORITY_MIDDLE, NULL); +out: + if (event_arg_bundle) + bundle_free(event_arg_bundle); return ret; } -- 2.7.4