libzone: Add APIs to get zone event 91/71191/7
authorSungbae Yoo <sungbae.yoo@samsung.com>
Tue, 24 May 2016 10:42:08 +0000 (19:42 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Wed, 25 May 2016 08:27:46 +0000 (17:27 +0900)
Change-Id: Ie82ed656d04ea2cd2c094b4846ca496892085091
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
15 files changed:
packaging/device-policy-manager.spec
zone/CMakeLists.txt
zone/cli/CMakeLists.txt [new file with mode: 0644]
zone/cli/zone-admin-cli.cpp [moved from zone/module/zone-admin-cli.cpp with 96% similarity]
zone/libs/CMakeLists.txt
zone/libs/zone/app-proxy.cpp
zone/libs/zone/app-proxy.h
zone/libs/zone/package-proxy.cpp
zone/libs/zone/package-proxy.h
zone/libs/zone/zone.cpp [new file with mode: 0644]
zone/libs/zone/zone.h
zone/module/CMakeLists.txt
zone/setup-wizard/CMakeLists.txt
zone/setup-wizard/include/zone-setup.h
zone/setup-wizard/src/main.c

index b21e759..0b0a804 100644 (file)
@@ -197,7 +197,7 @@ BuildRequires: pkgconfig(efl-extension)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pkgconfig(capi-appfw-application)
 BuildRequires: pkgconfig(evas)
-Requires: libdpm = %{version}-%{release}
+Requires: libzone = %{version}-%{release}
 
 %description -n org.tizen.zone-setup-wizard
 Tizen ZONE setup wizard interface for zone
index 45ed57a..6f120d6 100644 (file)
 
 SET(ZONE_MODULE                  ${DPM_ZONE}/module)
 SET(ZONE_LIBS            ${DPM_ZONE}/libs)
+SET(ZONE_CLI             ${DPM_ZONE}/cli)
 SET(ZONE_SETUP_WIZARD ${DPM_ZONE}/setup-wizard)
 
 ADD_SUBDIRECTORY(${ZONE_MODULE})
-ADD_SUBDIRECTORY(${ZONE_SETUP_WIZARD})
 ADD_SUBDIRECTORY(${ZONE_LIBS})
+ADD_SUBDIRECTORY(${ZONE_CLI})
+ADD_SUBDIRECTORY(${ZONE_SETUP_WIZARD})
diff --git a/zone/cli/CMakeLists.txt b/zone/cli/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1ca3a43
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (c) 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.
+#
+
+PROJECT(zone-cli)
+
+FILE(GLOB ZONE_CLI_SRCS        zone-admin-cli.cpp
+                        ${ZONE_MODULE}/session.cpp
+                        ${ZONE_MODULE}/zone-builder.cpp
+)
+
+SET(ZONE_CLI_NAME "zone-admin-cli")
+
+ADD_EXECUTABLE(${ZONE_CLI_NAME} ${ZONE_CLI_SRCS})
+SET_TARGET_PROPERTIES(${ZONE_CLI_NAME} PROPERTIES PREFIX ""
+    COMPILE_DEFINITIONS PID_FILE_PATH="${RUN_INSTALL_DIR}/zone"
+    COMPILE_FLAGS "-fPIE"
+    LINK_FLAGS "-pie"
+)
+
+PKG_CHECK_MODULES(ZONE_CLI_DEPS  REQUIRED
+                                 glib-2.0
+                                 capi-appfw-package-manager
+                                 capi-appfw-app-manager
+)
+
+INCLUDE_DIRECTORIES(SYSTEM ${ZONE_CLI_DEPS_INCLUDE_DIRS} ${DPM_COMMON} ${ZONE_MODULE} ${ZONE_LIBS})
+TARGET_LINK_LIBRARIES(${ZONE_CLI_NAME} ${ZONE_CLI_DEPS_LIBRARIES} dpm-common zone)
+
+INSTALL(TARGETS ${ZONE_CLI_NAME} DESTINATION sbin)
similarity index 96%
rename from zone/module/zone-admin-cli.cpp
rename to zone/cli/zone-admin-cli.cpp
index 95c05c2..141f942 100644 (file)
@@ -230,12 +230,15 @@ int showPkgInfo(const std::string& name)
 {
     int num = 0;
 
+    zone_manager_h zoneMgr;
     zone_package_proxy_h pkgMgr;
 
-    zone_package_proxy_create(&pkgMgr);
+    zone_manager_create(&zoneMgr);
+    zone_package_proxy_create(zoneMgr, &pkgMgr);
     zone_package_proxy_foreach_package_info(pkgMgr, name.c_str(), PackgeListCallback, &num);
     std::cout << num << " packages are found" << std::endl;
     zone_package_proxy_destroy(pkgMgr);
+    zone_manager_destroy(zoneMgr);
 
     return 0;
 }
@@ -263,7 +266,7 @@ bool ApplicationListCallback(app_info_h info, void *user_data)
     if (checked) {
         std::cout <<" NoDisplay ";
     }
-    std::cout << ")"<<std::endl;
+    std::cout << ")"<< std::endl;
 
     app_info_get_label(info, &val);
     std::cout << "    Label : " << val << std::endl;
@@ -285,12 +288,15 @@ int showAppInfo(const std::string& name)
 {
     int num = 0;
 
+    zone_manager_h zoneMgr;
     zone_app_proxy_h appMgr;
 
-    zone_app_proxy_create(&appMgr);
+    zone_manager_create(&zoneMgr);
+    zone_app_proxy_create(zoneMgr, &appMgr);
     zone_app_proxy_foreach_app_info(appMgr, name.c_str(), ApplicationListCallback, &num);
     std::cout << num << " applications are found" << std::endl;
     zone_app_proxy_destroy(appMgr);
+    zone_manager_destroy(zoneMgr);
 
     return 0;
 }
index 51c5972..d8697f4 100755 (executable)
@@ -23,6 +23,7 @@ SET(PC_FILE "${PROJECT_NAME}.pc")
 SET(SOURCES ${DPM_LIBS}/policy-client.cpp
                        package-proxy.cpp
                        app-proxy.cpp
+                       zone/zone.cpp
                        zone/package-proxy.cpp
                        zone/app-proxy.cpp
 )
index 77aa24a..82055a9 100644 (file)
 
 using namespace DevicePolicyManager;
 
-typedef struct zone_app_proxy_s {
-    std::unique_ptr<DevicePolicyContext> pContext;
-    std::unique_ptr<ZoneAppProxy> pManager;
-} zone_app_proxy_s;
-
 inline ZoneAppProxy* getManager(zone_app_proxy_h handle)
 {
-    return reinterpret_cast<zone_app_proxy_s *>(handle)->pManager.get();
+    return reinterpret_cast<ZoneAppProxy*>(handle);
 }
 
 static app_info_h make_app_info_handle(const ZoneAppProxy::AppInfo& info)
@@ -78,20 +73,13 @@ static app_info_h make_app_info_handle(const ZoneAppProxy::AppInfo& info)
     return reinterpret_cast<app_info_h>(appinfo);
 }
 
