Merge Version 0.5.5 91/45291/1 accepted/tizen/mobile/20150810.043507 accepted/tizen/tv/20150810.043544 submit/tizen_mobile/20150810.020750 submit/tizen_tv/20150810.020506
authorMu-Woong <muwoong.lee@samsung.com>
Tue, 4 Aug 2015 11:58:24 +0000 (20:58 +0900)
committerMu-Woong <muwoong.lee@samsung.com>
Tue, 4 Aug 2015 11:58:24 +0000 (20:58 +0900)
- Remove unnecessary dependency to pkgmgr-info
- Disable internal 'dbus call' trigger action api
- Add an internal function to set 'dbus call' action

Change-Id: I8ba890181055753371538192e824645a87d21704
Signed-off-by: Mu-Woong <muwoong.lee@samsung.com>
CMakeLists.txt
include/context_trigger_internal.h [new file with mode: 0644]
include/context_trigger_types_internal.h
packaging/context.spec
src/context_trigger.cpp

index 888350bd9cf85359d9a79d867cd161f183583b35..d8935ad5b19bd78f3450b2ce606118a0fb6f5a33 100644 (file)
@@ -10,7 +10,7 @@ FILE(GLOB_RECURSE SRCS src/*.cpp)
 MESSAGE("Sources: ${SRCS}")
 
 # Dependencies
-SET(DEPS "aul bundle pkgmgr-info capi-appfw-app-control context-common")
+SET(DEPS "aul bundle capi-appfw-app-control context-common")
 
 # Common Options
 INCLUDE(FindPkgConfig)
@@ -37,7 +37,9 @@ SET_TARGET_PROPERTIES(${target} PROPERTIES VERSION ${FULLVER})
 INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries)
 INSTALL(
        DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/context-service
-       FILES_MATCHING PATTERN "*.h"
+       FILES_MATCHING
+       PATTERN "context_trigger_internal.h" EXCLUDE
+       PATTERN "*.h"
 )
 
 SET(VERSION ${FULLVER})
diff --git a/include/context_trigger_internal.h b/include/context_trigger_internal.h
new file mode 100644 (file)
index 0000000..93f24f3
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * 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 __TIZEN_CONTEXT_CONTEXT_TRIGGER_INTERNAL_H__
+#define __TIZEN_CONTEXT_CONTEXT_TRIGGER_INTERNAL_H__
+
+#include <context_trigger.h>
+
+/**
+ * @brief              Sets a D-Bus method call as the action of a rule.
+ * @since_tizen 2.4
+ *
+ * @param[in]  rule                    The rule to set the action on
+ * @param[in]  bus_name                Destination remote bus name
+ * @param[in]  object_path             Path of the remote object
+ * @param[in]  interface_name  D-Bus interface to invoke method on
+ * @param[in]  method_name             The name of the method to invoke
+ * @param[in]  user_data               A user-defined string to be delivered as the first parameter of the method.
+ *                                                             @c NULL if not passing any values.
+ *
+ * @return             0 on success, otherwise a negative error value
+ * @retval             #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
+ * @retval             #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval             #CONTEXT_TRIGGER_ERROR_PERMISSION_DENIED        Permission denied
+ * @retval             #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
+ * @retval             #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
+ */
+int context_trigger_rule_set_action_dbus_call(context_trigger_rule_h rule,
+               const char *bus_name, const char *object_path, const char *interface_name,
+               const char *method_name, const char *user_data);
+
+#endif
index 90b480375a07f769ef38b40bba14fc406c57dc52..94e5e0fbd455c9b33b4b0e9ee7d2918d27ea817a 100644 (file)
@@ -29,6 +29,7 @@
 
 #define CT_RULE_ACTION_TYPE_APP_CONTROL "app_control"
 #define CT_RULE_ACTION_TYPE_NOTIFICATION "notification"
+#define CT_RULE_ACTION_TYPE_DBUS_CALL "dbus_call"
 
 #define CT_RULE_ID "ID"
 #define CT_RULE_DESCRIPTION "DESCRIPTION"
 #define CT_RULE_ACTION_NOTI_CONTENT "ACTION_NOTI_CONTENT"
 #define CT_RULE_ACTION_NOTI_ICON_PATH "ACTION_NOTI_ICON_PATH"
 
+#define CT_RULE_ACTION_DBUS_NAME               "ACTION_DBUS_NAME"
+#define CT_RULE_ACTION_DBUS_OBJECT             "ACTION_DBUS_OBJ"
+#define CT_RULE_ACTION_DBUS_INTERFACE  "ACTION_DBUS_IFACE"
+#define CT_RULE_ACTION_DBUS_METHOD             "ACTION_DBUS_METHOD"
+#define CT_RULE_ACTION_DBUS_USER_DATA  "ACTION_DBUS_USERDATA"
+
 #define CT_RESPONSE "RES"
 
 #define        CT_EVENT_TIME "timer/event"
index c924694d1e0a8d03019ad30dba37dc5e11fbb143..56d5752ce187f601bd010773d3b2bbf03975d079 100644 (file)
@@ -1,6 +1,6 @@
 Name:       context
 Summary:    Tizen Context Framework Native API
-Version:    0.5.3
+Version:    0.5.5
 Release:    1
 Group:      System/API
 License:    Apache-2.0
@@ -10,7 +10,6 @@ BuildRequires: cmake
 BuildRequires: pkgconfig(aul)
 BuildRequires: pkgconfig(bundle)
 BuildRequires: pkgconfig(capi-appfw-app-control)
-BuildRequires: pkgconfig(pkgmgr-info)
 BuildRequires: pkgconfig(context-common)
 
 %description
index 9b1f8f4eaa1d4cefd85fcad0893d542ac0d4a7d3..dbf366dd147c09702349cd92573fb766fcc8a258 100644 (file)
@@ -22,6 +22,7 @@
 #include <bundle.h>
 #include <bundle_internal.h>
 #include <context_trigger.h>
+#include <context_trigger_internal.h>
 #include <context_trigger_types_internal.h>
 #include <request_handler.h>
 #include "rule_validator.h"
@@ -431,6 +432,29 @@ EXTAPI int context_trigger_rule_set_action_notification(context_trigger_rule_h r
        return CONTEXT_TRIGGER_ERROR_NONE;
 }
 
+#if 0
+EXTAPI int context_trigger_rule_set_action_dbus_call(context_trigger_rule_h rule,
+               const char *bus_name, const char *object_path, const char *interface_name, const char *method_name, const char *user_data)
+{
+       ASSERT_NOT_NULL(rule && bus_name && object_path && interface_name && method_name);
+
+       // if action arleady exists
+       std::string type;
+       if ((rule->jrule).get(CT_RULE_DETAILS "." CT_RULE_ACTION, CT_RULE_ACTION_TYPE, &type))
+               return CONTEXT_TRIGGER_ERROR_INVALID_RULE;
+
+       // Set D-Bus info
+       (rule->jrule).set(CT_RULE_DETAILS "." CT_RULE_ACTION, CT_RULE_ACTION_TYPE, CT_RULE_ACTION_TYPE_DBUS_CALL);
+       (rule->jrule).set(CT_RULE_DETAILS "." CT_RULE_ACTION, CT_RULE_ACTION_DBUS_NAME, bus_name);
+       (rule->jrule).set(CT_RULE_DETAILS "." CT_RULE_ACTION, CT_RULE_ACTION_DBUS_OBJECT, object_path);
+       (rule->jrule).set(CT_RULE_DETAILS "." CT_RULE_ACTION, CT_RULE_ACTION_DBUS_INTERFACE, interface_name);
+       (rule->jrule).set(CT_RULE_DETAILS "." CT_RULE_ACTION, CT_RULE_ACTION_DBUS_METHOD, method_name);
+       (rule->jrule).set(CT_RULE_DETAILS "." CT_RULE_ACTION, CT_RULE_ACTION_DBUS_USER_DATA, (user_data ? user_data : ""));
+
+       return CONTEXT_TRIGGER_ERROR_NONE;
+}
+#endif
+
 // Set description
 EXTAPI int context_trigger_rule_set_description(context_trigger_rule_h rule, const char* description)
 {