diff options
author | hj kim <backto.kim@samsung.com> | 2019-01-11 14:53:17 +0900 |
---|---|---|
committer | hj kim <backto.kim@samsung.com> | 2019-01-11 14:53:17 +0900 |
commit | 4dfaf82c4914ea871e819200b4972608cd930690 (patch) | |
tree | b63d9673b6ce23f0d730fbc87b80dc5f5a6ae0e6 | |
parent | 6801fc4b1f9603029ae793887b76c8dfb136e5ed (diff) | |
download | media-controller-4dfaf82c4914ea871e819200b4972608cd930690.tar.gz media-controller-4dfaf82c4914ea871e819200b4972608cd930690.tar.bz2 media-controller-4dfaf82c4914ea871e819200b4972608cd930690.zip |
Just add some debug msg to check activated server/client list
Change-Id: Id96b94abcfabcc0e8922ad730986a60881517b30
-rwxr-xr-x[-rw-r--r--] | src/media_controller_client.c | 0 | ||||
-rwxr-xr-x | src/media_controller_db.c | 43 | ||||
-rwxr-xr-x | src/media_controller_util.c | 2 |
3 files changed, 39 insertions, 6 deletions
diff --git a/src/media_controller_client.c b/src/media_controller_client.c index 85cce27..85cce27 100644..100755 --- a/src/media_controller_client.c +++ b/src/media_controller_client.c diff --git a/src/media_controller_db.c b/src/media_controller_db.c index 4f70ab8..ad64225 100755 --- a/src/media_controller_db.c +++ b/src/media_controller_db.c @@ -978,6 +978,8 @@ int mc_db_check_server_table_exist(void *handle, const char *server_name, bool * mc_retvm_if(handle == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL"); mc_retvm_if(server_name == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "server_name is NULL"); + mc_debug("server name [%s]", server_name); + sql_str = sqlite3_mprintf("SELECT COUNT(*) FROM SQLITE_MASTER WHERE type='table' and name='%q'", server_name); mc_retvm_if(!MC_STRING_VALID(sql_str), MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "SQL string is null"); @@ -1004,6 +1006,8 @@ int mc_db_check_server_table_exist(void *handle, const char *server_name, bool * *exist = TRUE; } else { mc_debug("No server info [%s]", server_name); + mc_db_foreach_server_list(handle, NULL, NULL); + *exist = FALSE; } @@ -1024,6 +1028,8 @@ int mc_db_check_client_table_exist(void *handle, const char *client_name, bool * mc_retvm_if(handle == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL"); mc_retvm_if(client_name == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "server_name is NULL"); + mc_debug("client name [%s]", client_name); + sql_str = sqlite3_mprintf("SELECT COUNT(*) FROM '%q' WHERE client_name='%q'", MC_DB_TABLE_CLIENT_LIST, client_name); mc_retvm_if(!MC_STRING_VALID(sql_str), MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "SQL string is null"); @@ -1050,6 +1056,8 @@ int mc_db_check_client_table_exist(void *handle, const char *client_name, bool * *exist = TRUE; } else { mc_debug("No client info [%s]", client_name); + mc_db_foreach_client_list(handle, NULL, NULL); + *exist = FALSE; } @@ -1065,6 +1073,7 @@ int mc_db_foreach_server_list(void *handle, mc_activated_server_cb callback, voi sqlite3 *db_handle = (sqlite3 *)handle; char *sql_str = NULL; sqlite3_stmt *stmt = NULL; + int idx = 0; mc_retvm_if(db_handle == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL"); @@ -1085,18 +1094,29 @@ int mc_db_foreach_server_list(void *handle, mc_activated_server_cb callback, voi return MEDIA_CONTROLLER_ERROR_NONE; } + mc_info("[ * Activated Server List - Start * ]"); + while (SQLITE_ROW == ret) { char *server_name = NULL; server_name = strdup((char *)sqlite3_column_text(stmt, 0)); - if (callback(server_name, user_data) == false) { - MC_SAFE_FREE(server_name); - break; + + idx++; + mc_info("[%d] %s", idx, server_name); + + if (callback != NULL) { + if (callback(server_name, user_data) == false) { + MC_SAFE_FREE(server_name); + break; + } } + MC_SAFE_FREE(server_name); ret = sqlite3_step(stmt); } + mc_info("[ * Activated Server List - End * ]"); + SQLITE3_FINALIZE(stmt); SQLITE3_SAFE_FREE(sql_str); @@ -1109,6 +1129,7 @@ int mc_db_foreach_client_list(void *handle, mc_activated_client_cb callback, voi sqlite3 *db_handle = (sqlite3 *)handle; char *sql_str = NULL; sqlite3_stmt *stmt = NULL; + int idx = 0; mc_retvm_if(db_handle == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL"); @@ -1129,18 +1150,28 @@ int mc_db_foreach_client_list(void *handle, mc_activated_client_cb callback, voi return MEDIA_CONTROLLER_ERROR_NONE; } + mc_info("[ * Activated Client List - Start * ]"); + while (SQLITE_ROW == ret) { char *client_name = NULL; client_name = strdup((char *)sqlite3_column_text(stmt, 0)); - if (callback(client_name, user_data) == false) { - MC_SAFE_FREE(client_name); - break; + + idx++; + mc_info("[%d] %s", idx, client_name); + + if (callback != NULL) { + if (callback(client_name, user_data) == false) { + MC_SAFE_FREE(client_name); + break; + } } MC_SAFE_FREE(client_name); ret = sqlite3_step(stmt); } + mc_info("[ * Activated Client List - End * ]"); + SQLITE3_FINALIZE(stmt); SQLITE3_SAFE_FREE(sql_str); diff --git a/src/media_controller_util.c b/src/media_controller_util.c index f3b82d7..0ba4519 100755 --- a/src/media_controller_util.c +++ b/src/media_controller_util.c @@ -92,6 +92,8 @@ int mc_util_get_own_name(char **name) *name = g_strdup(temp); + mc_info("app id : [%s]", *name); + return MEDIA_CONTROLLER_ERROR_NONE; } |