-int zone_app_proxy_create(zone_app_proxy_h *manager)
+int zone_app_proxy_create(zone_manager_h manager, zone_app_proxy_h *handle)
 {
     RET_ON_FAILURE(manager, ZONE_ERROR_INVALID_PARAMETER);
+    RET_ON_FAILURE(handle, ZONE_ERROR_INVALID_PARAMETER);
 
-    zone_app_proxy_s* handle = new(std::nothrow) zone_app_proxy_s();
-
-    handle->pContext.reset(new(std::nothrow) DevicePolicyContext());
-    if (handle->pContext->connect() < 0) {
-        delete handle;
-        return ZONE_ERROR_CONNECTION_REFUSED;
-    }
-
-    handle->pManager.reset(handle->pContext->createPolicyInterface<ZoneAppProxy>());
-    *manager = reinterpret_cast<zone_app_proxy_h>(handle);
+    auto& client = GetDevicePolicyContext(manager);
+    *handle = reinterpret_cast<zone_app_proxy_h*>(client.createPolicyInterface<ZoneAppProxy>());
 
     return ZONE_ERROR_NONE;
 }
@@ -100,7 +88,8 @@ int zone_app_proxy_destroy(zone_app_proxy_h handle)
 {
     RET_ON_FAILURE(handle, ZONE_ERROR_INVALID_PARAMETER);
 
-    delete reinterpret_cast<zone_app_proxy_s *>(handle);
+    delete reinterpret_cast<ZoneAppProxy*>(handle);
+
     return ZONE_ERROR_NONE;
 }
 
