Initial upload of minicontrol(tagging) 2.0alpha master 2.0_alpha submit/master/20120920.150948
authoryoungsub ko <ys4610.ko@samsung.com>
Tue, 21 Aug 2012 09:14:41 +0000 (18:14 +0900)
committeryoungsub ko <ys4610.ko@samsung.com>
Tue, 21 Aug 2012 12:18:57 +0000 (21:18 +0900)
Change-Id: I8588c9b7956844087467dfbd517f1ae0da6a1eb2

26 files changed:
CMakeLists.txt [new file with mode: 0755]
LICENSE [new file with mode: 0755]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/libminicontrol-dev.install.in [new file with mode: 0644]
debian/libminicontrol.install.in [new file with mode: 0644]
debian/rules [new file with mode: 0755]
include/minicontrol-error.h [new file with mode: 0755]
include/minicontrol-internal.h [new file with mode: 0755]
include/minicontrol-log.h [new file with mode: 0755]
include/minicontrol-monitor.h [new file with mode: 0755]
include/minicontrol-provider.h [new file with mode: 0755]
include/minicontrol-type.h [new file with mode: 0755]
include/minicontrol-viewer.h [new file with mode: 0755]
include/minicontrol.h [new file with mode: 0755]
minicontrol-monitor.pc.in [new file with mode: 0644]
minicontrol-provider.pc.in [new file with mode: 0644]
minicontrol-viewer.pc.in [new file with mode: 0644]
packaging/minicontrol.spec [new file with mode: 0755]
src/minicontrol-internal.c [new file with mode: 0755]
src/minicontrol-monitor.c [new file with mode: 0755]
src/minicontrol-provider.c [new file with mode: 0755]
src/minicontrol-viewer.c [new file with mode: 0755]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..5ecd2e8
--- /dev/null
@@ -0,0 +1,72 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(minicontrol C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR "\${exec_prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.0.1")
+
+SET(CMAKE_SKIP_BUILD_RPATH true)
+
+SET(INSTALL_HEADERS
+       minicontrol-error.h
+       minicontrol-type.h
+       minicontrol-monitor.h
+       minicontrol-provider.h
+       minicontrol-viewer.h
+)
+
+SET(SUBMODULES
+       minicontrol-provider
+       minicontrol-viewer
+       minicontrol-monitor
+)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+       dlog
+       elementary
+       evas
+       ecore-evas
+       dbus-1
+       dbus-glib-1
+)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -g -Wall")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DMINICTRL_USE_DLOG")
+
+ADD_LIBRARY(${PROJECT_NAME}-inter STATIC
+       src/minicontrol-internal.c
+)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}-inter ${pkgs_LDFLAGS})
+
+FOREACH(lib_file ${SUBMODULES})
+       ADD_LIBRARY(${lib_file} SHARED src/${lib_file}.c)
+       TARGET_LINK_LIBRARIES(${lib_file} ${pkgs_LDFLAGS} ${PROJECT_NAME}-inter)
+       SET_TARGET_PROPERTIES(${lib_file} PROPERTIES SOVERSION ${VERSION_MAJOR})
+       SET_TARGET_PROPERTIES(${lib_file} PROPERTIES VERSION ${VERSION})
+       INSTALL(TARGETS ${lib_file} DESTINATION lib COMPONENT RuntimeLibraries)
+ENDFOREACH(lib_file)
+
+FOREACH(pcfile ${SUBMODULES})
+       CONFIGURE_FILE(${pcfile}.pc.in ${pcfile}.pc @ONLY)
+       SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${pcfile}.pc")
+       INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pcfile}.pc DESTINATION lib/pkgconfig)
+ENDFOREACH(pcfile)
+
+FOREACH(hfile ${INSTALL_HEADERS})
+       INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/${hfile} DESTINATION include/${PROJECT_NAME})
+ENDFOREACH(hfile)
+
diff --git a/LICENSE b/LICENSE
new file mode 100755 (executable)
index 0000000..7ccb5b5
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,75 @@
+Flora License
+
+Version 1.0, May, 2012
+
+http://www.tizenopensource.org/license
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies with the standards set forth in the Compatibility Definition Document and passes the Compatibility Test Suite as defined from time to time by the Tizen Technical Steering Group and certified by the Tizen Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work solely as incorporated into a Tizen Certified Platform, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work solely as incorporated into a Tizen Certified Platform to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof pursuant to the copyright license above, in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+  1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+  2. You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+  3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+  4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+
+   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.
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..3f1f7ce
--- /dev/null
@@ -0,0 +1,15 @@
+minicontrol (0.0.1-2) unstable; urgency=low
+
+  * apply minicontrol priority
+  * Git: slp/pkgs/m/minicontrol
+  * Tag: minicontrol_0.0.1-2
+
+ -- Jeonghoon Park <jh1979.park@samsung.com>  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 <jh1979.park@samsung.com>  Mon, 27 Feb 2012 14:14:00 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..4fb4138
--- /dev/null
@@ -0,0 +1,25 @@
+Source: minicontrol
+Section: libs
+Priority: optional
+Maintainer: Jeonghoon Park <jh1979.park@samsung.com>, Young-joo Park <yjoo93.park@samsung.com>
+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
new file mode 100644 (file)
index 0000000..ca882bb
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..a0f0008
--- /dev/null
@@ -0,0 +1 @@
+CMakeLists.txt
diff --git a/debian/libminicontrol-dev.install.in b/debian/libminicontrol-dev.install.in
new file mode 100644 (file)
index 0000000..1bc0c16
--- /dev/null
@@ -0,0 +1,2 @@
+@PREFIX@/include/@PROJECT_NAME@/*.h
+@PREFIX@/lib/pkgconfig/*.pc
diff --git a/debian/libminicontrol.install.in b/debian/libminicontrol.install.in
new file mode 100644 (file)
index 0000000..bf766f0
--- /dev/null
@@ -0,0 +1 @@
+@PREFIX@/lib/*.so*
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..a8ed3d6
--- /dev/null
@@ -0,0 +1,116 @@
+#!/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/include/minicontrol-error.h b/include/minicontrol-error.h
new file mode 100755 (executable)
index 0000000..c023ac0
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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_ERROR_H_
+#define _MINICTRL_ERROR_H_
+
+/**
+ * @defgroup MINICONTROL_LIBRARY_ERROR_TYPE minicontrol monitor error type
+ * @brief minicontrol library error type
+ */
+
+/**
+ * @addtogroup MINICONTROL_LIBRARY_ERROR_TYPE
+ * @{
+ */
+
+/**
+ * @breief Enumeration describing error code of minicontrol library
+ */
+typedef enum _minicontrol_error {
+       MINICONTROL_ERROR_NONE = 0,
+       MINICONTROL_ERROR_INVALID_PARAMETER = -1,
+       MINICONTROL_ERROR_OUT_OF_MEMORY = -2,
+       MINICONTROL_ERROR_DBUS = -3,
+       MINICONTROL_ERROR_UNKNOWN = -100,
+}minicontrol_error_e;
+
+#endif /* _MINICTRL_ERROR_H_ */
+
+
diff --git a/include/minicontrol-internal.h b/include/minicontrol-internal.h
new file mode 100755 (executable)
index 0000000..b541213
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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_INTERNAL_H_
+#define _MINICTRL_INTERNAL_H_
+
+#include <dbus/dbus.h>
+#include "minicontrol-type.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
+#endif /* EXPORT_API */
+
+#define MINICTRL_DBUS_SIG_START "minicontrol_start"
+#define MINICTRL_DBUS_SIG_STOP "minicontrol_stop"
+#define MINICTRL_DBUS_SIG_RESIZE "minicontrol_resize"
+#define MINICTRL_DBUS_SIG_RUNNING_REQ "minicontrol_running_request"
+
+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);
+
+int _minictrl_viewer_req_message_send(void);
+
+minictrl_sig_handle *_minictrl_dbus_sig_handle_attach(const char *signal,
+                               void (*callback) (void *data, DBusMessage *msg),
+                               void *data);
+
+void _minictrl_dbus_sig_handle_dettach(minictrl_sig_handle *handle);
+
+#endif /* _MINICTRL_INTERNAL_H_ */
+
diff --git a/include/minicontrol-log.h b/include/minicontrol-log.h
new file mode 100755 (executable)
index 0000000..209fdbe
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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_LOG_H_
+#define _MINICTRL_LOG_H_
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef MINICTRL_USE_DLOG
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "libminicontrol"
+#define DBG(fmt , args...) \
+       do{ \
+               LOGD("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+       } while(0)
+
+#define INFO(fmt , args...) \
+       do{ \
+               LOGI("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+       } while(0)
+
+#define WARN(fmt , args...) \
+       do{ \
+               LOGI("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+       } while(0)
+
+#define ERR(fmt , args...) \
+       do{ \
+               LOGI("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+       } while(0)
+
+#else /* MINICTRL_USE_DLOG */
+#define DBG(fmt , args...) \
+       do{ \
+               printf("[D][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+       } while(0)
+
+#define INFO(fmt , args...) \
+       do{ \
+               printf("[I][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+       } while(0)
+
+#define WARN(fmt , args...) \
+       do{ \
+               printf("[W][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+       } while(0)
+
+#define ERR(fmt , args...) \
+       do{ \
+               printf("[E][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+       } while(0)
+
+#endif /* MINICTRL_USE_DLOG */
+
+#endif /* _MINICTRL_LOG_H_ */
+
diff --git a/include/minicontrol-monitor.h b/include/minicontrol-monitor.h
new file mode 100755 (executable)
index 0000000..794a3d7
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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_MONITOR_H_
+#define _MINICTRL_MONITOR_H_
+
+#include <minicontrol-error.h>
+#include <minicontrol-type.h>
+
+/**
+ * @defgroup MINICONTROL_MONITOR_LIBRARY minicontrol monitor library
+ * @brief This minicontrol monitor library used to manage events triggered by minicontrol provider
+ */
+
+/**
+ * @ingroup MINICONTROL_MONITOR_LIBRARY
+ * @defgroup MINICONTROL_MONITOR_LIBRARY_TYPE minicontrol monitor library type
+ * @brief minicontrol monitor library type
+ */
+
+/**
+ * @addtogroup MINICONTROL_MONITOR_LIBRARY_TYPE
+ * @{
+ */
+
+  /**
+ * @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);
+
+/**
+ * @addtogroup MINICONTROL_MONITOR_LIBRARY
+ * @{
+ */
+
+/**
+ * @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(minicontrol_monitor_cb callback,
+                                       void *data);
+
+/**
+ * @brief Unregister 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);
+
+#endif /* _MINICTRL_MONITOR_H_ */
+
diff --git a/include/minicontrol-provider.h b/include/minicontrol-provider.h
new file mode 100755 (executable)
index 0000000..c8d1c7f
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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_PROVIDER_H_
+#define _MINICTRL_PROVIDER_H_
+
+#include <Evas.h>
+
+/**
+ * @defgroup MINICONTROL_PROVIDER_LIBRARY minicontrol provider library
+ * @brief This minicontrol provider library used to create evas socket window
+ */
+
+/**
+ * @addtogroup MINICONTROL_PROVIDER_LIBRARY
+ * @{
+ */
+
+/**
+ * @brief This function create evas socket window
+ * @param[in] name name of socket window
+ * @return evas object of socket window
+ */
+Evas_Object *minicontrol_win_add(const char *name);
+
+#endif /* _MINICTRL_PROVIDER_H_ */
+
diff --git a/include/minicontrol-type.h b/include/minicontrol-type.h
new file mode 100755 (executable)
index 0000000..17bf7f4
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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_TYPE_H_
+#define _MINICTRL_TYPE_H_
+
+/**
+ * @defgroup MINICONTROL_LIBRARY_TYPE minicontrol monitor error type
+ * @brief minicontrol library type
+ */
+
+/**
+ * @addtogroup MINICONTROL_LIBRARY_TYPE
+ * @{
+ */
+
+/**
+ * @breief Enumeration describing type of events originated by minicontrol provider
+ */
+typedef enum _minicontrol_action {
+       MINICONTROL_ACTION_START = 0,
+       MINICONTROL_ACTION_STOP,
+       MINICONTROL_ACTION_RESIZE,
+} minicontrol_action_e;
+
+/**
+ * @breief Enumeration describing priority of minicontrol provider
+ */
+typedef enum {
+       MINICONTROL_PRIORITY_TOP = 1000,
+       MINICONTROL_PRIORITY_MIDDLE = 100,
+       MINICONTROL_PRIORITY_LOW = 1,
+}minicontrol_priority_e;
+
+#endif /* _MINICTRL_TYPE_H_ */
diff --git a/include/minicontrol-viewer.h b/include/minicontrol-viewer.h
new file mode 100755 (executable)
index 0000000..eef7f9a
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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_VIEWER_H_
+#define _MINICTRL_VIEWER_H_
+
+#include <Evas.h>
+
+/**
+ * @defgroup MINICONTROL_VIEWER_LIBRARY minicontrol provider library
+ * @brief This minicontrol viewer library used to display minicontrol which created by minicontrol provider
+ */
+
+/**
+ * @addtogroup MINICONTROL_VIEWER_LIBRARY
+ * @{
+ */
+
+/**
+ * @brief This function add minicontrol named as "svr_name" to given parent evas object then return it
+ * @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
+ */
+Evas_Object *minicontrol_viewer_add(Evas_Object *parent, const char *svr_name);
+
+/**
+ * @brief Get the basic evas image object from given minicontrol object
+ * @param[in] obj minicontrol object
+ * @return basic evas image object of minicontrol object
+ */
+Evas_Object *minicontrol_viewer_image_object_get(const Evas_Object *obj);
+
+#endif /* _MINICTRL_VIEWER_H_ */
+
diff --git a/include/minicontrol.h b/include/minicontrol.h
new file mode 100755 (executable)
index 0000000..a898c7f
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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_H_DEF_
+#define _MINICONTROL_H_DEF_
+
+#include <minicontrol-provider.h>
+#include <minicontrol-viewer.h>
+#include <minicontrol-monitor.h>
+
+#endif /* _MINICONTROL_H_DEF_ */
diff --git a/minicontrol-monitor.pc.in b/minicontrol-monitor.pc.in
new file mode 100644 (file)
index 0000000..1920738
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: minicontrol-monitor
+Description: minicontrol monitor supporting library
+Version: @VERSION@
+Requires:
+Libs: -L${libdir} -lminicontrol-monitor
+Cflags: -I${includedir}
diff --git a/minicontrol-provider.pc.in b/minicontrol-provider.pc.in
new file mode 100644 (file)
index 0000000..ee35969
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: minicontrol-provider
+Description: minicontrol provider supporting library
+Version: @VERSION@
+Requires: evas
+Libs: -L${libdir} -lminicontrol-provider
+Cflags: -I${includedir}
diff --git a/minicontrol-viewer.pc.in b/minicontrol-viewer.pc.in
new file mode 100644 (file)
index 0000000..052182c
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: minicontrol-viewer
+Description: minicontrol viewer supporting library
+Version: @VERSION@
+Requires: evas
+Libs: -L${libdir} -lminicontrol-viewer
+Cflags: -I${includedir}
diff --git a/packaging/minicontrol.spec b/packaging/minicontrol.spec
new file mode 100755 (executable)
index 0000000..f9728f4
--- /dev/null
@@ -0,0 +1,57 @@
+Name:       minicontrol
+Summary:    minicontrol library
+Version:    0.0.1
+Release:    1
+Group:      TBD
+License:    Flora Software License
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(dbus-1)
+BuildRequires: pkgconfig(dbus-glib-1)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(ecore-evas)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: cmake
+Requires(post): /sbin/ldconfig
+requires(postun): /sbin/ldconfig
+%description
+Minicontrol library.
+
+%prep
+%setup -q
+
+%package devel
+Summary:    Minicontrol library (devel)
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Minicontrol library (devel).
+
+%build
+export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
+LDFLAGS="$LDFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+
+
+%post
+/sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/libminicontrol-provider.so*
+%{_libdir}/libminicontrol-viewer.so*
+%{_libdir}/libminicontrol-monitor.so*
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/%{name}/*.h
+%{_libdir}/pkgconfig/minicontrol-provider.pc
+%{_libdir}/pkgconfig/minicontrol-monitor.pc
+%{_libdir}/pkgconfig/minicontrol-viewer.pc
+
diff --git a/src/minicontrol-internal.c b/src/minicontrol-internal.c
new file mode 100755 (executable)
index 0000000..f9ae891
--- /dev/null
@@ -0,0 +1,301 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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 <stdlib.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include "minicontrol-error.h"
+#include "minicontrol-type.h"
+#include "minicontrol-internal.h"
+#include "minicontrol-log.h"
+
+#define MINICTRL_DBUS_PATH "/org/tizen/minicontrol"
+#define MINICTRL_DBUS_INTERFACE "org.tizen.minicontrol.signal"
+
+struct _minictrl_sig_handle {
+       DBusConnection *conn;
+       void (*callback) (void *data, DBusMessage *msg);
+       void *user_data;
+       char *signal;
+};
+
+int _minictrl_viewer_req_message_send(void)
+{
+       DBusConnection *connection = NULL;
+       DBusMessage *message = NULL;
+       DBusError err;
+       dbus_bool_t dbus_ret;
+       int ret = MINICONTROL_ERROR_NONE;
+
+       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;
+               goto release_n_return;
+       }
+
+       message = dbus_message_new_signal(MINICTRL_DBUS_PATH,
+                               MINICTRL_DBUS_INTERFACE,
+                               MINICTRL_DBUS_SIG_RUNNING_REQ);
+       if (!message) {
+               ERR("fail to create dbus message");
+               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 viewer req message");
+               ret = MINICONTROL_ERROR_DBUS;
+               goto release_n_return;
+       }
+
+       dbus_connection_flush(connection);
+
+release_n_return:
+       dbus_error_free(&err);
+
+       if (message)
+               dbus_message_unref(message);
+
+       if (connection)
+               dbus_connection_unref(connection);
+
+       return ret;
+}
+
+int _minictrl_provider_message_send(const char *sig_name, const char *svr_name,
+                               unsigned int witdh, unsigned int height,
+                               minicontrol_priority_e priority)
+{
+       DBusConnection *connection = NULL;
+       DBusMessage *message = NULL;
+       DBusError err;
+       dbus_bool_t dbus_ret;
+       int ret = MINICONTROL_ERROR_NONE;
+
+       if (!sig_name) {
+               ERR("sig_name is NULL, invaild parameter");
+               return MINICONTROL_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!svr_name) {
+               ERR("svr_name is NULL, invaild parameter");
+               return MINICONTROL_ERROR_INVALID_PARAMETER;
+       }
+
+       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;
+               goto release_n_return;
+       }
+
+       message = dbus_message_new_signal(MINICTRL_DBUS_PATH,
+                               MINICTRL_DBUS_INTERFACE,
+                               sig_name);
+
+       if (!message) {
+               ERR("fail to create dbus message");
+               ret = MINICONTROL_ERROR_OUT_OF_MEMORY;
+               goto release_n_return;
+       }
+
+       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 (!dbus_ret) {
+               ERR("fail to append name to dbus message : %s", svr_name);
+               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;
+               goto release_n_return;
+       }
+
+       dbus_connection_flush(connection);
+       INFO("[%s][%s] size-[%ux%u] priority[%u]",
+               sig_name, svr_name, witdh, height, priority);
+
+release_n_return:
+       dbus_error_free(&err);
+
+       if (message)
+               dbus_message_unref(message);
+
+       if (connection)
+               dbus_connection_unref(connection);
+
+       return ret;
+}
+
+static DBusHandlerResult _minictrl_signal_filter(DBusConnection *conn,
+               DBusMessage *msg, void *user_data)
+{
+       minictrl_sig_handle *handle = NULL;
+       const char *interface;
+       DBusError error;
+       dbus_bool_t ret;
+
+       if (!user_data)
+               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+       handle = user_data;
+
+       dbus_error_init(&error);
+
+       interface = dbus_message_get_interface(msg);
+       if (!interface)
+               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+       if (strcmp(MINICTRL_DBUS_INTERFACE, interface))
+               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+       ret = dbus_message_is_signal(msg, interface, handle->signal);
+       if (!ret) {
+               DBG("this msg is not signal");
+               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+       }
+
+       if (handle->callback)
+               handle->callback(handle->user_data, msg);
+
+       return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+
+minictrl_sig_handle *_minictrl_dbus_sig_handle_attach(const char *signal,
+                               void (*callback) (void *data, DBusMessage *msg),
+                               void *data)
+{
+       minictrl_sig_handle *handle = NULL;
+       DBusError err;
+       DBusConnection *conn = NULL;
+       char rule[1024] = {'\0', };
+
+       if (!signal) {
+               ERR("signal is NULL");
+               return NULL;
+       }
+
+       if (!callback) {
+               ERR("call is NULL");
+               return NULL;
+       }
+
+       handle = malloc(sizeof(minictrl_sig_handle));
+       if (!handle) {
+               ERR("fail to alloc handle");
+               return NULL;
+       }
+
+       dbus_error_init(&err);
+       conn = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err);
+       if (!conn) {
+               ERR("fail to get bus : %s", err.message);
+               goto error_n_return;
+       }
+
+       dbus_connection_setup_with_g_main(conn, NULL);
+       snprintf(rule, 1024,
+               "path='%s',type='signal',interface='%s',member='%s'",
+               MINICTRL_DBUS_PATH,
+               MINICTRL_DBUS_INTERFACE,
+               signal);
+
+       dbus_bus_add_match(conn, rule, &err);
+       if (dbus_error_is_set(&err)) {
+               ERR("fail to dbus_bus_remove_match : %s",
+                               err.message);
+               goto error_n_return;
+       }
+
+       if (dbus_connection_add_filter(conn, _minictrl_signal_filter,
+                                       handle, NULL) == FALSE) {
+               ERR("fail to dbus_connection_add_filter : %s",
+                               err.message);
+               goto error_n_return;
+       }
+
+       dbus_connection_set_exit_on_disconnect(conn, FALSE);
+
+       handle->conn = conn;
+       handle->callback = callback;
+       handle->user_data = data;
+       handle->signal = strdup(signal);
+
+       INFO("success to attach signal[%s]-[%p, %p]", signal, callback, data);
+
+       return handle;
+
+
+error_n_return:
+       if (handle)
+               free(handle);
+
+       dbus_error_free(&err);
+
+       if (conn)
+               dbus_connection_close(conn);
+
+       return NULL;
+}
+
+void _minictrl_dbus_sig_handle_dettach(minictrl_sig_handle *handle)
+{
+       DBusError err;
+       char rule[1024] = {'\0', };
+
+       if (!handle) {
+               ERR("handle is NULL");
+               return;
+       }
+
+       dbus_error_init(&err);
+
+       dbus_connection_remove_filter(handle->conn,
+                       _minictrl_signal_filter, handle);
+
+       snprintf(rule, 1024,
+               "path='%s',type='signal',interface='%s',member='%s'",
+               MINICTRL_DBUS_PATH,
+               MINICTRL_DBUS_INTERFACE,
+               handle->signal);
+
+       dbus_bus_remove_match(handle->conn, rule, &err);
+       if (dbus_error_is_set(&err)) {
+               ERR("fail to dbus_bus_remove_match : %s", err.message);
+               dbus_error_free(&err);
+       }
+
+       dbus_connection_close(handle->conn);
+
+       free(handle->signal);
+       free(handle);
+
+       return;
+}
+
diff --git a/src/minicontrol-monitor.c b/src/minicontrol-monitor.c
new file mode 100755 (executable)
index 0000000..7a6b6e3
--- /dev/null
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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 <stdlib.h>
+#include <dbus/dbus.h>
+
+#include "minicontrol-error.h"
+#include "minicontrol-internal.h"
+#include "minicontrol-monitor.h"
+#include "minicontrol-log.h"
+
+struct _minicontrol_monitor {
+       minictrl_sig_handle *start_sh;
+       minictrl_sig_handle *stop_sh;
+       minictrl_sig_handle *resize_sh;
+       minicontrol_monitor_cb callback;
+       void *user_data;
+};
+
+static struct _minicontrol_monitor *g_monitor_h;
+
+static minicontrol_priority_e _int_to_priority(unsigned int value)
+{
+       minicontrol_priority_e priority = MINICONTROL_PRIORITY_LOW;
+       switch (value) {
+       case MINICONTROL_PRIORITY_TOP:
+               priority = MINICONTROL_PRIORITY_TOP;
+               break;
+       case MINICONTROL_PRIORITY_MIDDLE:
+               priority = MINICONTROL_PRIORITY_MIDDLE;
+               break;
+       case MINICONTROL_PRIORITY_LOW:
+       default:
+               priority = MINICONTROL_PRIORITY_LOW;
+               break;
+       }
+       return priority;
+}
+
+static void _provider_start_cb(void *data, DBusMessage *msg)
+{
+       DBusError err;
+       char *svr_name = NULL;
+       unsigned int w = 0;
+       unsigned int h = 0;
+       unsigned int pri = 0;
+       minicontrol_priority_e priority;
+       dbus_bool_t dbus_ret;
+
+       dbus_error_init(&err);
+
+       dbus_ret = dbus_message_get_args(msg, &err,
+                               DBUS_TYPE_STRING, &svr_name,
+                               DBUS_TYPE_UINT32, &w,
+                               DBUS_TYPE_UINT32, &h,
+                               DBUS_TYPE_UINT32, &pri,
+                               DBUS_TYPE_INVALID);
+       if (!dbus_ret) {
+               ERR("fail to get args : %s", err.message);
+               dbus_error_free(&err);
+               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);
+
+       dbus_error_free(&err);
+}
+
+static void _provider_stop_cb(void *data, DBusMessage *msg)
+{
+       DBusError err;
+       char *svr_name = NULL;
+       dbus_bool_t dbus_ret;
+
+       dbus_error_init(&err);
+
+       dbus_ret = dbus_message_get_args(msg, &err,
+                               DBUS_TYPE_STRING, &svr_name,
+                               DBUS_TYPE_INVALID);
+       if (!dbus_ret) {
+               ERR("fail to get args : %s", err.message);
+               dbus_error_free(&err);
+               return;
+       }
+
+       if (g_monitor_h->callback)
+               g_monitor_h->callback(MINICONTROL_ACTION_STOP,
+                               svr_name, 0, 0, MINICONTROL_PRIORITY_LOW,
+                               g_monitor_h->user_data);
+
+       dbus_error_free(&err);
+}
+
+static void _provider_resize_cb(void *data, DBusMessage *msg)
+{
+       DBusError err;
+       char *svr_name = NULL;
+       unsigned int w = 0;
+       unsigned int h = 0;
+       unsigned int pri = 0;
+       minicontrol_priority_e priority;
+       dbus_bool_t dbus_ret;
+
+       dbus_error_init(&err);
+
+       dbus_ret = dbus_message_get_args(msg, &err,
+                               DBUS_TYPE_STRING, &svr_name,
+                               DBUS_TYPE_UINT32, &w,
+                               DBUS_TYPE_UINT32, &h,
+                               DBUS_TYPE_UINT32, &pri,
+                               DBUS_TYPE_INVALID);
+       if (!dbus_ret) {
+               ERR("fail to get args : %s", err.message);
+               dbus_error_free(&err);
+               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);
+
+       dbus_error_free(&err);
+}
+
+
+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 *stop_sh;
+               minictrl_sig_handle *resize_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;
+               }
+
+               stop_sh = _minictrl_dbus_sig_handle_attach(
+                               MINICTRL_DBUS_SIG_STOP,
+                               _provider_stop_cb, NULL);
+               if (!start_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;
+               }
+
+               monitor_h = malloc(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(stop_sh);
+                       _minictrl_dbus_sig_handle_dettach(resize_sh);
+                       return MINICONTROL_ERROR_OUT_OF_MEMORY;
+               }
+
+               monitor_h->start_sh = start_sh;
+               monitor_h->stop_sh = stop_sh;
+               monitor_h->resize_sh = resize_sh;
+               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_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->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);
+
+       free(g_monitor_h);
+       g_monitor_h = NULL;
+
+       return MINICONTROL_ERROR_NONE;
+}
+
diff --git a/src/minicontrol-provider.c b/src/minicontrol-provider.c
new file mode 100755 (executable)
index 0000000..306f7bc
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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 <Elementary.h>
+
+#include "minicontrol-error.h"
+#include "minicontrol-type.h"
+#include "minicontrol-internal.h"
+#include "minicontrol-provider.h"
+#include "minicontrol-log.h"
+
+#define MINICTRL_PRIORITY_SUFFIX_TOP "__minicontrol_top"
+#define MINICTRL_PRIORITY_SUFFIX_LOW "__minicontrol_low"
+#define MINICTRL_DATA_KEY "__minictrl_data_internal"
+
+enum {
+       MINICTRL_STATE_READY =0,
+       MINICTRL_STATE_RUNNING,
+};
+
+struct _provider_data {
+       char *name;
+       int state;
+       minicontrol_priority_e priority;
+       Evas_Object *obj;
+       minictrl_sig_handle *sh;
+};
+
+static void __provider_data_free(struct _provider_data *pd)
+{
+       if (pd) {
+               if (pd->name)
+                       free(pd->name);
+
+               if (pd->sh)
+                       _minictrl_dbus_sig_handle_dettach(pd->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;
+
+       if (!data) {
+               ERR("data is NULL");
+               return;
+       }
+       pd = data;
+
+       if (pd->state == MINICTRL_STATE_RUNNING) {
+               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);
+       }
+}
+
+static int minicontrol_win_start(Evas_Object *mincontrol)
+{
+       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) {
+               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_START,
+                                       pd->name, w, h, pd->priority);
+       }
+
+       return ret;
+}
+
+static int minicontrol_win_stop(Evas_Object *mincontrol)
+{
+       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_READY) {
+               pd->state = MINICTRL_STATE_READY;
+               ret = _minictrl_provider_message_send(MINICTRL_DBUS_SIG_STOP,
+                                       pd->name, 0, 0, pd->priority);
+       }
+
+       return ret;
+}
+
+static void _minictrl_win_del(void *data, Evas *e,
+                       Evas_Object *obj, void *event_info)
+{
+       struct _provider_data *pd = NULL;
+
+       minicontrol_win_stop(obj);
+
+       pd = evas_object_data_get(obj, MINICTRL_DATA_KEY);
+       __provider_data_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)
+{
+       minicontrol_win_stop(obj);
+}
+
+static void _minictrl_win_show(void *data, Evas *e,
+                       Evas_Object *obj, void *event_info)
+{
+       minicontrol_win_start(obj);
+}
+
+static void _minictrl_win_resize(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->state == MINICTRL_STATE_RUNNING) {
+               Evas_Coord w = 0;
+               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);
+       }
+}
+
+static char *_minictrl_create_name(const char *name)
+{
+       time_t now;
+       struct tm *now_tm;
+       char time_buf[20]; /* 18 chars to represent time */
+       char *buf;
+       int size = 0;
+
+       if (!name) {
+               ERR("name is NULL, invaild parameter");
+               return NULL;
+       }
+
+       now = time(NULL);
+       now_tm = localtime(&now);
+       strftime(time_buf, sizeof(time_buf), "%y-%m-%d-%H:%M:%S", now_tm);
+
+       size = snprintf(NULL, 0, "[%s]-[%s]", name, time_buf) + 1;
+       buf = (char *)malloc(sizeof(char) * size);
+       if (!buf) {
+              ERR("fail to alloc buf");
+              return NULL;
+       }
+
+       snprintf(buf, size, "[%s]-[%s]", name, time_buf);
+
+       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)
+{
+       Evas_Object *win = NULL;
+       char *name_inter = NULL;
+       struct _provider_data *pd;
+
+       if (!name)
+               return NULL;
+
+       win = elm_win_add(NULL, "minicontrol", ELM_WIN_SOCKET_IMAGE);
+       if (!win)
+               return 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_FALSE)) {
+               ERR("Fail to elm win socket listen");
+               evas_object_del(win);
+               return NULL;
+       }
+
+       pd = malloc(sizeof(struct _provider_data));
+       if (!pd) {
+               ERR("Fail to alloc memory");
+               evas_object_del(win);
+               free(name_inter);
+               return NULL;
+
+       }
+       memset(pd, 0x00, sizeof(struct _provider_data));
+       pd->name = name_inter;
+       pd->state = MINICTRL_STATE_READY;
+       pd->obj = win;
+       pd->priority = _minictrl_get_priroty_by_name(name);
+
+       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_HIDE,
+                                       _minictrl_win_hide, pd);
+
+       evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE,
+                                       _minictrl_win_resize, pd);
+
+       pd->sh = _minictrl_dbus_sig_handle_attach(MINICTRL_DBUS_SIG_RUNNING_REQ,
+                                       _running_req_cb, pd);
+
+       INFO("new minicontrol win[%p] created - %s, priority[%d]",
+                               win, pd->name, pd->priority);
+
+       return win;
+}
+
diff --git a/src/minicontrol-viewer.c b/src/minicontrol-viewer.c
new file mode 100755 (executable)
index 0000000..2a937f7
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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 <Elementary.h>
+#include <Ecore_Evas.h>
+
+#include "minicontrol-internal.h"
+#include "minicontrol-type.h"
+#include "minicontrol-viewer.h"
+#include "minicontrol-log.h"
+
+#define MINICTRL_PLUG_DATA_KEY "__minictrl_plug_name"
+
+static void _minictrl_plug_server_del(Ecore_Evas *ee)
+{
+       char *svr_name = NULL;
+
+       svr_name = ecore_evas_data_get(ee, MINICTRL_PLUG_DATA_KEY);
+       if (!svr_name) {
+               ERR("fail to get svr_name");
+               return;
+       }
+
+       INFO("server - %s is deleted", svr_name);
+
+       /* send message to remve plug */
+       _minictrl_provider_message_send(MINICTRL_DBUS_SIG_STOP,
+                                       svr_name, 0, 0,
+                                       MINICONTROL_PRIORITY_LOW);
+}
+
+static void _minictrl_plug_del(void *data, Evas *e,
+                       Evas_Object *obj, void *event_info)
+{
+       Ecore_Evas *ee = NULL;
+       char *svr_name = NULL;
+
+       ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
+       if (!ee)
+               return;
+
+       svr_name = ecore_evas_data_get(ee, MINICTRL_PLUG_DATA_KEY);
+       if (svr_name)
+               free(svr_name);
+
+       ecore_evas_data_set(ee, MINICTRL_PLUG_DATA_KEY, NULL);
+}
+
+EXPORT_API
+Evas_Object *minicontrol_viewer_image_object_get(const Evas_Object *obj)
+{
+       return elm_plug_image_object_get(obj);
+}
+
+EXPORT_API Evas_Object *minicontrol_viewer_add(Evas_Object *parent,
+                                               const char *svr_name)
+{
+       Evas_Object *plug = NULL;
+       Evas_Object *plug_img = NULL;
+       Ecore_Evas *ee = NULL;
+
+       plug = elm_plug_add(parent);
+       if (!plug) {
+               ERR("fail to create plug");
+               return NULL;
+       }
+
+       if (!elm_plug_connect(plug, svr_name, 0, EINA_FALSE)) {
+               ERR("Cannot connect plug[%s]", svr_name);
+               evas_object_del(plug);
+               return NULL;
+       }
+
+       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_callback_delete_request_set(ee, _minictrl_plug_server_del);
+
+       evas_object_event_callback_add(plug, EVAS_CALLBACK_DEL,
+                                       _minictrl_plug_del, plug);
+
+       return plug;
+}
+