ret_var_type = atoi(ret_val);
}
if (ret_var_type ==
- NOTIFICATION_VARIABLE_TYPE_COUNT)
- {
+ NOTIFICATION_VARIABLE_TYPE_COUNT) {
/* Get notification count */
notification_noti_get_count
(noti->type,
ret_var_type = atoi(ret_val);
}
if (ret_var_type ==
- NOTIFICATION_VARIABLE_TYPE_COUNT)
- {
+ NOTIFICATION_VARIABLE_TYPE_COUNT) {
/* Get notification count */
notification_noti_get_count
(noti->type,
err = app_control_import_from_bundle(app_control_new, b);
if (err == APP_CONTROL_ERROR_NONE) {
*event_handler = app_control_new;
- }
- else {
+ } else {
app_control_destroy(app_control_new);
app_control_new = NULL;
NOTIFICATION_ERR("Failed to import app control from bundle [%d]", err);
new_noti->internal_group_id = noti->internal_group_id;
new_noti->priv_id = noti->priv_id;
- if(noti->caller_pkgname != NULL) {
+ if (noti->caller_pkgname != NULL) {
new_noti->caller_pkgname = strdup(noti->caller_pkgname);
} else {
new_noti->caller_pkgname = notification_get_pkgname_by_pid();
}
- if(noti->launch_pkgname != NULL) {
+ if (noti->launch_pkgname != NULL) {
new_noti->launch_pkgname = strdup(noti->launch_pkgname);
} else {
new_noti->launch_pkgname = NULL;
}
- if(noti->args != NULL) {
+ if (noti->args != NULL) {
new_noti->args = bundle_dup(noti->args);
} else {
new_noti->args = NULL;
}
- if(noti->group_args != NULL) {
+ if (noti->group_args != NULL) {
new_noti->group_args = bundle_dup(noti->group_args);
} else {
new_noti->group_args = NULL;
}
- if(noti->b_execute_option != NULL) {
+ if (noti->b_execute_option != NULL) {
new_noti->b_execute_option = bundle_dup(noti->b_execute_option);
} else {
new_noti->b_execute_option = NULL;
}
- if(noti->b_service_responding != NULL) {
+ if (noti->b_service_responding != NULL) {
new_noti->b_service_responding = bundle_dup(noti->b_service_responding);
} else {
new_noti->b_service_responding = NULL;
}
- if(noti->b_service_single_launch != NULL) {
+ if (noti->b_service_single_launch != NULL) {
new_noti->b_service_single_launch = bundle_dup(noti->b_service_single_launch);
} else {
new_noti->b_service_single_launch = NULL;
}
- if(noti->b_service_multi_launch != NULL) {
+ if (noti->b_service_multi_launch != NULL) {
new_noti->b_service_multi_launch = bundle_dup(noti->b_service_multi_launch);
} else {
new_noti->b_service_multi_launch = NULL;
}
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if(noti->b_event_handler[i] != NULL) {
+ if (noti->b_event_handler[i] != NULL) {
new_noti->b_event_handler[i] = bundle_dup(noti->b_event_handler[i]);
} else {
new_noti->b_event_handler[i] = NULL;
}
new_noti->sound_type = noti->sound_type;
- if(noti->sound_path != NULL) {
+ if (noti->sound_path != NULL) {
new_noti->sound_path = strdup(noti->sound_path);
} else {
new_noti->sound_path = NULL;
}
new_noti->vibration_type = noti->vibration_type;
- if(noti->vibration_path != NULL) {
+ if (noti->vibration_path != NULL) {
new_noti->vibration_path = strdup(noti->vibration_path);
} else {
new_noti->vibration_path = NULL;
new_noti->led_on_ms = noti->led_on_ms;
new_noti->led_off_ms = noti->led_off_ms;
- if(noti->domain != NULL) {
+ if (noti->domain != NULL) {
new_noti->domain = strdup(noti->domain);
} else {
new_noti->domain = NULL;
}
- if(noti->dir != NULL) {
+ if (noti->dir != NULL) {
new_noti->dir = strdup(noti->dir);
} else {
new_noti->dir = NULL;
}
- if(noti->b_text != NULL) {
+ if (noti->b_text != NULL) {
new_noti->b_text = bundle_dup(noti->b_text);
} else {
new_noti->b_text = NULL;
}
- if(noti->b_key != NULL) {
+ if (noti->b_key != NULL) {
new_noti->b_key = bundle_dup(noti->b_key);
} else {
new_noti->b_key = NULL;
}
- if(noti->b_format_args != NULL) {
+ if (noti->b_format_args != NULL) {
new_noti->b_format_args = bundle_dup(noti->b_format_args);
} else {
new_noti->b_format_args = NULL;
}
new_noti->num_format_args = noti->num_format_args;
- if(noti->b_image_path != NULL) {
+ if (noti->b_image_path != NULL) {
new_noti->b_image_path = bundle_dup(noti->b_image_path);
} else {
new_noti->b_image_path = NULL;
}
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if(noti->b_event_handler[i] != NULL) {
+ if (noti->b_event_handler[i] != NULL) {
bundle_free(noti->b_event_handler[i]);
}
}
sqlite3 * notification_db_open(const char *dbfile)
{
int ret = 0;
- sqlite3 *db =0;
+ sqlite3 *db = 0;
ret = db_util_open(dbfile, &db, 0);
if (ret != SQLITE_OK) {
if (ret == SQLITE_PERM) {
set_last_result(NOTIFICATION_ERROR_PERMISSION_DENIED);
- }
- else {
+ } else {
set_last_result(NOTIFICATION_ERROR_FROM_DB);
}
return NULL;
/*!
* functions to check state of master
*/
-static inline void _set_master_started_cb(vconf_callback_fn cb) {
+static inline void _set_master_started_cb(vconf_callback_fn cb)
+{
int ret = -1;
ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED,
}
}
-static inline void _unset_master_started_cb(vconf_callback_fn cb) {
+static inline void _unset_master_started_cb(vconf_callback_fn cb)
+{
int ret = -1;
ret = vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED,
return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
-static void _do_deffered_task(void) {
+static void _do_deffered_task(void)
+{
task_list *list_do = NULL;
task_list *list_temp = NULL;
int i = 0;
for (i = 0 ; i < 10 ; i++) {
- NOTIFICATION_INFO("packet data[%d]:%d",i, buf[i]);
+ NOTIFICATION_INFO("packet data[%d]:%d", i, buf[i]);
}
if (ret == 11) {
NOTIFICATION_ERR("failed to receive answer(insert)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
NOTIFICATION_ERR("failed to receive answer(delete)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
NOTIFICATION_ERR("failed to receive answer(delete multiple)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
NOTIFICATION_ERR("failed to receive answer(update)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
NOTIFICATION_DBG("Failed to init client: %d", s_info.server_cl_fd);
if (notification_ipc_is_master_ready() == 1) {
ret = NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
ret = NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
goto fail;
NOTIFICATION_ERR("failed to receive answer(refresh)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
NOTIFICATION_ERR("failed to receive answer(delete)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
if (notification_ipc_is_master_ready() == 1) {
status = NOTIFICATION_ERROR_PERMISSION_DENIED;
goto out;
- }
- else {
+ } else {
status = NOTIFICATION_ERROR_SERVICE_NOT_READY;
goto out;
}
NOTIFICATION_ERR("failed to receive answer(delete)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
NOTIFICATION_ERR("failed to receive answer(delete)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
NOTIFICATION_ERR("failed to receive answer(load noti by tag)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
#define NOTI_BURST_DELETE_UNIT 10
-static void __free_and_set(void **target_ptr, void *new_ptr) {
+static void __free_and_set(void **target_ptr, void *new_ptr)
+{
if (target_ptr != NULL) {
if (*target_ptr != NULL) {
free(*target_ptr);
return NOTIFICATION_ERROR_NONE;
}
-static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notification_h noti) {
+static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notification_h noti)
+{
int col = 0;
int i = 0;
if (tagged_str == NULL)
return TAG_TYPE_INVALID;
- if (strlen(tagged_str)== 0)
+ if (strlen(tagged_str) == 0)
return TAG_TYPE_INVALID;
char *b_f_s = strstr(tagged_str, "<");
char *start = b_f_s + 1;
int len_tag = b_f_e - b_f_s - 1;
- if (strncmp(start,TAG_TIME,len_tag) == 0) {
+ if (strncmp(start, TAG_TIME, len_tag) == 0) {
return TAG_TYPE_TIME;
}
err = notification_setting_get_setting_by_package_name(caller_package_name, &setting);
if (err != NOTIFICATION_ERROR_NONE) {
/* Retry with package id */
- err = _get_package_id_by_app_id (caller_package_name, &package_id);
+ err = _get_package_id_by_app_id(caller_package_name, &package_id);
if (err != NOTIFICATION_ERROR_NONE || package_id == NULL) {
NOTIFICATION_ERR("_get_package_id_by_app_id failed [%d]", err);
goto out;
- }
- else {
+ } else {
err = notification_setting_get_setting_by_package_name(package_id, &setting);
if (err != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("notification_setting_get_setting_by_package_name failed [%d]", err);
if (err != NOTIFICATION_ERROR_NONE) {
/* Retry with package id */
- err = _get_package_id_by_app_id (noti->caller_pkgname, &package_id);
+ err = _get_package_id_by_app_id(noti->caller_pkgname, &package_id);
if (err != NOTIFICATION_ERROR_NONE || package_id == NULL) {
NOTIFICATION_ERR("_get_package_id_by_app_id failed [%d]", err);
goto out;
- }
- else {
+ } else {
err = notification_setting_get_setting_by_package_name(package_id, &setting);
if (err != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("notification_setting_get_setting_by_package_name failed [%d]", err);
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
goto err;
}
- ret = _notification_noti_bind_query_double(stmt, "$progress_size",noti->progress_size);
+ ret = _notification_noti_bind_query_double(stmt, "$progress_size", noti->progress_size);
if (ret != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
if (stmt) {
}
return ret;
}
- ret = _notification_noti_bind_query_double(stmt, "$progress_percentage",noti->progress_percentage);
+ ret = _notification_noti_bind_query_double(stmt, "$progress_percentage", noti->progress_percentage);
if (ret != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
if (stmt) {
if (pkgname != NULL) {
query = sqlite3_mprintf("%s where caller_pkgname = '%s' and priv_id = %d",
- base_query ,pkgname, priv_id);
+ base_query, pkgname, priv_id);
} else {
query = sqlite3_mprintf("%s where priv_id = %d", base_query, priv_id);
}
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
goto err;
}
- ret = _notification_noti_bind_query_double(stmt, "$progress_size",noti->progress_size);
+ ret = _notification_noti_bind_query_double(stmt, "$progress_size", noti->progress_size);
if (ret != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
goto err;
}
- ret = _notification_noti_bind_query_double(stmt, "$progress_percentage",noti->progress_percentage);
+ ret = _notification_noti_bind_query_double(stmt, "$progress_percentage", noti->progress_percentage);
if (ret != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
goto err;
goto err;
}
- while(sqlite3_step(stmt) == SQLITE_ROW) {
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
if (data_cnt % 8 == 0) {
int *tmp;
}
}
snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i));
- strncat(query_where, buf,sizeof(query_where) - strlen(query_where) - 1);
+ strncat(query_where, buf, sizeof(query_where) - strlen(query_where) - 1);
}
- if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0) ) {
+ if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0)) {
snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
ret_tmp = notification_db_exec(db, query, NULL);
if (ret == NOTIFICATION_ERROR_NONE) {
goto err;
}
- while(sqlite3_step(stmt) == SQLITE_ROW) {
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
if (data_cnt % 8 == 0) {
int *tmp;
tmp = (int *)realloc(*list_deleted_rowid, sizeof(int) * (data_cnt + 8 + 1));
}
}
snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i));
- strncat(query_where, buf,sizeof(query_where) - strlen(query_where) - 1);
+ strncat(query_where, buf, sizeof(query_where) - strlen(query_where) - 1);
}
- if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0) ) {
+ if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0)) {
snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
ret_tmp = notification_db_exec(db, query, NULL);
if (ret == NOTIFICATION_ERROR_NONE) {
If its bundle does not already contain a "tid" hint (which
complex applications such as xwalk may overwrite), we will
try to find the TID and set it in the bundle ourselves. */
- notification_get_execute_option (noti, NOTIFICATION_EXECUTE_TYPE_RESPONDING,
+ notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_RESPONDING,
NULL, &b);
if (b == NULL)
asprintf((char **)&tid_c, "%d", tid);
bc = bundle_dup(b);
bundle_add(bc, "tid", tid_c);
- notification_set_execute_option (noti, NOTIFICATION_EXECUTE_TYPE_RESPONDING,
+ notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_RESPONDING,
NULL, NULL, bc);
bundle_free(bc);
notification_update(noti);
return NOTIFICATION_ERROR_FROM_DBUS;
}
- if(content == NULL) {
+ if (content == NULL) {
ret = dbus_message_append_args(signal,
DBUS_TYPE_STRING, &caller_pkgname,
DBUS_TYPE_INT32, &priv_id,
#define NOTIFICATION_DB_ACCESS_WRITE 1
#if 0
-int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int access) {
+int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int access)
+{
int ret = 0;
char pkgname[512 + 1] = { 0, };
bool preload = false;
}
package_manager_compare_package_cert_info(noti_pkgname, &compare_result);
- if (compare_result == PACKAGE_MANAGER_COMPARE_MATCH ) {
+ if (compare_result == PACKAGE_MANAGER_COMPARE_MATCH) {
return NOTIFICATION_ERROR_NONE;
}
}
return NOTIFICATION_ERROR_PERMISSION_DENIED;
}
-#endif
\ No newline at end of file
+#endif
*buf = NULL;
else {
sLen = strlen(pTemp);
- if(sLen) {
+ if (sLen) {
*buf = (char *) malloc(sLen + 1);
if (*buf == NULL) {
NOTIFICATION_ERR("malloc is failed");
}
memset(*buf, 0, sLen + 1);
strncpy(*buf, pTemp, sLen);
- }
- else
+ } else
*buf = NULL;
}
int column_count = 0;
int i = 0;
int col_index = 0;
- notification_setting_h result_setting_array= NULL;
+ notification_setting_h result_setting_array = NULL;
if (setting_array == NULL || count == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
}
if (!row_count) {
- NOTIFICATION_DBG ("No setting found...");
- err= NOTIFICATION_ERROR_NOT_EXIST_ID;
+ NOTIFICATION_DBG("No setting found...");
+ err = NOTIFICATION_ERROR_NOT_EXIST_ID;
goto out;
}
- NOTIFICATION_DBG ("row_count [%d] column_count [%d]", row_count, column_count);
+ NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count);
if (!(result_setting_array = (struct notification_setting*)malloc(sizeof(struct notification_setting) * row_count))) {
NOTIFICATION_ERR("malloc failed...");
err = NOTIFICATION_ERROR_OUT_OF_MEMORY;
int column_count = 0;
int i = 0;
int col_index = 0;
- notification_setting_h result_setting_array= NULL;
+ notification_setting_h result_setting_array = NULL;
if (package_name == NULL || setting == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
}
if (!row_count) {
- NOTIFICATION_DBG ("No setting found for [%s]", package_name);
- err= NOTIFICATION_ERROR_NOT_EXIST_ID;
+ NOTIFICATION_DBG("No setting found for [%s]", package_name);
+ err = NOTIFICATION_ERROR_NOT_EXIST_ID;
goto out;
}
- NOTIFICATION_DBG ("row_count [%d] column_count [%d]", row_count, column_count);
+ NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count);
row_count = 1;
if (db) {
if (err == NOTIFICATION_ERROR_NONE) {
sqlite3_exec(db, "END;", NULL, NULL, NULL);
- }
- else {
+ } else {
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
}
is_package_in_setting_table = _is_package_in_setting_table(db, package_name);
switch (operation_type) {
- case OPERATION_TYPE_INSERT_RECORD :
+ case OPERATION_TYPE_INSERT_RECORD:
if (is_package_in_setting_table == true) {
NOTIFICATION_INFO("[%s] is already exist", package_name);
goto out;
sqlite3_ret = sqlite3_prepare_v2(db, "INSERT INTO notification_setting (package_name) VALUES (?) ", -1, &db_statement, NULL);
break;
- case OPERATION_TYPE_DELETE_RECORD :
+ case OPERATION_TYPE_DELETE_RECORD:
if (is_package_in_setting_table == false) {
NOTIFICATION_INFO("[%s] is not exist", package_name);
goto out;
NOTIFICATION_INFO("[%s] will be removed", package_name);
sqlite3_ret = sqlite3_prepare_v2(db, "DELETE FROM notification_setting WHERE package_name = ? ", -1, &db_statement, NULL);
break;
- default :
+ default:
break;
}
NOTIFICATION_INFO("err [%d]", err);
if (err == NOTIFICATION_ERROR_NONE) {
sqlite3_exec(db, "END;", NULL, NULL, NULL);
- }
- else {
+ } else {
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
}
int row_count = 0;
int column_count = 0;
int col_index = 0;
- notification_system_setting_h result_system_setting= NULL;
+ notification_system_setting_h result_system_setting = NULL;
if (system_setting == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
}
if (!row_count) {
- NOTIFICATION_DBG ("No setting found...");
- err= NOTIFICATION_ERROR_NOT_EXIST_ID;
+ NOTIFICATION_DBG("No setting found...");
+ err = NOTIFICATION_ERROR_NOT_EXIST_ID;
goto out;
}
- NOTIFICATION_DBG ("row_count [%d] column_count [%d]", row_count, column_count);
+ NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count);
row_count = 1;
if (db) {
if (err == NOTIFICATION_ERROR_NONE) {
sqlite3_exec(db, "END;", NULL, NULL, NULL);
- }
- else {
+ } else {
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
}
sqlret = db_util_close(db);
DBusError err;
char *message = NULL;
- if(data==NULL||msg==NULL)
- {
+ if (data == NULL || msg == NULL) {
NOTIFICATION_ERR("message is NULL");
return;
}
ret = dbus_message_get_args(msg, &err,
DBUS_TYPE_STRING, &message,
DBUS_TYPE_INVALID);
- if(ret == 0)
- {
+ if (ret == 0) {
NOTIFICATION_ERR("dbus_message_get_args error");
return;
}
if (!md.callback)
return;
- if (strlen(message) <= 0){
+ if (strlen(message) <= 0) {
NOTIFICATION_ERR("message has only NULL");
return;
}
INTERFACE_NAME, MEMBER_NAME,
__notification_status_message_dbus_callback,
user_data);
- if (dbus_handler_size == NULL)
- {
+ if (dbus_handler_size == NULL) {
NOTIFICATION_ERR("fail to add size signal");
return NOTIFICATION_ERROR_FROM_DBUS;
}
/*-----------------------------------------------------------------------------------------*/
/* function prototypes */
-static void testapp_system_signal_handler (int signal_number);
-void testapp_show_prompt (testapp_menu_type_e menu);
+static void testapp_system_signal_handler(int signal_number);
+void testapp_show_prompt(testapp_menu_type_e menu);
/*-----------------------------------------------------------------------------------------*/
/* implementation */
-void testapp_print (char *fmt, ...)
+void testapp_print(char *fmt, ...)
{
va_list args = {0};
va_start(args, fmt);
- vfprintf (stdout, fmt, args);
- va_end (args);
- fflush (stdout);
+ vfprintf(stdout, fmt, args);
+ va_end(args);
+ fflush(stdout);
}
-static gboolean testapp_initialize_testing ()
+static gboolean testapp_initialize_testing()
{
struct timeval tv_1, tv_2;
int interval;
/* register signal handler */
- if ( signal (SIGINT, testapp_system_signal_handler) == SIG_ERR ) {
- testapp_print ("register signal handler fail\n");
+ if (signal(SIGINT, testapp_system_signal_handler) == SIG_ERR) {
+ testapp_print("register signal handler fail\n");
return FALSE;
}
- if ( signal (SIGQUIT, testapp_system_signal_handler) == SIG_ERR ) {
- testapp_print ("register signal handler fail\n");
+ if (signal(SIGQUIT, testapp_system_signal_handler) == SIG_ERR) {
+ testapp_print("register signal handler fail\n");
return FALSE;
}
- if ( signal (SIGTSTP, testapp_system_signal_handler) == SIG_ERR ) {
- testapp_print ("register signal handler fail\n");
+ if (signal(SIGTSTP, testapp_system_signal_handler) == SIG_ERR) {
+ testapp_print("register signal handler fail\n");
return FALSE;
}
- if ( signal (SIGTERM, testapp_system_signal_handler) == SIG_ERR ) {
- testapp_print ("register signal handler fail\n");
+ if (signal(SIGTERM, testapp_system_signal_handler) == SIG_ERR) {
+ testapp_print("register signal handler fail\n");
return FALSE;
}
gettimeofday(&tv_2, NULL);
interval = tv_2.tv_usec - tv_1.tv_usec;
- testapp_print("\t Initializing Proceed time %d us\n",interval);
+ testapp_print("\t Initializing Proceed time %d us\n", interval);
return TRUE;
}
-static gboolean testapp_finalize_testing ()
+static gboolean testapp_finalize_testing()
{
/* TODO : finalizing notification */
return TRUE;
}
-static void testapp_system_signal_handler (int signal_number)
+static void testapp_system_signal_handler(int signal_number)
{
- testapp_print ("signal:%d\n", signal_number);
+ testapp_print("signal:%d\n", signal_number);
switch (signal_number) {
case SIGQUIT:
case SIGINT:
break;
default:
- testapp_print ("unhandled signal:%d\n", signal_number);
+ testapp_print("unhandled signal:%d\n", signal_number);
break;
}
exit(0);
-void testapp_show_menu (testapp_menu_type_e menu)
+void testapp_show_menu(testapp_menu_type_e menu)
{
switch (menu) {
case TESTAPP_MENU_TYPE_MAIN_MENU:
- testapp_print ("==========================================\n");
- testapp_print (" Notification test application \n");
- testapp_print ("==========================================\n");
- testapp_print ("1. Basic Test\n");
- testapp_print ("2. Setting Test\n");
- testapp_print ("0. Exit \n");
- testapp_print ("------------------------------------------\n");
+ testapp_print("==========================================\n");
+ testapp_print(" Notification test application \n");
+ testapp_print("==========================================\n");
+ testapp_print("1. Basic Test\n");
+ testapp_print("2. Setting Test\n");
+ testapp_print("0. Exit \n");
+ testapp_print("------------------------------------------\n");
break;
case TESTAPP_MENU_TYPE_BASIC_TEST_MENU:
- testapp_print ("==========================================\n");
- testapp_print (" Basic test menu \n");
- testapp_print ("==========================================\n");
- testapp_print (" 1. Post a simple notification\n");
- testapp_print (" 2. Post simple notifications repeatedly\n");
- testapp_print (" 3. Post a notification on indicator\n");
- testapp_print (" 4. Post status status message\n");
- testapp_print (" 5. Delete all notification\n");
- testapp_print (" 6. Post a heads notification with a button\n");
- testapp_print (" 7. Post a notification with domain text\n");
- testapp_print (" 8. Load by tag\n");
- testapp_print (" 9. Get list\n");
- testapp_print ("------------------------------------------\n");
+ testapp_print("==========================================\n");
+ testapp_print(" Basic test menu \n");
+ testapp_print("==========================================\n");
+ testapp_print(" 1. Post a simple notification\n");
+ testapp_print(" 2. Post simple notifications repeatedly\n");
+ testapp_print(" 3. Post a notification on indicator\n");
+ testapp_print(" 4. Post status status message\n");
+ testapp_print(" 5. Delete all notification\n");
+ testapp_print(" 6. Post a heads notification with a button\n");
+ testapp_print(" 7. Post a notification with domain text\n");
+ testapp_print(" 8. Load by tag\n");
+ testapp_print(" 9. Get list\n");
+ testapp_print("------------------------------------------\n");
break;
case TESTAPP_MENU_TYPE_SETTING_TEST_MENU:
- testapp_print ("==========================================\n");
- testapp_print (" Setting test menu \n");
- testapp_print ("==========================================\n");
- testapp_print (" 1. Get setting list\n");
- testapp_print (" 2. Update setting\n");
- testapp_print (" 3. Update system setting\n");
- testapp_print (" 4. Refresh setting table\n");
- testapp_print ("------------------------------------------\n");
+ testapp_print("==========================================\n");
+ testapp_print(" Setting test menu \n");
+ testapp_print("==========================================\n");
+ testapp_print(" 1. Get setting list\n");
+ testapp_print(" 2. Update setting\n");
+ testapp_print(" 3. Update system setting\n");
+ testapp_print(" 4. Refresh setting table\n");
+ testapp_print("------------------------------------------\n");
break;
default:
break;
noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
- if(noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
testapp_print("notification_set_display_applist failed[%d]", noti_err);
goto FINISH_OFF;
}
noti_err = notification_status_message_post("This is only a test");
- if(noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
testapp_print("notification_status_message_post failed[%d]", noti_err);
}
}
app_control_err = app_control_create(&app_control);
- if (app_control_err != APP_CONTROL_ERROR_NONE ) {
+ if (app_control_err != APP_CONTROL_ERROR_NONE) {
testapp_print("app_control_create failed[%d]\n", app_control_err);
goto FINISH_OFF;
}
app_control_err = app_control_set_app_id(app_control, "org.tizen.quickpanel");
- if (app_control_err != APP_CONTROL_ERROR_NONE ) {
+ if (app_control_err != APP_CONTROL_ERROR_NONE) {
testapp_print("app_control_set_app_id failed[%d]\n", app_control_err);
goto FINISH_OFF;
}
noti_err = notification_get_event_handler(noti_handle, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
- if (noti_err != NOTIFICATION_ERROR_NONE ||app_control == NULL) {
+ if (noti_err != NOTIFICATION_ERROR_NONE || app_control == NULL) {
testapp_print("notification_get_event_handler failed[%d]", noti_err);
goto FINISH_OFF;
}
return noti_err;
}
-static gboolean testapp_interpret_command_basic_test (int selected_number)
+static gboolean testapp_interpret_command_basic_test(int selected_number)
{
gboolean go_to_loop = TRUE;
}
-void testapp_notification_main ()
+void testapp_notification_main()
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
while (go_to_loop) {
- testapp_show_menu (TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
- testapp_show_prompt (TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
+ testapp_show_menu(TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
+ testapp_show_prompt(TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
if (0 >= scanf("%d", &menu_number))
testapp_print("Invalid input");
notification_setting_get_visibility_class(setting_array + i, &visibility_class);
testapp_print("[%d] : package_name[%s], allow_to_notify[%d], do_not_disturb_except[%d], visibility_class[%d]\n"
- ,i, package_name, allow_to_notify, do_not_disturb_except, visibility_class);
+ , i, package_name, allow_to_notify, do_not_disturb_except, visibility_class);
free(package_name);
}
if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
testapp_print("notification_setting_get_setting_by_package_name failed [%d]", err);
- }
- else {
+ } else {
notification_setting_set_allow_to_notify(setting, 0);
notification_setting_update_setting(setting);
}
return err;
}
-static gboolean testapp_interpret_command_setting_test (int selected_number)
+static gboolean testapp_interpret_command_setting_test(int selected_number)
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
while (go_to_loop) {
- testapp_show_menu (TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
- testapp_show_prompt (TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
+ testapp_show_menu(TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
+ testapp_show_prompt(TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
if (0 >= scanf("%d", &menu_number))
testapp_print("Invalid input");
/* Setting Test } ---------------------------------------------------------------*/
/* Main { ---------------------------------------------------------------------*/
-static gboolean testapp_interpret_command (int menu_number)
+static gboolean testapp_interpret_command(int menu_number)
{
gboolean go_to_loop = TRUE;
return go_to_loop;
}
-void testapp_show_prompt (testapp_menu_type_e menu)
+void testapp_show_prompt(testapp_menu_type_e menu)
{
switch (menu) {
case TESTAPP_MENU_TYPE_MAIN_MENU:
- testapp_print ("[MAIN]# ");
+ testapp_print("[MAIN]# ");
break;
case TESTAPP_MENU_TYPE_BASIC_TEST_MENU:
- testapp_print ("[BASIC_TEST]# ");
+ testapp_print("[BASIC_TEST]# ");
break;
case TESTAPP_MENU_TYPE_SETTING_TEST_MENU:
- testapp_print ("[SETTING_TEST]# ");
+ testapp_print("[SETTING_TEST]# ");
break;
}
}
-int main (int argc, char *argv[])
+int main(int argc, char *argv[])
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
- if ( testapp_initialize_testing() == FALSE ) {
- testapp_print ("Initializing failed.\n");
+ if (testapp_initialize_testing() == FALSE) {
+ testapp_print("Initializing failed.\n");
return 1;
}
while (go_to_loop) {
- testapp_show_menu (TESTAPP_MENU_TYPE_MAIN_MENU);
- testapp_show_prompt (TESTAPP_MENU_TYPE_MAIN_MENU);
- if (0 >= scanf ("%d", &menu_number))
+ testapp_show_menu(TESTAPP_MENU_TYPE_MAIN_MENU);
+ testapp_show_prompt(TESTAPP_MENU_TYPE_MAIN_MENU);
+ if (0 >= scanf("%d", &menu_number))
testapp_print("Invalid input");
- go_to_loop = testapp_interpret_command (menu_number);
+ go_to_loop = testapp_interpret_command(menu_number);
}
testapp_finalize_testing();