index b477a83..cddd9c5 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <app_info.h>
 #include <app_manager.h>
+
 #include <zone/zone.h>
 
 /**
@@ -48,19 +49,17 @@ typedef void* zone_app_proxy_h;
  * @details     This API acquires zone application manager handle required to call
  *              the zone application manager APIs.
  * @since_tizen 3.0
- * @param[in]   handle Device policy manager context handle
- * @return      Zone application manager handle on success, otherwise NULL
- * @remark      The specific error code can be obtained by using the
- *              get_last_result() method. Error codes are described in
- *              exception section.
- * @exception   #ZONE_ERROR_NONE No error
- * @exception   #ZONE_ERROR_CONNECTION_REFUSED Connection refused
- * @exception   #ZONE_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception   #ZONE_ERROR_TIMED_OUT Time out
+ * @param[in]   manager The zone manager handle
+ * @param[out]  handle The zone app proxy handle
+ * @return      #ZONE_ERROR_NONE on success, otherwise a negative value
+ * @retval      #ZONE_ERROR_NONE Successful
+ * @retval      #ZONE_ERROR_CONNECTION_REFUSED Connection refused
+ * @retval      #ZONE_ERROR_TIMED_OUT Time out
+ * @see         zone_manager_create()
  * @see         zone_app_proxy_create()
  * @see         get_last_result()
  */
