- Add notification ongoing value type for display time infomation.
User gets/sets notification ongoing value type and time.
Signed-off-by: seungha.son <seungha.son@samsung.com>
Change-Id: Id12bf068c9a11815a7f4f6e94dd383755e073b2e
#endif
/**
+ * @brief Enumeration for notification ongoing value type
+ * @since_tizen 3.0
+ */
+typedef enum _notification_ongoing_value_type {
+ NOTIFICATION_ONGOING_VALUE_TYPE_PERCENT = 0,
+ NOTIFICATION_ONGOING_VALUE_TYPE_TIME,
+} notification_ongoing_value_type_e;
+
+/**
* @addtogroup NOTIFICATION_INTERNAL
* @{
*/
int notification_unregister_detailed_changed_cb_for_uid(
void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
void *user_data, uid_t uid);
-
/**
* @brief Sets the default button to display highlight on the notification.
* @since_tizen 3.0
int notification_get_default_button(notification_h noti, notification_button_index_e *index);
/**
+ * @brief Gets the notification ongoing value type.
+ * @since_tizen 3.0
+ * @param[in] noti The notification handle
+ * @param[out] type The notification ongoing value type
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see #notification_ongoing_value_type_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ notification_ongoing_value_type_e type;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if (noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_get_ongoing_value_type(noti, &type);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_get_ongoing_value_type(notification_h noti, notification_ongoing_value_type_e *type);
+
+/**
+ * @brief Sets the notification ongoing value type.
+ * @since_tizen 3.0
+ * @param[in] noti The notification handle
+ * @param[in] type The notification ongoing value type
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see #notification_ongoing_value_type_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ notification_ongoing_value_type_e type;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if (noti == NULL) {
+ return;
+ }
+
+ type = NOTIFICATION_ONGOING_VALUE_TYPE_TIME;
+
+ noti_err = notification_set_ongoing_value_type(noti, type);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+int notification_set_ongoing_value_type(notification_h noti, notification_ongoing_value_type_e type);
+
+/**
+ * @brief Gets the notification ongoing time when ongoint type value is set NOTIFICATION_ONGOING_VALUE_TYPE_TIME.
+ * @since_tizen 3.0
+ * @param[in] noti The notification handle
+ * @param[out] current The ongoing current time
+ * @param[out] duration The ongoing duration time
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see #notification_ongoing_value_type_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ int current;
+ int duration;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if (noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_get_ongoing_time(noti, ¤t, &duration);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+EXPORT_API int nofication_get_ongoing_time(notification_h noti, int *current, int *duration);
+
+/**
+ * @brief Sets the notification ongoing time when ongoint type value is set NOTIFICATION_ONGOING_VALUE_TYPE_TIME.
+ * @since_tizen 3.0
+ * @param[in] noti The notification handle
+ * @param[in] current The ongoing current time
+ * @param[in] duration The ongoing duration time
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see #notification_ongoing_value_type_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+ int current;
+ int duration;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if (noti == NULL) {
+ return;
+ }
+
+ current = 0;
+ duration = 30;
+
+ noti_err = notification_set_ongoing_time(noti, current, duration)
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+}
+ * @endcode
+ */
+EXPORT_API int nofication_set_ongoing_time(notification_h noti, int current, int duration);
+
+/**
* @brief This function translate localized texts
* @param[in] noti The notification handle that is created by notification_create()
* @return #NOTIFICATION_ERROR_NONE if success, other value if failure
}
#endif
#endif
-
char *temp_content;
char *tag;
bool ongoing_flag;
+ int ongoing_value_type;
+ int ongoing_current; /* Ongoing current time */
+ int ongoing_duration; /* Ongoing duration time */
bool auto_remove;
notification_button_index_e default_button_index;
uid_t uid;
NOTIFICATION_DATA_TYPE_TEMP_CONTENT,
NOTIFICATION_DATA_TYPE_TAG,
NOTIFICATION_DATA_TYPE_ONGOING_FLAG,
+ NOTIFICATION_DATA_TYPE_ONGOING_VALUE_TYPE,
+ NOTIFICATION_DATA_TYPE_ONGOING_CURRENT,
+ NOTIFICATION_DATA_TYPE_ONGOING_DURATION,
NOTIFICATION_DATA_TYPE_AUTO_REMOVE,
NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON,
NOTIFICATION_DATA_TYPE_UID,
noti->auto_remove = true;
noti->ongoing_flag = false;
noti->default_button_index = 0;
+ noti->type = NOTIFICATION_ONGOING_VALUE_TYPE_PERCENT;
if (getuid() >= REGULAR_UID_MIN) {
noti->caller_pkgname = notification_get_pkgname_by_pid();
new_noti->progress_percentage = noti->progress_percentage;
new_noti->ongoing_flag = noti->ongoing_flag;
+ new_noti->ongoing_value_type = noti->ongoing_value_type;
+ new_noti->ongoing_current = noti->ongoing_current;
+ new_noti->ongoing_duration = noti->ongoing_duration;
new_noti->auto_remove = noti->auto_remove;
new_noti->default_button_index = noti->default_button_index;
+
new_noti->uid = noti->uid;
new_noti->app_icon_path = NULL;
progress_size DOUBLE default 0, \
progress_percentage DOUBLE default 0, \
ongoing_flag INTEGER default 0, \
+ ongoing_value_type INTEGER default 0, \
+ ongoing_current INTEGER default 0, \
+ ongoing_duration INTEGER default 0, \
auto_remove INTEGER default 1, \
default_button_index INTEGER default 0, \
uid INTEGER \
progress_size DOUBLE default 0, \
progress_percentage DOUBLE default 0, \
ongoing_flag INTEGER default 0, \
+ ongoing_value_type INTEGER default 0, \
+ ongoing_current INTEGER default 0, \
+ ongoing_duration INTEGER default 0, \
auto_remove INTEGER default 1, \
default_button_index INTEGER default 0, \
uid INTEGER, \
return noti;
}
-int notification_set_default_button(notification_h noti, notification_button_index_e index)
+EXPORT_API int notification_set_default_button(notification_h noti, notification_button_index_e index)
{
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
return NOTIFICATION_ERROR_NONE;
}
-int notification_get_default_button(notification_h noti, notification_button_index_e *index)
+EXPORT_API int notification_get_default_button(notification_h noti, notification_button_index_e *index)
{
if (noti == NULL || index == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
return NOTIFICATION_ERROR_NONE;
}
+
+EXPORT_API int notification_get_ongoing_value_type(notification_h noti, notification_ongoing_value_type_e *type)
+{
+ if (noti == NULL || type == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ *type = noti->ongoing_value_type;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_ongoing_value_type(notification_h noti, notification_ongoing_value_type_e type)
+{
+ if (type < NOTIFICATION_ONGOING_VALUE_TYPE_PERCENT && type > NOTIFICATION_ONGOING_VALUE_TYPE_TIME)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ noti->ongoing_value_type = type;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int nofication_get_ongoing_time(notification_h noti, int *current, int *duration)
+{
+ if (noti == NULL || current == NULL || duration == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ *current = noti->ongoing_current;
+ *duration = noti->ongoing_duration;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_set_ongoing_time(notification_h noti, int current, int duration)
+{
+ if (noti == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ noti->ongoing_current = current;
+ noti->ongoing_duration = duration;
+
+ return NOTIFICATION_ERROR_NONE;
+}
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_TAG, g_variant_new_string((const gchar *)noti->tag));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_ONGOING_FLAG, g_variant_new_int32(noti->ongoing_flag));
+ g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_ONGOING_VALUE_TYPE, g_variant_new_int32(noti->ongoing_value_type));
+ g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_ONGOING_CURRENT, g_variant_new_int32(noti->ongoing_current));
+ g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_ONGOING_DURATION, g_variant_new_int32(noti->ongoing_duration));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_AUTO_REMOVE, g_variant_new_int32(noti->auto_remove));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON, g_variant_new_int32(noti->default_button_index));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_UID, g_variant_new_int32(noti->uid));
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_TEMP_CONTENT, "&s", &temp_content);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_TAG, "&s", &tag);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_ONGOING_FLAG, "i", ¬i->ongoing_flag);
+ _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_ONGOING_VALUE_TYPE, "i", ¬i->ongoing_value_type);
+ _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_ONGOING_CURRENT, "i", ¬i->ongoing_current);
+ _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_ONGOING_DURATION, "i", ¬i->ongoing_duration);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_AUTO_REMOVE, "i", ¬i->auto_remove);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON, "i", ¬i->default_button_index);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_UID, "i", ¬i->uid);
"b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
"sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, flag_simmode, display_applist, "
- "progress_size, progress_percentage, ongoing_flag, auto_remove, default_button_index, uid) values ("
+ "progress_size, progress_percentage, "
+ "ongoing_flag, ongoing_value_type, ongoing_current, ongoing_duration, "
+ "auto_remove, default_button_index, uid) values ("
"%d, "
"%d, "
"'%s', '%s', "
"'%s', '%s', "
"%d, '%s', %d, '%s', %d, %d, %d, %d,"
"%d, %d, %d, "
- "$progress_size, $progress_percentage, %d, %d, %d, %d)",
+ "$progress_size, $progress_percentage, "
+ "%d, %d, %d, %d, %d, %d, %d)",
noti->type,
noti->layout,
NOTIFICATION_CHECK_STR(noti->caller_pkgname),
noti->led_off_ms,
noti->flags_for_property, flag_simmode, noti->display_applist,
noti->ongoing_flag,
+ noti->ongoing_value_type,
+ noti->ongoing_current,
+ noti->ongoing_duration,
noti->auto_remove,
noti->default_button_index,
noti->uid);
"flags_for_property = %d, flag_simmode = %d, "
"display_applist = %d, "
"progress_size = $progress_size, progress_percentage = $progress_percentage, "
- "ongoing_flag = %d, auto_remove = %d, default_button_index = %d "
+ "ongoing_flag = %d, ongoing_value_type = %d, ongoing_current = %d, ongoing_duration = %d, "
+ "auto_remove = %d, default_button_index = %d "
"where priv_id = %d ",
noti->type,
noti->layout,
noti->led_on_ms,
noti->led_off_ms,
noti->flags_for_property, flag_simmode, noti->display_applist,
- noti->ongoing_flag, noti->auto_remove, noti->default_button_index,
- noti->priv_id);
+ noti->ongoing_flag, noti->ongoing_value_type,
+ noti->ongoing_current, noti->ongoing_duration,
+ noti->auto_remove, noti->default_button_index, noti->priv_id);
/* Free decoded data */
if (args)
noti->progress_percentage = sqlite3_column_double(stmt, col++);
noti->ongoing_flag = sqlite3_column_int(stmt, col++);
+ noti->ongoing_value_type = sqlite3_column_int(stmt, col++);
+ noti->ongoing_current = sqlite3_column_int(stmt, col++);
+ noti->ongoing_duration = sqlite3_column_int(stmt, col++);
noti->auto_remove = sqlite3_column_int(stmt, col++);
noti->default_button_index = sqlite3_column_int(stmt, col++);