[Trigger] Deprecate several contextual event/condition item 41/125241/6
authorSomin Kim <somin926.kim@samsung.com>
Fri, 14 Apr 2017 08:09:47 +0000 (17:09 +0900)
committerSomin Kim <somin926.kim@samsung.com>
Tue, 18 Apr 2017 07:30:42 +0000 (16:30 +0900)
Change-Id: Idd427e6f511a0be5e1ea2ee22e21c37e2ad3a57b
Signed-off-by: Somin Kim <somin926.kim@samsung.com>
include/context_trigger.h
src/context_trigger.cpp

index 9e83478..bd72b46 100644 (file)
@@ -90,10 +90,8 @@ extern "C" {
 
 /**
  * @brief      Definition for the attribute key denoting "time of day".
- * @details    This can be used as a key of context_trigger_rule_entry_add_option_string(),
- *                     or left operands of context_trigger_rule_entry_add_comparison_int().@n
- *                     When being used as option, it is time interval of the day. For example, "13-15" denotes "from 1 PM to 3 PM".
- *                     When being used with #CONTEXT_TRIGGER_EVENT_TIME or #CONTEXT_TRIGGER_CONDITION_TIME, it's unit is "minute",
+ * @details    This can be used as left operands of context_trigger_rule_entry_add_comparison_int().@n
+ *                     When being used with #CONTEXT_TRIGGER_CONDITION_TIME, it's unit is "minute",
  *                     the valid range of the corresponding right operands is thus from 0 (12:00 AM) to 1439 (11:59 PM).
  * @since_tizen 2.4
  */
@@ -101,8 +99,7 @@ extern "C" {
 
 /**
  * @brief      Definition for the attribute key denoting "day of week".
- * @details    This can be used as a key of context_trigger_rule_entry_add_option_string(),
- *                     or left operands of context_trigger_rule_entry_add_comparison_string().@n
+ * @details    This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     As the right operands of this attribute, one of the following values are allowed:
  *                     #CONTEXT_TRIGGER_MON, #CONTEXT_TRIGGER_TUE, #CONTEXT_TRIGGER_WED, #CONTEXT_TRIGGER_THU, #CONTEXT_TRIGGER_FRI,
  *                     #CONTEXT_TRIGGER_SAT, #CONTEXT_TRIGGER_SUN, #CONTEXT_TRIGGER_WEEKDAY, and #CONTEXT_TRIGGER_WEEKEND.
@@ -162,6 +159,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_STATE "State"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute key denoting "BSSID".
  * @details    This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find available right operands.
@@ -194,6 +192,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_ACCURACY "Accuracy"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute key denoting "medium".
  * @details    This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find available right operands.
@@ -210,6 +209,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_PLACE_ID "PlaceId"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute key denoting "application id".
  * @details    This can be used as a key of context_trigger_rule_entry_add_option_string().@n
  *                     See the programming guide to find the corresponding trigger events.
@@ -218,6 +218,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_APP_ID "AppId"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute key denoting "address".
  * @details    This can be used as a key of context_trigger_rule_entry_add_option_string(),
  *                     or context_trigger_rule_entry_add_comparison_string().@n
@@ -227,6 +228,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_ADDRESS "Address"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute key denoting "rank".
  * @details    This can be used as left operands of context_trigger_rule_entry_add_comparison_int().@n
  *                     See the programming guide to find available right operands.
@@ -235,6 +237,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_RANK "Rank"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute key denoting "total count".
  * @details    This can be used as left operands of context_trigger_rule_entry_add_comparison_int().@n
  *                     See the programming guide to find available right operands.
@@ -307,8 +310,7 @@ extern "C" {
 
 /**
  * @brief      Definition for the attribute value denoting Weekdays.
- * @details    This can be used as a value of context_trigger_rule_entry_add_option_string()
- *                     or right operands of context_trigger_rule_entry_add_comparison_string().@n
+ * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding option keys or left operand attribute keys.
  * @since_tizen 2.4
  */
@@ -316,8 +318,7 @@ extern "C" {
 
 /**
  * @brief      Definition for the attribute value denoting Weekends.
- * @details    This can be used as a value of context_trigger_rule_entry_add_option_string()
- *                     or right operands of context_trigger_rule_entry_add_comparison_string().@n
+ * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding option keys or left operand attribute keys.
  * @since_tizen 2.4
  */
@@ -388,6 +389,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_SEARCHING "Searching"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute value denoting the "connecting" state.
  * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding left operand attribute keys.
@@ -412,6 +414,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_UNCONNECTED "Unconnected"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute value denoting the "idle" state.
  * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding left operand attribute keys.
@@ -420,6 +423,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_IDLE "Idle"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute value denoting the "voice" type.
  * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding left operand attribute keys.
@@ -428,6 +432,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_VOICE "Voice"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute value denoting the "video" type.
  * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding left operand attribute keys.
@@ -452,6 +457,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_BLUETOOTH "Bluetooth"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute value denoting the "received" event.
  * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding left operand attribute keys.
@@ -460,6 +466,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_RECEIVED "Received"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute value denoting the "sent" event.
  * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding left operand attribute keys.
@@ -468,6 +475,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_SENT "Sent"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute value denoting the "SMS" type.
  * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding left operand attribute keys.
@@ -476,6 +484,7 @@ extern "C" {
 #define CONTEXT_TRIGGER_SMS "SMS"
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief      Definition for the attribute value denoting the "MMS" type.
  * @details    This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
  *                     See the programming guide to find the corresponding left operand attribute keys.
@@ -556,17 +565,17 @@ typedef enum {
  * @since_tizen 2.4
  */
 typedef enum {
-       CONTEXT_TRIGGER_EVENT_TIME              = 0x10001,      /**< At certain times of day and days of week @n Privilege: http://tizen.org/privilege/alarm.set */
+       CONTEXT_TRIGGER_EVENT_TIME              = 0x10001,      /**< At certain times of day and days of week @n Privilege: http://tizen.org/privilege/alarm.set (Deprecated since 4.0) */
        CONTEXT_TRIGGER_EVENT_BATTERY   = 0x10100,      /**< Battery level changed */
        CONTEXT_TRIGGER_EVENT_CHARGER,                          /**< Charger connected/disconnected */
        CONTEXT_TRIGGER_EVENT_GPS,                                      /**< GPS state changed */
        CONTEXT_TRIGGER_EVENT_HEADPHONE,                        /**< Headphone connected/disconnected */
        CONTEXT_TRIGGER_EVENT_USB,                                      /**< USB connected/disconnected */
        CONTEXT_TRIGGER_EVENT_WIFI,                                     /**< WiFi state changed @n Privilege: http://tizen.org/privilege/network.get */
-       CONTEXT_TRIGGER_EVENT_POWER_SAVING_MODE = 0x10200,      /**< Power saving mode enabled/disabled */
-       CONTEXT_TRIGGER_EVENT_CALL              = 0x10300,      /**< Call state changed @n Privilege: http://tizen.org/privilege/telephony */
-       CONTEXT_TRIGGER_EVENT_EMAIL,                            /**< Email sent/received */
-       CONTEXT_TRIGGER_EVENT_MESSAGE,                          /**< Message sent/received @n Privilege: http://tizen.org/privilege/message.read */
+       CONTEXT_TRIGGER_EVENT_POWER_SAVING_MODE = 0x10200,      /**< Power saving mode enabled/disabled (Deprecated since 4.0) */
+       CONTEXT_TRIGGER_EVENT_CALL              = 0x10300,      /**< Call state changed @n Privilege: http://tizen.org/privilege/telephony (Deprecated since 4.0) */
+       CONTEXT_TRIGGER_EVENT_EMAIL,                            /**< Email sent/received (Deprecated since 4.0) */
+       CONTEXT_TRIGGER_EVENT_MESSAGE,                          /**< Message sent/received @n Privilege: http://tizen.org/privilege/message.read (Deprecated since 4.0) */
        CONTEXT_TRIGGER_EVENT_CONTACTS,                         /**< Contacts changed (Since 3.0) @n Privilege: http://tizen.org/privilege/contact.read */
        CONTEXT_TRIGGER_EVENT_ACTIVITY_STATIONARY       = 0x10400,      /**< 'Stationary' activity detected */
        CONTEXT_TRIGGER_EVENT_ACTIVITY_WALKING,         /**< 'Walking' activity detected */
@@ -587,12 +596,12 @@ typedef enum {
        CONTEXT_TRIGGER_CONDITION_HEADPHONE,                    /**< Headphone connection */
        CONTEXT_TRIGGER_CONDITION_USB,                                  /**< USB connection */
        CONTEXT_TRIGGER_CONDITION_WIFI,                                 /**< WiFi state @n Privilege: http://tizen.org/privilege/network.get */
-       CONTEXT_TRIGGER_CONDITION_POWER_SAVING_MODE     = 0x20200,      /**< Power saving mode setting */
-       CONTEXT_TRIGGER_CONDITION_CALL          = 0x20300,      /**< Call state @n Privilege: http://tizen.org/privilege/telephony */
-       CONTEXT_TRIGGER_CONDITION_APP_USE_FREQUENCY     = 0x20600,      /**< Frequency of app use @n Privilege: http://tizen.org/privilege/apphistory.read  */
-       CONTEXT_TRIGGER_CONDITION_COMMUNICATION_FREQUENCY,              /**< Frequency of communication via call or message @n Privilege: http://tizen.org/privilege/callhistory.read */
-       CONTEXT_TRIGGER_CONDITION_MUSIC_PLAYBACK_FREQUENCY,             /**< Frequency of music playback @n Privilege: http://tizen.org/privilege/mediahistory.read */
-       CONTEXT_TRIGGER_CONDITION_VIDEO_PLAYBACK_FREQUENCY,             /**< Frequency of video playback @n Privilege: http://tizen.org/privilege/mediahistory.read */
+       CONTEXT_TRIGGER_CONDITION_POWER_SAVING_MODE     = 0x20200,      /**< Power saving mode setting (Deprecated since 4.0) */
+       CONTEXT_TRIGGER_CONDITION_CALL          = 0x20300,      /**< Call state @n Privilege: http://tizen.org/privilege/telephony (Deprecated since 4.0) */
+       CONTEXT_TRIGGER_CONDITION_APP_USE_FREQUENCY     = 0x20600,      /**< Frequency of app use @n Privilege: http://tizen.org/privilege/apphistory.read (Deprecated since 4.0) */
+       CONTEXT_TRIGGER_CONDITION_COMMUNICATION_FREQUENCY,              /**< Frequency of communication via call or message @n Privilege: http://tizen.org/privilege/callhistory.read (Deprecated since 4.0) */
+       CONTEXT_TRIGGER_CONDITION_MUSIC_PLAYBACK_FREQUENCY,             /**< Frequency of music playback @n Privilege: http://tizen.org/privilege/mediahistory.read (Deprecated since 4.0) */
+       CONTEXT_TRIGGER_CONDITION_VIDEO_PLAYBACK_FREQUENCY,             /**< Frequency of video playback @n Privilege: http://tizen.org/privilege/mediahistory.read (Deprecated since 4.0) */
 } context_trigger_condition_e;
 
 /**
@@ -1012,6 +1021,7 @@ int context_trigger_rule_entry_destroy(context_trigger_rule_entry_h entry);
 int context_trigger_rule_entry_add_option_int(context_trigger_rule_entry_h entry, const char* option_key, int value);
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief              Sets a string type option to an event or condition entry.
  * @details            See the programming guide to find available option keys for each event/condition item.
  * @since_tizen 2.4
@@ -1029,9 +1039,10 @@ int context_trigger_rule_entry_add_option_int(context_trigger_rule_entry_h entry
  * @see                        context_trigger_rule_entry_add_option()
  * @see                        context_trigger_rule_entry_add_option_int()
  */
-int context_trigger_rule_entry_add_option_string(context_trigger_rule_entry_h entry, const char* option_key, const char* value);
+int context_trigger_rule_entry_add_option_string(context_trigger_rule_entry_h entry, const char* option_key, const char* value) TIZEN_DEPRECATED_API;
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief              Sets an option to a condition entry, which references an attribute that will be extracted from the event.
  * @details            See the programming guide to find available option keys for each condition item.
  * @since_tizen 2.4
@@ -1049,7 +1060,7 @@ int context_trigger_rule_entry_add_option_string(context_trigger_rule_entry_h en
  * @see                        context_trigger_rule_entry_add_option_int()
  * @see                        context_trigger_rule_entry_add_option_string()
  */
-int context_trigger_rule_entry_add_option(context_trigger_rule_entry_h entry, const char* option_key, const char* event_data_key);
+int context_trigger_rule_entry_add_option(context_trigger_rule_entry_h entry, const char* option_key, const char* event_data_key) TIZEN_DEPRECATED_API;
 
 /**
  * @brief              Adds an attribute key to an entry.
@@ -1126,6 +1137,7 @@ int context_trigger_rule_entry_add_comparison_int(context_trigger_rule_entry_h e
 int context_trigger_rule_entry_add_comparison_string(context_trigger_rule_entry_h entry, const char* key, const char* comp_operator, const char* value);
 
 /**
+ * @deprecated Deprecated since 4.0.
  * @brief              Adds a comparison between an attribute of a condition and an attribute extracted from the event.
  * @details            The key needs to be registered in advance, via context_trigger_rule_entry_add_key().
  * @since_tizen 2.4
@@ -1146,7 +1158,7 @@ int context_trigger_rule_entry_add_comparison_string(context_trigger_rule_entry_
  * @see                        context_trigger_rule_entry_add_comparison_int()
  * @see                        context_trigger_rule_entry_add_comparison_string()
  */
-int context_trigger_rule_entry_add_comparison(context_trigger_rule_entry_h entry, const char* key, const char* comp_operator, const char* event_data_key);
+int context_trigger_rule_entry_add_comparison(context_trigger_rule_entry_h entry, const char* key, const char* comp_operator, const char* event_data_key) TIZEN_DEPRECATED_API;
 
 /**
  * @brief              Defines a custom contextual data item with its template.
index dbfee68..e737384 100644 (file)
 #include "rule_validator.h"
 #include "rule_util.h"
 
+#define TRIGGER_DEPRECATED_FUNCTION_MSG "DEPRECATION WARNING: %s is deprecated and will be removed from next release."
+#define TRIGGER_DEPRECATED_EVENT_MSG "DEPRECATION WARNING: This event is deprecated and will be removed from next release."
+#define TRIGGER_DEPRECATED_CONDITION_MSG "DEPRECATION WARNING: This condition is deprecated and will be removed from next release."
+
 //#define DOUBLE_PRECISION 2
 #define TYPE_EVENT 1
 #define TYPE_CONDITION 2
@@ -52,6 +56,8 @@ static std::string convert_event_to_string(context_trigger_event_e item);
 static std::string convert_condition_to_string(context_trigger_condition_e item);
 static std::string convert_logical_type_to_string(context_trigger_logical_type_e logical_type);
 static std::string get_custom_item_subject(const char* provider, const char* item);
+static bool event_is_deprecated(context_trigger_event_e item);
+static bool condition_is_deprecated(context_trigger_condition_e item);
 
 //static std::string int_to_string(int value);
 //static std::string double_to_string(int value);
@@ -539,6 +545,10 @@ SO_EXPORT int context_trigger_rule_event_create(context_trigger_event_e event_it
        _D("BEGIN");
        ASSERT_NOT_NULL(entry);
 
+       if (event_is_deprecated(event_item)) {
+               _W(TRIGGER_DEPRECATED_EVENT_MSG);
+       }
+
        std::string eitem_str = convert_event_to_string(event_item);
        if (eitem_str.empty()) {
                return CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER;
@@ -592,6 +602,10 @@ SO_EXPORT int context_trigger_rule_event_is_supported(context_trigger_event_e ev
        _D("BEGIN");
        ASSERT_NOT_NULL(supported);
 
+       if (event_is_deprecated(event_item)) {
+               _W(TRIGGER_DEPRECATED_EVENT_MSG);
+       }
+
        *supported = false;
 
        std::string eitem_str = convert_event_to_string(event_item);
@@ -616,6 +630,10 @@ SO_EXPORT int context_trigger_rule_condition_create(context_trigger_condition_e
        _D("BEGIN");
        ASSERT_NOT_NULL(entry);
 
+       if (condition_is_deprecated(condition_item)) {
+               _W(TRIGGER_DEPRECATED_CONDITION_MSG);
+       }
+
        std::string citem_str = convert_condition_to_string(condition_item);
        if (citem_str.empty()) {
                return CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER;
@@ -667,6 +685,10 @@ SO_EXPORT int context_trigger_rule_condition_is_supported(context_trigger_condit
        _D("BEGIN");
        ASSERT_NOT_NULL(supported);
 
+       if (condition_is_deprecated(condition_item)) {
+               _W(TRIGGER_DEPRECATED_CONDITION_MSG);
+       }
+
        *supported = false;
 
        std::string citem_str = convert_condition_to_string(condition_item);
@@ -716,6 +738,7 @@ SO_EXPORT int context_trigger_rule_entry_add_option_int(context_trigger_rule_ent
 SO_EXPORT int context_trigger_rule_entry_add_option_string(context_trigger_rule_entry_h entry, const char* option_key, const char* value)
 {
        _D("BEGIN");
+       _W(TRIGGER_DEPRECATED_FUNCTION_MSG, __FUNCTION__);
        ASSERT_NOT_NULL(entry && option_key && value);
 
        bool ret = true;
@@ -734,6 +757,7 @@ SO_EXPORT int context_trigger_rule_entry_add_option_string(context_trigger_rule_
 SO_EXPORT int context_trigger_rule_entry_add_option(context_trigger_rule_entry_h entry, const char* option_key, const char* event_data_key)
 {
        _D("BEGIN");
+       _W(TRIGGER_DEPRECATED_FUNCTION_MSG, __FUNCTION__);
        ASSERT_NOT_NULL(entry && option_key && event_data_key);
 
        // Err: Only conditin can reference data from event
@@ -856,6 +880,7 @@ static int context_trigger_rule_entry_add_comparison_int_internal(context_trigge
 SO_EXPORT int context_trigger_rule_entry_add_comparison(context_trigger_rule_entry_h entry, const char* key, const char* op, const char* event_data_key)
 {
        _D("BEGIN");
+       _W(TRIGGER_DEPRECATED_FUNCTION_MSG, __FUNCTION__);
        ASSERT_NOT_NULL(entry && key && op && event_data_key);
 
        // Err: Only condition can reference data from event
@@ -1127,6 +1152,41 @@ std::string get_custom_item_subject(const char* provider, const char* item)
        return subject_name;
 }
 
+bool event_is_deprecated(context_trigger_event_e item)
+{
+       bool ret = false;
+       switch (item) {
+       case CONTEXT_TRIGGER_EVENT_TIME:
+       case CONTEXT_TRIGGER_EVENT_POWER_SAVING_MODE:
+       case CONTEXT_TRIGGER_EVENT_CALL:
+       case CONTEXT_TRIGGER_EVENT_EMAIL:
+       case CONTEXT_TRIGGER_EVENT_MESSAGE:
+               ret = true;
+               break;
+       default:
+               break;
+       }
+       return ret;
+}
+
+bool condition_is_deprecated(context_trigger_condition_e item)
+{
+       bool ret = false;
+       switch (item) {
+       case CONTEXT_TRIGGER_CONDITION_POWER_SAVING_MODE:
+       case CONTEXT_TRIGGER_CONDITION_CALL:
+       case CONTEXT_TRIGGER_CONDITION_APP_USE_FREQUENCY:
+       case CONTEXT_TRIGGER_CONDITION_COMMUNICATION_FREQUENCY:
+       case CONTEXT_TRIGGER_CONDITION_MUSIC_PLAYBACK_FREQUENCY:
+       case CONTEXT_TRIGGER_CONDITION_VIDEO_PLAYBACK_FREQUENCY:
+               ret = true;
+               break;
+       default:
+               break;
+       }
+       return ret;
+}
+
 /*
 std::string int_to_string(int value)
 {