-ZONE_API int zone_app_proxy_create(zone_app_proxy_h* handle);
+ZONE_API int zone_app_proxy_create(zone_manager_h manager, zone_app_proxy_h* handle);
 
 /**
  * @brief       Releases the zone application manager handle
index b2cad09..3610dca 100644 (file)
@@ -35,7 +35,6 @@
 using namespace DevicePolicyManager;
 
 typedef struct zone_package_proxy_s {
-    std::unique_ptr<DevicePolicyContext> pContext;
     std::unique_ptr<ZonePackageProxy> pManager;
     pkgmgr_client* pNativeHandle;
     zone_package_proxy_event_cb pCallback;
@@ -175,20 +174,15 @@ static package_info_h make_package_info_handle(const ZonePackageProxy::PackageIn
     return reinterpret_cast<package_info_h>(packageinfo);
 }
 
-int zone_package_proxy_create(zone_package_proxy_h *handle)
+int zone_package_proxy_create(zone_manager_h manager, zone_package_proxy_h *handle)
 {
+    RET_ON_FAILURE(manager, ZONE_ERROR_INVALID_PARAMETER);
     RET_ON_FAILURE(handle, ZONE_ERROR_INVALID_PARAMETER);
 
     zone_package_proxy_s* instance = new zone_package_proxy_s;
 
-    instance->pContext.reset(new(std::nothrow) DevicePolicyContext());
-
-    if (instance->pContext->connect() < 0) {
-        delete handle;
-        return ZONE_ERROR_CONNECTION_REFUSED;
-    }
-
-    instance->pManager.reset(instance->pContext->createPolicyInterface<ZonePackageProxy>());
+    instance->pManager.reset(GetDevicePolicyContext(manager).
+                                createPolicyInterface<ZonePackageProxy>());
 
     instance->pNativeHandle = ::pkgmgr_client_new(PC_LISTENING);
 
@@ -205,6 +199,7 @@ int zone_package_proxy_destroy(zone_package_proxy_h handle)
     ::pkgmgr_client_free(instance->pNativeHandle);
 
     delete instance;
+
     return ZONE_ERROR_NONE;
 }
 
index d1f3f0d..61070ff 100644 (file)
@@ -49,19 +49,17 @@ typedef void* zone_package_proxy_h;
  * @details     This API acquires zone package proxy handle required to call
  *              the zone package_manager APIs.
  * @since_tizen 3.0
- * @param[in]   handle The zone package proxy handle
- * @return      Zone package proxy handle on success, otherwise NULL
- * @remark      The specific error code can be obtained by using the
- *              get_last_result() method. Error codes are described in
- *              exception section.
- * @exception   #ZONE_ERROR_NONE No error
- * @exception   #ZONE_ERROR_CONNECTION_REFUSED Connection refused
- * @exception   #ZONE_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception   #ZONE_ERROR_TIMED_OUT Time out
+ * @param[in]   manager The zone manager handle
+ * @param[out]  handle The zone package proxy handle
+ * @return      #ZONE_ERROR_NONE on success, otherwise a negative value
+ * @retval      #ZONE_ERROR_NONE Successful
+ * @retval      #ZONE_ERROR_CONNECTION_REFUSED Connection refused
+ * @retval      #ZONE_ERROR_TIMED_OUT Time out
+ * @see         zone_manager_create()
  * @see         zone_package_proxy_destroy()
  * @see         get_last_result()
  */
-ZONE_API int zone_package_proxy_create(zone_package_proxy_h *handle);
+ZONE_API int zone_package_proxy_create(zone_manager_h manager, zone_package_proxy_h *handle);
 
 /**
  * @brief       Releases the zone package proxy handle.
diff --git a/zone/libs/zone/zone.cpp b/zone/libs/zone/zone.cpp
new file mode 100644 (file)
index 0000000..c800196
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ *  Copyright (c) 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 "zone/zone.h"
+
+#include "error.h"
+#include "debug.h"
+#include "policy-client.h"
+
+DevicePolicyContext& GetDevicePolicyContext(void* handle)
+{
+    return *reinterpret_cast<DevicePolicyContext*>(handle);
+}
+
+int zone_manager_create(zone_manager_h* handle)
+{
+    RET_ON_FAILURE(handle, ZONE_ERROR_INVALID_PARAMETER);
+
+    DevicePolicyContext* client = new(std::nothrow) DevicePolicyContext();
+
+    RET_ON_FAILURE(handle, ZONE_ERROR_CONNECTION_REFUSED);
+
+    if (client->connect() < 0) {
+        delete client;
+        RET_ON_FAILURE(handle, ZONE_ERROR_CONNECTION_REFUSED);
+    }
+
+    *handle = reinterpret_cast<zone_manager_h>(client);
+
+    return ZONE_ERROR_NONE;
+}
+
+int zone_manager_destroy(zone_manager_h handle)
+{
+    RET_ON_FAILURE(handle, ZONE_ERROR_INVALID_PARAMETER);
+
+    delete &GetDevicePolicyContext(handle);
+
+    return ZONE_ERROR_NONE;
+}
+
+int zone_manager_add_event_cb(zone_manager_h handle, const char* event, zone_event_cb callback, void* user_data, int *id)
+{
+    RET_ON_FAILURE(handle, ZONE_ERROR_INVALID_PARAMETER);
+    RET_ON_FAILURE(event, ZONE_ERROR_INVALID_PARAMETER);
+    RET_ON_FAILURE(callback, ZONE_ERROR_INVALID_PARAMETER);
+
+    auto& context = GetDevicePolicyContext(handle);
+    int ret = context.subscribeSignal(std::string("ZonePolicy::") +event,
+                                      callback, user_data);
+    if (ret < 0)
+        return ZONE_ERROR_INVALID_PARAMETER;
+
+    *id = ret;
+    return ZONE_ERROR_NONE;
+}
+
+int zone_manager_remove_event_cb(zone_manager_h handle, int callback_id)
+{
+    RET_ON_FAILURE(handle, ZONE_ERROR_INVALID_PARAMETER);
+    RET_ON_FAILURE(callback_id >= 0, ZONE_ERROR_INVALID_PARAMETER);
+
+    auto& context = *reinterpret_cast<DevicePolicyContext*>(handle);
+    int ret =  context.unsubscribeSignal(callback_id);
+    if (ret)
+        return ZONE_ERROR_INVALID_PARAMETER;
+
+    return ZONE_ERROR_NONE;
+}
index 88702b1..e4b13fc 100644 (file)
@@ -41,6 +41,11 @@ extern "C" {
 #endif
 
 /**
+ * @addtogroup  CAPI_ZONE_ZONE_MODULE
+ * @{
+ */
+
+/**
  * @brief       Enumeration of device policy API errors
  * @since_tizen 3.0
  */
