Update some functions 92/219292/16
authormk5004.lee <mk5004.lee@samsung.com>
Wed, 4 Dec 2019 05:52:29 +0000 (14:52 +0900)
committerMyungKi Lee <mk5004.lee@samsung.com>
Wed, 12 Feb 2020 04:44:46 +0000 (04:44 +0000)
- delete noti_ex_item_get_shared_paths
  Add noti_ex_get/set_extension_data
  Update chat_message description
  delete some error
  update get/set sound, vibration
  Add type for chat_message
  Add policy - disable auto delete

Change-Id: Ie4f767b93ff877bae10f05293880e46e78080047
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
notification-ex/api/notification_ex_chat_message.h
notification-ex/api/notification_ex_error.h
notification-ex/api/notification_ex_internal.h
notification-ex/api/notification_ex_item.h
notification-ex/stub.cc

index a015dc1..afb515b 100644 (file)
@@ -35,6 +35,7 @@ extern "C" {
 typedef enum _noti_ex_item_chat_message_type {
        NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_USER, /**< The user of chat message */
        NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_SENDER, /**< The sender of chat message */
+       NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_NONE, /**< Not user or sender */
 } noti_ex_item_chat_message_type_e;
 
 /**
@@ -47,6 +48,7 @@ typedef enum _noti_ex_item_chat_message_type {
  * @remarks @a handle must be released using noti_ex_item_destroy().
  *          @a name, @a text, @a image and @a time must not be released if the function returns #NOTI_EX_ERROR_NONE.
  *          @a name, @a text, @a image and @a time will be released when @a handle is released.
+ *          @a name and @a time are mandatory (cannot be null). @a text and @a image cannot both be null.
  * @param[out] handle The noti ex item handle
  * @param[in] id The id of notification_ex item
  * @param[in] name The notification_ex item handle for name
index 2b38f65..1275a78 100644 (file)
@@ -43,13 +43,11 @@ typedef enum _noti_ex_error {
        NOTI_EX_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
        NOTI_EX_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
        NOTI_EX_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
-       NOTI_EX_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Function not implemented */
        NOTI_EX_ERROR_FROM_DB = TIZEN_ERROR_NOTIFICATION | 0x01, /**< Error from DB query */
-       NOTI_EX_ERROR_ALREADY_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x02, /**< Private ID already exists */
+       NOTI_EX_ERROR_ALREADY_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x02, /**< Already exist private ID */
        NOTI_EX_ERROR_FROM_DBUS = TIZEN_ERROR_NOTIFICATION | 0x03, /**< Error from DBus */
-       NOTI_EX_ERROR_NOT_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x04, /**< Private ID does not exist */
+       NOTI_EX_ERROR_NOT_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x04, /**< Not exist private ID */
        NOTI_EX_ERROR_SERVICE_NOT_READY = TIZEN_ERROR_NOTIFICATION | 0x05, /**< No response from notification service */
-       NOTI_EX_ERROR_MAX_EXCEEDED = TIZEN_ERROR_NOTIFICATION | 0x06, /**< Max notification count exceeded */
 } noti_ex_error_e;
 
 
index 812be92..4725a3d 100644 (file)
@@ -34,11 +34,6 @@ int noti_ex_style_set_padding(noti_ex_style_h handle,
 int noti_ex_led_info_set_color(noti_ex_led_info_h handle,
                noti_ex_color_h color);
 
-int noti_ex_item_get_extension_data(noti_ex_item_h handle, const char *key,
-               bundle **value);
-int noti_ex_item_set_extension_data(noti_ex_item_h handle, const char *key,
-               bundle *value);
-
 #ifdef __cplusplus
 }
 #endif
