summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryoungsub ko <ys4610.ko@samsung.com>2013-05-07 12:21:11 +0900
committeryoungsub ko <ys4610.ko@samsung.com>2013-05-07 12:21:11 +0900
commit3338e7de75fb800d773b90be85d8acec5de70707 (patch)
tree150d416f20ce9b8d6c78972504ef7776a9bc9a62
parentfaf529d900861921ecec05d9633f05cc11b4dd76 (diff)
downloadnotification-3338e7de75fb800d773b90be85d8acec5de70707.tar.gz
notification-3338e7de75fb800d773b90be85d8acec5de70707.tar.bz2
notification-3338e7de75fb800d773b90be85d8acec5de70707.zip
Adding APIs setting LED flasing time periodsubmit/tizen_2.1/20130514.053430
-rwxr-xr-xinclude/notification.h64
-rwxr-xr-xinclude/notification_internal.h2
-rwxr-xr-xpackaging/notification.spec2
-rwxr-xr-xsrc/notification.c38
-rwxr-xr-xsrc/notification_ipc.c14
-rwxr-xr-xsrc/notification_noti.c17
6 files changed, 129 insertions, 8 deletions
diff --git a/include/notification.h b/include/notification.h
index 3f0123f..2534a09 100755
--- a/include/notification.h
+++ b/include/notification.h
@@ -655,6 +655,70 @@ notification_error_e notification_get_led(notification_h noti,
int *led_argb);
/**
+ * @brief This function set time period of flashing LED
+ * @details
+ * @remarks
+ * @param[in] noti notification handle
+ * @param[in] on_ms time for turning on the LED
+ * @param[in] off_ms time for turning on the LED
+ * @return NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval NOTIFICATION_ERROR_NONE - success
+ * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
+ * @pre
+ * @post
+ * @see
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_led_time_period(noti, 100, 100);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+notification_error_e notification_set_led_time_period(notification_h noti,
+ int on_ms, int off_ms);
+
+/**
+ * @brief This function get time period of flashing LED
+ * @details
+ * @remarks
+ * @param[in] noti notification handle
+ * @param[out] on_ms time for turning on the LED
+ * @param[out] off_ms time for turning on the LED
+ * @return NOTIFICATION_ERROR_NONE if success, other value if failure
+ * @retval NOTIFICATION_ERROR_NONE - success
+ * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter
+ * @pre
+ * @post
+ * @see
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+ {
+ notification_h noti = NULL;
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+ int led_on_ms = 0;
+ int led_off_ms = 0;
+
+ noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+}
+ * @endcode
+ */
+notification_error_e notification_get_led_time_period(notification_h noti,
+ int *on_ms, int *off_ms);
+
+/**
* @brief This function will be deprecated.
* @see notification_set_execute_option()
*
diff --git a/include/notification_internal.h b/include/notification_internal.h
index 00f51e8..41e1489 100755
--- a/include/notification_internal.h
+++ b/include/notification_internal.h
@@ -60,6 +60,8 @@ struct _notification {
char *vibration_path;
notification_led_op_e led_operation;
int led_argb;
+ int led_on_ms;
+ int led_off_ms;
time_t time; /* time set by application */
time_t insert_time; /* insert time */
diff --git a/packaging/notification.spec b/packaging/notification.spec
index 9b41a95..c57faef 100755
--- a/packaging/notification.spec
+++ b/packaging/notification.spec
@@ -89,6 +89,8 @@ then
vibration_path TEXT,
led_operation INTEGER default 0,
led_argb INTEGER default 0,
+ led_on_ms INTEGER default -1,
+ led_off_ms INTEGER default -1,
flags_for_property INTEGER default 0,
flag_simmode INTEGER default 0,
display_applist INTEGER,
diff --git a/src/notification.c b/src/notification.c
index f4b70d1..35b483a 100755
--- a/src/notification.c
+++ b/src/notification.c
@@ -1411,6 +1411,42 @@ EXPORT_API notification_error_e notification_get_led(notification_h noti,
return NOTIFICATION_ERROR_NONE;
}
+EXPORT_API notification_error_e notification_set_led_time_period(notification_h noti,
+ int on_ms, int off_ms)
+{
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
+ /* Save led operation */
+ noti->led_on_ms = on_ms;
+ noti->led_off_ms = off_ms;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API notification_error_e notification_get_led_time_period(notification_h noti,
+ int *on_ms, int *off_ms)
+{
+ /* check noti and operation is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
+ /* Check noti is valid data */
+ if (noti == NULL) {
+ return NOTIFICATION_ERROR_INVALID_DATA;
+ }
+
+ if (on_ms)
+ *(on_ms) = noti->led_on_ms;
+ if (off_ms)
+ *(off_ms) = noti->led_off_ms;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
EXPORT_API notification_error_e notification_set_application(notification_h noti,
const char *pkgname)
{
@@ -2417,6 +2453,8 @@ EXPORT_API notification_error_e notification_clone(notification_h noti, notifica
}
new_noti->led_operation = noti->led_operation;
new_noti->led_argb = noti->led_argb;
+ new_noti->led_on_ms = noti->led_on_ms;
+ new_noti->led_off_ms = noti->led_off_ms;
if(noti->domain != NULL) {
new_noti->domain = strdup(noti->domain);
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index 845702f..069e39e 100755
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -361,6 +361,8 @@ EXPORT_API notification_error_e notification_ipc_make_noti_from_packet(notificat
char *vibration_path = NULL;
int led_operation;
int led_argb;
+ int led_on_ms;
+ int led_off_ms;
time_t time;
time_t insert_time;
int flags_for_property;
@@ -378,7 +380,7 @@ EXPORT_API notification_error_e notification_ipc_make_noti_from_packet(notificat
}
ret = packet_get(packet,
- "iiiiisssssssssssssisisisiiiiiiddssss",
+ "iiiiisssssssssssssisisisiiiiiiiiddssss",
&type,
&layout,
&group_id,
@@ -405,6 +407,8 @@ EXPORT_API notification_error_e notification_ipc_make_noti_from_packet(notificat
&vibration_path,
&led_operation,
&led_argb,
+ &led_on_ms,
+ &led_off_ms,
&time,
&insert_time,
&flags_for_property,
@@ -416,7 +420,7 @@ EXPORT_API notification_error_e notification_ipc_make_noti_from_packet(notificat
&temp_title,
&temp_content);
- if (ret != 36) {
+ if (ret != 38) {
NOTIFICATION_ERR("failed to create a noti from packet");
return NOTIFICATION_ERROR_INVALID_DATA;
}
@@ -458,6 +462,8 @@ EXPORT_API notification_error_e notification_ipc_make_noti_from_packet(notificat
noti->vibration_type = vibration_type;
noti->led_operation = led_operation;
noti->led_argb = led_argb;
+ noti->led_on_ms = led_on_ms;
+ noti->led_off_ms = led_off_ms;
noti->time = time;
noti->insert_time = insert_time;
noti->flags_for_property = flags_for_property;
@@ -560,7 +566,7 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h
}
result = func_to_create_packet(command,
- "iiiiisssssssssssssisisisiiiiiiddssss",
+ "iiiiisssssssssssssisisisiiiiiiiiddssss",
noti->type,
noti->layout,
noti->group_id,
@@ -587,6 +593,8 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h
NOTIFICATION_CHECK_STR(noti->vibration_path),
noti->led_operation,
noti->led_argb,
+ noti->led_on_ms,
+ noti->led_off_ms,
noti->time,
noti->insert_time,
noti->flags_for_property,
diff --git a/src/notification_noti.c b/src/notification_noti.c
index 9e534e6..996465e 100755
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -378,7 +378,7 @@ static int _notification_noti_make_query(notification_h noti, char *query,
"args, group_args, "
"b_execute_option, "
"b_service_responding, b_service_single_launch, b_service_multi_launch, "
- "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb,"
+ "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) values ("
"%d, "
@@ -393,7 +393,7 @@ static int _notification_noti_make_query(notification_h noti, char *query,
"'%s', '%s', "
"'%s', "
"'%s', '%s', '%s', "
- "%d, '%s', %d, '%s', %d, %d,"
+ "%d, '%s', %d, '%s', %d, %d, %d, %d,"
"%d, %d, %d, "
"$progress_size, $progress_percentage)",
noti->type,
@@ -417,6 +417,8 @@ static int _notification_noti_make_query(notification_h noti, char *query,
NOTIFICATION_CHECK_STR(noti->vibration_path),
noti->led_operation,
noti->led_argb,
+ noti->led_on_ms,
+ noti->led_off_ms,
noti->flags_for_property, flag_simmode, noti->display_applist);
/* Free decoded data */
@@ -538,6 +540,7 @@ static int _notification_noti_make_update_query(notification_h noti, char *query
"sound_type = %d, sound_path = '%s', "
"vibration_type = %d, vibration_path = '%s', "
"led_operation = %d, led_argb = %d, "
+ "led_on_ms = %d, led_off_ms = %d, "
"flags_for_property = %d, flag_simmode = %d, "
"display_applist = %d, "
"progress_size = $progress_size, progress_percentage = $progress_percentage "
@@ -561,6 +564,8 @@ static int _notification_noti_make_update_query(notification_h noti, char *query
NOTIFICATION_CHECK_STR(noti->vibration_path),
noti->led_operation,
noti->led_argb,
+ noti->led_on_ms,
+ noti->led_off_ms,
noti->flags_for_property, flag_simmode, noti->display_applist,
noti->priv_id);
@@ -643,6 +648,8 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notificat
noti->vibration_path = notification_db_column_text(stmt, col++);
noti->led_operation = sqlite3_column_int(stmt, col++);
noti->led_argb = sqlite3_column_int(stmt, col++);
+ noti->led_on_ms = sqlite3_column_int(stmt, col++);
+ noti->led_off_ms = sqlite3_column_int(stmt, col++);
noti->flags_for_property = sqlite3_column_int(stmt, col++);
noti->display_applist = sqlite3_column_int(stmt, col++);
@@ -865,7 +872,7 @@ int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int pri
"b_text, b_key, b_format_args, num_format_args, "
"text_domain, text_dir, time, insert_time, args, group_args, "
"b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, "
- "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb,"
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, display_applist, progress_size, progress_percentage "
"from noti_list ";
@@ -1433,7 +1440,7 @@ notification_error_e notification_noti_get_grouping_list(notification_type_e typ
"b_text, b_key, b_format_args, num_format_args, "
"text_domain, text_dir, time, insert_time, args, group_args, "
"b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, "
- "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb,"
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, display_applist, progress_size, progress_percentage "
"from noti_list ");
@@ -1536,7 +1543,7 @@ notification_error_e notification_noti_get_detail_list(const char *pkgname,
"b_text, b_key, b_format_args, num_format_args, "
"text_domain, text_dir, time, insert_time, args, group_args, "
"b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, "
- "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb,"
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, display_applist, progress_size, progress_percentage "
"from noti_list ");