@@ -56,6 +61,108 @@ typedef enum {
     ZONE_ERROR_OUT_OF_MEMORY        = TIZEN_ERROR_OUT_OF_MEMORY         /**< Out of memory */
 } zone_error_type_e;
 
+/**
+ * @brief       The zone manager handle
+ * @details     The zone manager  handle is an abstraction of the
+ *              logical connection between the zone manager and it's client.
+ *              The zone manager handle must be created by using
+ *              zone_manager_create() before attempting to use almost any of
+ *              the zone related APIs, and it should be freed when interaction
+ *              with the zone manager is no longer required.
+ *              To release the handle, use zone_manager_destroy().
+ * @since_tizen 3.0
+ * @see         zone_manager_create()
+ * @see         zone_manager_destroy()
+ */
+typedef void* zone_manager_h;
+
+/**
+ * @brief       Creates the zone manager handle.
+ * @details     This API creates zone manager handle required to
+ *              the zone related APIs.
+ *              This API is also used to verify whether caller is authorized
+ *              or not.
+ * @since_tizen 3.0
+ * @param[out]  handle The zone manager handle
+ * @return      #ZONE_ERROR_NONE on success, otherwise a negative value
+ * @retval      #ZONE_ERROR_NONE Successful
+ * @retval      #ZONE_ERROR_CONNECTION_REFUSED Connection refused
+ * @retval      #ZONE_ERROR_TIMED_OUT Time out
+ * @see         zone_manager_destroy()
+ * @see         get_last_result()
+ */
+ZONE_API int zone_manager_create(zone_manager_h *handle);
+
+/**
+ * @brief       Releases the zone manager handle.
+ * @details     This API must be called if interaction with the zone manager is
+ *              no longer required.
+ * @since_tizen 3.0
+ * @param[in]   handle The zone manager handle
+ * @return      #ZONE_ERROR_NONE on success, otherwise a negative value
+ * @retval      #ZONE_ERROR_NONE Successful
+ * @retval      #ZONE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by zone_manager_create()
+ * @see         zone_manager_create()
+ */
+ZONE_API int zone_manager_destroy(zone_manager_h handle);
+
+/**
+ * @brief       Called when a zone raises a event.
+ * @since_tizen 3.0
+ * @param[in]   name The zone name
+ * @param[in]   object The object name triggered the event
+ * @param[in]   user_data The user data passed from zone_manager_add_event_cb
+ * @see         zone_manager_add_event_cb()
+ * @see         zone_manager_remove_event_cb()
+ */
+typedef void(*zone_event_cb)(const char* name, const char* object, void *user_data);
+
+/**
+ * @brief       Adds zone event callback.
+ * @details     This API can be used to receive events sent by zone
+ *              The callback specified to this function is automatically called when
+ *              the zone is created or removed.
+ * @since_tizen 3.0
+ * @param[in]   context The zone_manager handle
+ * @param[in]   event The event name to receive
+ * @param[in]   callback The event callback
+ * @param[in]   user_data The user data passed to the callback function
+ * @param[out]  id Signal identifier
+ * @return      #ZONE_ERROR_NONE on success, otherwise a negative value
+ * @retval      #ZONE_ERROR_NONE Successful
+ * @retval      #ZONE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #ZONE_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by zone_manager_create().
+ * @see         zone_manager_create()
+ * @see         zone_manager_destroy()
+ * @see         zone_manager_remove_event_cb()
+ */
+ZONE_API int zone_manager_add_event_cb(zone_manager_h handle,
+                                      const char* event,
+                                      zone_event_cb callback, void* user_data,
+                                      int* id);
+
+/**
+ * @brief       Removes zone event callback.
+ * @details     This API removes zone event callback
+ * @since_tizen 3.0
+ * @param[in]   context The zone manager handle
+ * @param[in]   id Signal identifier
+ * @return      #ZONE_ERROR_NONE on success, otherwise a negative value
+ * @retval      #ZONE_ERROR_NONE Successful
+ * @retval      #ZONE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #ZONE_ERROR_TIMED_OUT Time out
+ * @pre         The context must be created by zone_manager_create().
+ * @see         zone_manager_create()
+ * @see         zone_manager_destroy()
+ * @see         zone_manager_add_event_cb()
+ */
+ZONE_API int zone_manager_remove_event_cb(zone_manager_h handle, int id);
+
+/**
+ * @}
+ */
 
 #ifdef __cplusplus
 }