index 8cb3034..d609253 100644 (file)
@@ -60,6 +60,18 @@ extern "C" {
 #define NOTI_EX_RECEIVER_GROUP_POPUP "tizen.org/receiver/popup"
 
 /**
+ * @brief Default sound.
+ * @since_tizen 5.5
+ */
+#define NOTIFICATION_SOUND_TYPE_DEFAULT "__SOUND_TYPE_DEFAULT__"
+
+/**
+ * @brief Default vibration.
+ * @since_tizen 5.5
+ */
+#define NOTIFICATION_VIBRATION_TYPE_DEFAULT "__VIBRATION_TYPE_DEFAULT__"
+
+/**
  * @brief Enumeration for notification_ex item types.
  * @since_tizen 5.5
  */
@@ -99,6 +111,7 @@ typedef enum _noti_ex_item_policy {
        NOTI_EX_ITEM_POLICY_NONE = 0, /**< No policy */
        NOTI_EX_ITEM_POLICY_ON_BOOT_CLEAR = 1 << 0, /**< On boot clear */
        NOTI_EX_ITEM_POLICY_SIM_MODE = 1 << 1, /**< SIM mode */
+       NOTI_EX_ITEM_POLICY_DISABLE_AUTO_DELETE = 1 << 2, /**< Disable auto delete */
 } noti_ex_item_policy_e;
 
 /**
@@ -1388,32 +1401,6 @@ int noti_ex_item_find_by_id(noti_ex_item_h handle, const char *id, noti_ex_item_
 int noti_ex_item_get_type(noti_ex_item_h handle, int *type);
 
 /**
- * @brief Gets the path of shared files.
- * @since_tizen 5.5
- * @remarks Each path in the @a paths must be released using free(), then the @a paths must be released using free().
- * @param[in] handle The notification_ex item handle
- * @param[out] paths The absolute paths of shared files
- * @param[out] count The number of paths
- * @return #NOTI_EX_ERROR_NONE On success, other value on failure
- * @retval #NOTI_EX_ERROR_NONE Success
- * @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
- * @see #noti_ex_item_h
- * @par Sample code:
- * @code
-#include <notification_ex.h>
-
-{
-       int ret;
-       char **paths = NULL;
-       int count;
-
-       ret = noti_ex_item_get_shared_paths(item_handle, &paths, &count);
-}
- * @endcode
- */
-int noti_ex_item_get_shared_paths(noti_ex_item_h handle, char ***paths, int *count);
-
-/**
  * @brief Gets the id of a notification_ex item.
  * @since_tizen 5.5
  * @remarks @a id must be released using free().
@@ -1882,6 +1869,7 @@ int noti_ex_item_get_led_info(noti_ex_item_h handle, noti_ex_led_info_h *led);
  * @since_tizen 5.5
  * @param[in] handle The notification_ex item handle
  * @param[in] path The absolute path of sound for notification_ex item
+ *                 If you want to set a default sound, enter #NOTIFICATION_SOUND_TYPE_DEFAULT.
  * @return #NOTI_EX_ERROR_NONE On success, other value on failure
  * @retval #NOTI_EX_ERROR_NONE Success
  * @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
@@ -1905,6 +1893,8 @@ int noti_ex_item_set_sound_path(noti_ex_item_h handle, const char *path);
  * @remarks @a path must be released using free().
  * @param[in] handle The notification_ex item handle
  * @param[out] path The absolute path of sound for notification_ex item
+ *                  If not set, you will get NULL.
+ *                  If set default, you will get #NOTIFICATION_SOUND_TYPE_DEFAULT.
  * @return #NOTI_EX_ERROR_NONE On success, other value on failure
  * @retval #NOTI_EX_ERROR_NONE Success
  * @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
@@ -1928,6 +1918,7 @@ int noti_ex_item_get_sound_path(noti_ex_item_h handle, char **path);
  * @since_tizen 5.5
  * @param[in] handle The notification_ex item handle
  * @param[in] path The absolute path of vibration for notification_ex item
+ *                 If you want to set a default sound, enter #NOTIFICATION_VIBRATION_TYPE_DEFAULT.
  * @return #NOTI_EX_ERROR_NONE On success, other value on failure
  * @retval #NOTI_EX_ERROR_NONE Success
  * @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
@@ -1951,6 +1942,8 @@ int noti_ex_item_set_vibration_path(noti_ex_item_h handle, const char *path);
  * @remarks @a path must be released using free().
  * @param[in] handle The notification_ex item handle
  * @param[out] path The absolute path of vibration for a notification_ex item
+ *                  If not set, you will get NULL.
+ *                  If set default, you will get #NOTIFICATION_VIBRATION_TYPE_DEFAULT.
  * @return #NOTI_EX_ERROR_NONE On success, other value on failure
  * @retval #NOTI_EX_ERROR_NONE Success
  * @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
@@ -2009,7 +2002,7 @@ int noti_ex_item_get_info(noti_ex_item_h handle, noti_ex_item_info_h *info);
  * @see #noti_ex_item_h
  * @par Sample code:
  * @code
-#include <notification_exh>
+#include <notification_ex.h>
 
 {
        int ret;
@@ -2237,6 +2230,63 @@ int noti_ex_item_find_by_main_type(noti_ex_item_h handle, int type,
                noti_ex_item_h *item);
 
 /**
+ * @brief Gets the extension data.
+ * @since_tizen 5.5
+ * @remarks The @a value should be released using bundle_free().
+ * @param[in] handle The notification_ex item handle
+ * @param[in] key The key
+ * @param[out] value The bundle data
+ * @return #NOTI_EX_ERROR_NONE On success, other value on failure
+ * @retval #NOTI_EX_ERROR_NONE Success
+ * @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see #noti_ex_item_h
+ * @par Sample code:
+ * @code
+#include <notification_ex.h>
+
+{
+       int ret;
+       char *key = "ADDITIONAL_DATA_KEY";
+       bundle *b;
+
+       ret = noti_ex_item_get_extension_data(item_handle, key, &b);
+       ...
+       bundle_free(b);
+}
+ * @endcode
+ */
+int noti_ex_item_get_extension_data(noti_ex_item_h handle, const char *key,
+               bundle **value);
+
+/**
+ * @brief Sets the extension data.
+ * @since_tizen 5.5
+ * @param[in] handle The notification_ex item handle
+ * @param[in] key The key
+ * @param[in] value The bundle data
+ * @return #NOTI_EX_ERROR_NONE On success, other value on failure
+ * @retval #NOTI_EX_ERROR_NONE Success
+ * @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see #noti_ex_item_h
+ * @par Sample code:
+ * @code
+#include <notification_ex.h>
+
+{
+       int ret;
+       char *key = "ADDITIONAL_DATA_KEY";
+       bundle *b = bundle_create();
+       bundle_add_str(b, "key", "value");
+
+       ret = noti_ex_item_set_extension_data(item_handle, key, b);
+       bundle_free(b);
+}
+ * @endcode
+ */
+int noti_ex_item_set_extension_data(noti_ex_item_h handle, const char *key,
+               bundle *value);
+
+/**
  * @}
  */
 
index 70c91e0..35da063 100644 (file)
@@ -1971,36 +1971,6 @@ extern "C" EXPORT_API int noti_ex_item_get_type(noti_ex_item_h handle,
   return NOTI_EX_ERROR_NONE;
 }
 
-extern "C" EXPORT_API int noti_ex_item_get_shared_paths(noti_ex_item_h handle,
-    char ***path, int *count) {
-  if (handle == nullptr || path == nullptr || count == nullptr) {
-    LOGE("Invalid parameter");
-    return NOTI_EX_ERROR_INVALID_PARAMETER;
-  }
-  Handle* p = static_cast<Handle*>(handle);
-  list<string> shared_path = p->Get()->GetSharedPath();
-  char** tmp_path = (char**)calloc(shared_path.size(), sizeof(char*));
-  if (tmp_path == nullptr) {
-    LOGE("Fail to create items");
-    return NOTI_EX_ERROR_OUT_OF_MEMORY;
-  }
-
-  int idx = 0;
-  for (auto& i : shared_path) {
-    tmp_path[idx] = strdup(i.c_str());
-    if (tmp_path[idx] == nullptr) {
-      __noti_ex_free_str_array(tmp_path, idx);
-      LOGE("Out of memory");
-      return NOTI_EX_ERROR_OUT_OF_MEMORY;
-    }
-    idx++;
-  }
-
-  *path = tmp_path;
-  *count = shared_path.size();
-  return NOTI_EX_ERROR_NONE;
-}
-
 extern "C" EXPORT_API int noti_ex_item_get_id(noti_ex_item_h handle,
     char **id) {
   if (handle == nullptr || id == nullptr) {