Adding APIs setting LED flasing time period submit/tizen_2.1/20130514.053430
authoryoungsub ko <ys4610.ko@samsung.com>
Tue, 7 May 2013 03:21:11 +0000 (12:21 +0900)
committeryoungsub ko <ys4610.ko@samsung.com>
Tue, 7 May 2013 03:21:11 +0000 (12:21 +0900)
include/notification.h
include/notification_internal.h
packaging/notification.spec
src/notification.c
src/notification_ipc.c
src/notification_noti.c

index 3f0123f..2534a09 100755 (executable)
@@ -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()
  *
index 00f51e8..41e1489 100755 (executable)
@@ -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 */
index 9b41a95..c57faef 100755 (executable)
@@ -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,
index f4b70d1..35b483a 100755 (executable)
@@ -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);
index 845702f..069e39e 100755 (executable)
@@ -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,
index 9e534e6..996465e 100755 (executable)
@@ -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 ");