index 0399565..b177177 100644 (file)
@@ -21,11 +21,6 @@ FILE(GLOB ZONE_PAM_SRCS               zone-builder.cpp
                                                         zone.cpp
 )
 
-FILE(GLOB ZONE_CLI_SRCS                 zone-builder.cpp
-                                                        session.cpp
-                                                        zone-admin-cli.cpp
-)
-
 SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack")
 
 SET(ZONE_PAM_NAME "pam_zone")
@@ -53,24 +48,3 @@ TARGET_COMPILE_DEFINITIONS(${ZONE_PAM_NAME} PRIVATE
 INSTALL(TARGETS ${ZONE_PAM_NAME} DESTINATION ${LIB_INSTALL_DIR}/security)
 INSTALL(FILES data/DefaultZoneManifest.xml DESTINATION ${CONF_INSTALL_DIR}/zone RENAME owner.xml)
 INSTALL(FILES pam.d/systemd-user-zone DESTINATION ${PAMD_INSTALL_DIR})
-
-
-
-SET(ZONE_CLI_NAME "zone-admin-cli")
-ADD_EXECUTABLE(${ZONE_CLI_NAME} ${ZONE_CLI_SRCS})
-SET_TARGET_PROPERTIES(${ZONE_CLI_NAME} PROPERTIES PREFIX ""
-    COMPILE_DEFINITIONS PID_FILE_PATH="${RUN_INSTALL_DIR}/zone"
-    COMPILE_FLAGS "-fPIE"
-    LINK_FLAGS "-pie"
-)
-
-PKG_CHECK_MODULES(ZONE_CLI_DEPS  REQUIRED
-                                 glib-2.0
-                                 capi-appfw-package-manager
-                                 capi-appfw-app-manager
-)
-
-INCLUDE_DIRECTORIES(SYSTEM ${ZONE_CLI_DEPS_INCLUDE_DIRS} ${DPM_COMMON} ${DPM_POLICY} ${DPM_LIBS} ${ZONE_LIBS})
-TARGET_LINK_LIBRARIES(${ZONE_CLI_NAME} ${ZONE_CLI_DEPS_LIBRARIES} dpm-common zone)
-
-INSTALL(TARGETS ${ZONE_CLI_NAME} DESTINATION sbin)
index 77b6b99..fe2cb4f 100644 (file)
@@ -13,7 +13,7 @@ PKG_CHECK_MODULES(tools_pkgs REQUIRED   dlog
                                         evas
 )
 
-INCLUDE_DIRECTORIES(${tools_pkgs_INCLUDE_DIRS} ${DPM_LIBS})
+INCLUDE_DIRECTORIES(${tools_pkgs_INCLUDE_DIRS} ${ZONE_LIBS})
 LINK_DIRECTORIES(${tools_pkgs_LIBRARY_DIRS})
 
 SET(PKG_NAME "${PROJECT_NAME}")
@@ -28,7 +28,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
 ADD_EXECUTABLE(${PKG_NAME} ${PKG_SRC})
 INSTALL(TARGETS ${PKG_NAME} DESTINATION ${APP_INSTALL_PREFIX}/${PKG_NAME}/bin)
 
-TARGET_LINK_LIBRARIES(${PKG_NAME} ${tools_pkgs_LIBRARIES} dpm)
+TARGET_LINK_LIBRARIES(${PKG_NAME} ${tools_pkgs_LIBRARIES} zone)
 
 #Create edj file
 ADD_CUSTOM_TARGET(org.tizen.zone-setup-wizard.edj
index 33569ca..013614f 100644 (file)
@@ -29,7 +29,7 @@
 #include <dlog.h>
 #include <Elementary.h>
 #include <efl_extension.h>
-#include <dpm/zone.h>
+#include <zone/zone.h>
 
 #ifdef  LOG_TAG
 #undef  LOG_TAG
@@ -46,8 +46,8 @@
 typedef struct {
        char *zone_name;
        char *provision_path;
-       dpm_context_h dpm_client;
-       int dpm_zone_signal_cb_id;
+       zone_manager_h zone_manager;
+       int zone_event_cb_id;
        bool create_done;
 } appdata_s;
 
index 3f618e3..c7dc7fe 100644 (file)
@@ -44,9 +44,9 @@ static void __app_terminate(void *data)
 {
        appdata_s *ad = (appdata_s *) data;
 
-       dpm_context_remove_signal_cb(ad->dpm_client, ad->dpm_zone_signal_cb_id);
-       dpm_context_destroy(ad->dpm_client);
-       ad->dpm_client = NULL;
+       zone_manager_remove_event_cb(ad->zone_manager, ad->zone_event_cb_id);
+       zone_manager_destroy(ad->zone_manager);
+       ad->zone_manager = NULL;
        return ;
 }
 
@@ -67,18 +67,18 @@ static void __app_control(app_control_h app_control, void *data)
                ui_app_exit();
        }
 
-       ad->dpm_client = dpm_context_create();
-       if (ad->dpm_client == NULL) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "failed to get dpm client");
+       ret = zone_manager_create(&ad->zone_manager);
+       if (ret != ZONE_ERROR_NONE) {
+               dlog_print(DLOG_ERROR, LOG_TAG, "failed to get zone manager handle");
                ui_app_exit();
        }
 
-       if (dpm_context_add_signal_cb(ad->dpm_client, "ZonePolicy::created", __create_zone_done, ad, &id) != DPM_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to add zone signal callback");
+       if (zone_manager_add_event_cb(ad->zone_manager, "created", __create_zone_done, ad, &id) != ZONE_ERROR_NONE) {
+               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to add zone event callback");
                ui_app_exit();
        }
 
-       ad->dpm_zone_signal_cb_id = id;
+       ad->zone_event_cb_id = id;
 
        elm_app_base_scale_set(1.8);
        _create_base_window(ad);