diff options
author | hj kim <backto.kim@samsung.com> | 2020-07-23 14:01:47 +0900 |
---|---|---|
committer | hj kim <backto.kim@samsung.com> | 2020-07-23 15:08:56 +0900 |
commit | 5eb351e56e2bcb2427eba87043fdddf15ed1c912 (patch) | |
tree | 7dda09c725708bb4ce22ce85f06c35188cbb2bba | |
parent | 8d20b28034b733d232c194ab4c9a1e865caad30c (diff) | |
download | media-controller-5eb351e56e2bcb2427eba87043fdddf15ed1c912.tar.gz media-controller-5eb351e56e2bcb2427eba87043fdddf15ed1c912.tar.bz2 media-controller-5eb351e56e2bcb2427eba87043fdddf15ed1c912.zip |
Add static keyword and apply tizen coding rule
Change-Id: Idd2c7aea4fe8d0ebe5b03d153a214efef4135c74
-rw-r--r-- | src/media_controller_client.c | 2 | ||||
-rwxr-xr-x | test/client_test/media_controller_client_test.c | 148 |
2 files changed, 71 insertions, 79 deletions
diff --git a/src/media_controller_client.c b/src/media_controller_client.c index a7c1a95..f9697e3 100644 --- a/src/media_controller_client.c +++ b/src/media_controller_client.c @@ -1407,7 +1407,7 @@ int mc_client_send_custom_cmd(mc_client_h client, const char *server_name, const return ret; } -int __mc_client_get_bundle_from_search(mc_search_h search, bundle **res_bundle) +static int __mc_client_get_bundle_from_search(mc_search_h search, bundle **res_bundle) { int ret = MEDIA_CONTROLLER_ERROR_NONE; media_controller_search_s *mc_search = (media_controller_search_s *)search; diff --git a/test/client_test/media_controller_client_test.c b/test/client_test/media_controller_client_test.c index 41b08a9..2ae7130 100755 --- a/test/client_test/media_controller_client_test.c +++ b/test/client_test/media_controller_client_test.c @@ -84,13 +84,12 @@ enum { | LOCAL VARIABLE DEFINITIONS: | ---------------------------------------------------------------------------*/ int g_menu_state = CURRENT_STATE_MAIN_MENU; -int g_menu_information_state = CURRENT_STATE_INFORMATION_GET_MODE; /*--------------------------------------------------------------------------- | LOCAL FUNCTION PROTOTYPES: | ---------------------------------------------------------------------------*/ -void __get_and_check_metadata(mc_metadata_h metadata) +static void __get_and_check_metadata(mc_metadata_h metadata) { int ret = MEDIA_CONTROLLER_ERROR_NONE; int idx = 0; @@ -147,13 +146,13 @@ void __get_and_check_metadata(mc_metadata_h metadata) } } -void _mc_server_state_updated_cb(const char *server_name, mc_server_state_e state, void *user_data) +static void __mc_server_state_updated_cb(const char *server_name, mc_server_state_e state, void *user_data) { media_controller_client_s *_client = (media_controller_client_s *)g_mc_client; mc_debug("[Client:%s] Server state(%d) updated from server[%s]", _client->client_name, state, server_name); } -void _mc_playback_updated_cb(const char *server_name, mc_playback_h playback, void *user_data) +static void __mc_playback_updated_cb(const char *server_name, mc_playback_h playback, void *user_data) { media_controller_client_s *_client = (media_controller_client_s *)g_mc_client; unsigned long long position = 0; @@ -176,7 +175,7 @@ void _mc_playback_updated_cb(const char *server_name, mc_playback_h playback, vo g_free(index); } -void _mc_metadata_updated_cb(const char *server_name, mc_metadata_h metadata, void *user_data) +static void __mc_metadata_updated_cb(const char *server_name, mc_metadata_h metadata, void *user_data) { media_controller_client_s *_client = (media_controller_client_s *)g_mc_client; mc_debug("[Client:%s] Metadata updated from server[%s] ", _client->client_name, server_name); @@ -184,19 +183,19 @@ void _mc_metadata_updated_cb(const char *server_name, mc_metadata_h metadata, vo __get_and_check_metadata(metadata); } -void _mc_shuffle_mode_updated_cb(const char *server_name, mc_shuffle_mode_e mode, void *user_data) +static void __mc_shuffle_mode_updated_cb(const char *server_name, mc_shuffle_mode_e mode, void *user_data) { media_controller_client_s *_client = (media_controller_client_s *)g_mc_client; mc_debug("[Client:%s] Shuffle mode(%d) updated from server[%s]", _client->client_name, mode, server_name); } -void _mc_repeat_mode_updated_cb(const char *server_name, mc_repeat_mode_e mode, void *user_data) +static void __mc_repeat_mode_updated_cb(const char *server_name, mc_repeat_mode_e mode, void *user_data) { media_controller_client_s *_client = (media_controller_client_s *)g_mc_client; mc_debug("[Client:%s] Repeat mode(%d) updated from server[%s]", _client->client_name, mode, server_name); } -bool _mc_playlist_item_cb(const char *index, mc_metadata_h metadata, void *user_data) +static bool __mc_playlist_item_cb(const char *index, mc_metadata_h metadata, void *user_data) { mc_debug("playlist index [%s]", index); __get_and_check_metadata(metadata); @@ -204,7 +203,7 @@ bool _mc_playlist_item_cb(const char *index, mc_metadata_h metadata, void *user_ return true; } -void _mc_playlist_updated_cb(const char *server_name, mc_playlist_update_mode_e mode, const char *playlist_name, mc_playlist_h playlist, void *user_data) +static void __mc_playlist_updated_cb(const char *server_name, mc_playlist_update_mode_e mode, const char *playlist_name, mc_playlist_h playlist, void *user_data) { int ret = MEDIA_CONTROLLER_ERROR_NONE; media_controller_client_s *_client = (media_controller_client_s *)g_mc_client; @@ -228,7 +227,7 @@ void _mc_playlist_updated_cb(const char *server_name, mc_playlist_update_mode_e mc_debug("playlist item count [%d]", _item_cnt); - ret = mc_playlist_foreach_item(playlist, _mc_playlist_item_cb, NULL); + ret = mc_playlist_foreach_item(playlist, __mc_playlist_item_cb, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Fail to mc_playlist_foreach_item [%d]", ret); } @@ -242,7 +241,7 @@ static bool __mc_activated_server_cb(const char *server_name, void *user_data) return TRUE; } -void _mc_cmd_reply_received_cb(const char *server_name, const char *request_id, int result_code, bundle *data, void *user_data) +static void __mc_cmd_reply_received_cb(const char *server_name, const char *request_id, int result_code, bundle *data, void *user_data) { char *value = NULL; media_controller_client_s *_client = (media_controller_client_s *)g_mc_client; @@ -284,7 +283,7 @@ void _mc_cmd_reply_received_cb(const char *server_name, const char *request_id, } -void _mc_custom_event_received_cb(const char *server_name, const char *request_id, const char *event, bundle *data, void *user_data) +static void __mc_custom_event_received_cb(const char *server_name, const char *request_id, const char *event, bundle *data, void *user_data) { int ret = MEDIA_CONTROLLER_ERROR_NONE; @@ -307,7 +306,7 @@ void _mc_custom_event_received_cb(const char *server_name, const char *request_i bundle_free(bundle_reply); } -void _mc_playback_ability_updated_cb(const char *server_name, mc_playback_ability_h ability, void *user_data) +static void __mc_playback_ability_updated_cb(const char *server_name, mc_playback_ability_h ability, void *user_data) { int ret = MEDIA_CONTROLLER_ERROR_NONE; media_controller_client_s *_client = (media_controller_client_s *)g_mc_client; @@ -430,8 +429,7 @@ static void __mc_360_mode_updated_cb(const char *server_name, bool enabled, void mc_debug("[Client:%s] 360 mode(%d) updated from server[%s]", _client->client_name, enabled, server_name); } - -static gboolean _create() +static gboolean __create() { g_print("== create \n"); int ret = MEDIA_CONTROLLER_ERROR_NONE; @@ -446,7 +444,7 @@ static gboolean _create() return TRUE; } -static gboolean _foreach() +static gboolean __foreach() { g_print("== create \n"); int ret = MEDIA_CONTROLLER_ERROR_NONE; @@ -461,37 +459,37 @@ static gboolean _foreach() return TRUE; } -static gboolean _set_callback() +static gboolean __set_callback() { int ret = TRUE; mc_debug_fenter(); - ret = mc_client_set_server_updated_cb(g_mc_client, _mc_server_state_updated_cb, NULL); + ret = mc_client_set_server_updated_cb(g_mc_client, __mc_server_state_updated_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_server_updated_cb [%d]", ret); - ret = mc_client_set_playback_updated_cb(g_mc_client, _mc_playback_updated_cb, NULL); + ret = mc_client_set_playback_updated_cb(g_mc_client, __mc_playback_updated_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_playback_updated_cb [%d]", ret); - ret = mc_client_set_metadata_updated_cb(g_mc_client, _mc_metadata_updated_cb, NULL); + ret = mc_client_set_metadata_updated_cb(g_mc_client, __mc_metadata_updated_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_metadata_updated_cb [%d]", ret); - ret = mc_client_set_shuffle_mode_updated_cb(g_mc_client, _mc_shuffle_mode_updated_cb, NULL); + ret = mc_client_set_shuffle_mode_updated_cb(g_mc_client, __mc_shuffle_mode_updated_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_shuffle_mode_updated_cb [%d]", ret); - ret = mc_client_set_repeat_mode_updated_cb(g_mc_client, _mc_repeat_mode_updated_cb, NULL); + ret = mc_client_set_repeat_mode_updated_cb(g_mc_client, __mc_repeat_mode_updated_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_repeat_mode_updated_cb [%d]", ret); - ret = mc_client_set_playlist_updated_cb(g_mc_client, _mc_playlist_updated_cb, NULL); + ret = mc_client_set_playlist_updated_cb(g_mc_client, __mc_playlist_updated_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_playlist_updated_cb [%d]", ret); - ret = mc_client_set_cmd_reply_received_cb(g_mc_client, _mc_cmd_reply_received_cb, NULL); + ret = mc_client_set_cmd_reply_received_cb(g_mc_client, __mc_cmd_reply_received_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_reply_received_cb [%d]", ret); - ret = mc_client_set_custom_event_received_cb(g_mc_client, _mc_custom_event_received_cb, NULL); + ret = mc_client_set_custom_event_received_cb(g_mc_client, __mc_custom_event_received_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_custom_event_received_cb [%d]", ret); - ret = mc_client_set_playback_ability_updated_cb(g_mc_client, _mc_playback_ability_updated_cb, NULL); + ret = mc_client_set_playback_ability_updated_cb(g_mc_client, __mc_playback_ability_updated_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_playback_ability_updated_cb [%d]", ret); ret = mc_client_set_shuffle_ability_updated_cb(g_mc_client, __mc_shuffle_ability_updated_cb, NULL); @@ -526,7 +524,7 @@ static gboolean _set_callback() return ret; } -static gboolean _unset_callback() +static gboolean __unset_callback() { int ret = MEDIA_CONTROLLER_ERROR_NONE; @@ -573,7 +571,7 @@ static gboolean _unset_callback() return TRUE; } -bool server_playlist_cb(mc_playlist_h playlist, void *user_data) +static bool __server_playlist_cb(mc_playlist_h playlist, void *user_data) { int ret = MEDIA_CONTROLLER_ERROR_NONE; int _item_cnt = 0; @@ -596,14 +594,14 @@ bool server_playlist_cb(mc_playlist_h playlist, void *user_data) mc_debug("playlist item count [%d]", _item_cnt); - ret = mc_playlist_foreach_item(playlist, _mc_playlist_item_cb, NULL); + ret = mc_playlist_foreach_item(playlist, __mc_playlist_item_cb, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Fail to mc_playlist_foreach_item [%d]", ret); return true; } -static gboolean _get_info(int type) +static gboolean __get_info(int type) { int ret = MEDIA_CONTROLLER_ERROR_NONE; mc_server_state_e server_state; @@ -692,7 +690,7 @@ static gboolean _get_info(int type) g_print("playlist count: %d", item_cnt); - ret = mc_playlist_foreach_playlist(g_server_name, server_playlist_cb, NULL); + ret = mc_playlist_foreach_playlist(g_server_name, __server_playlist_cb, NULL); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_get_server_playlist [%d]", ret); break; @@ -800,7 +798,7 @@ static gboolean _get_info(int type) return TRUE; } -static gboolean _send() +static gboolean __send() { g_print("== send command to latest server \n"); int ret = MEDIA_CONTROLLER_ERROR_NONE; @@ -936,7 +934,7 @@ static gboolean _send() return TRUE; } -static gboolean _subscribe() +static gboolean __subscribe() { int ret = MEDIA_CONTROLLER_ERROR_NONE; int idx = 0; @@ -956,7 +954,7 @@ static gboolean _subscribe() return TRUE; } -static gboolean _unsubscribe() +static gboolean __unsubscribe() { int ret = MEDIA_CONTROLLER_ERROR_NONE; int idx = 0; @@ -976,7 +974,7 @@ static gboolean _unsubscribe() return TRUE; } -static gboolean _destroy() +static gboolean __destroy() { int ret = MEDIA_CONTROLLER_ERROR_NONE; @@ -1042,27 +1040,21 @@ static int _test_app_launch() /***************************************************************/ /** Testsuite */ /***************************************************************/ -void quit(void) +static void __quit(void) { if (g_mc_client != NULL) - _destroy(); + __destroy(); g_main_loop_quit(mainloop); } -void reset_current_information_menu_state() -{ - g_menu_information_state = CURRENT_STATE_INFORMATION_GET_MODE; - return; -} - -void reset_current_menu_state() +static void __reset_current_menu_state() { g_menu_state = CURRENT_STATE_MAIN_MENU; return; } -static void display_information_menu(void) +static void __display_information_menu(void) { g_print("\n"); g_print("====================================================\n"); @@ -1081,7 +1073,7 @@ static void display_information_menu(void) } -static void display_main_menu(void) +static void __display_main_menu(void) { g_print("\n"); g_print("====================================================\n"); @@ -1102,39 +1094,39 @@ static void display_main_menu(void) } -static void display_menu(void) +static void __display_menu(void) { if (g_menu_state == CURRENT_STATE_MAIN_MENU) - display_main_menu(); + __display_main_menu(); else if (g_menu_state == CURRENT_STATE_INFORMATION_GET_MENU) - display_information_menu(); + __display_information_menu(); else g_print("*** Unknown status.\n"); } -void _interpret_information_menu(char *cmd) +static void __interpret_information_menu(char *cmd) { int len = strlen(cmd); if (len == 1) { if (!strncmp(cmd, "1", len)) - _get_info(1); + __get_info(1); else if (!strncmp(cmd, "2", len)) - _get_info(2); + __get_info(2); else if (!strncmp(cmd, "3", len)) - _get_info(3); + __get_info(3); else if (!strncmp(cmd, "4", len)) - _get_info(4); + __get_info(4); else if (!strncmp(cmd, "5", len)) - _get_info(5); + __get_info(5); else if (!strncmp(cmd, "6", len)) - _get_info(6); + __get_info(6); else if (!strncmp(cmd, "7", len)) - _get_info(7); + __get_info(7); else if (!strncmp(cmd, "8", len)) - _get_info(8); + __get_info(8); else if (!strncmp(cmd, "0", len)) - reset_current_menu_state(); + __reset_current_menu_state(); else g_print("wrong command [%s] \n", cmd); } else { @@ -1142,53 +1134,53 @@ void _interpret_information_menu(char *cmd) } } -void _interpret_main_menu(char *cmd) +static void __interpret_main_menu(char *cmd) { int len = strlen(cmd); if (len == 1) { if (!strncmp(cmd, "1", len)) - _create(); + __create(); else if (!strncmp(cmd, "2", len)) - _foreach(); + __foreach(); else if (!strncmp(cmd, "3", len)) - _set_callback(); + __set_callback(); else if (!strncmp(cmd, "4", len)) - _unset_callback(); + __unset_callback(); else if (!strncmp(cmd, "5", len)) g_menu_state = CURRENT_STATE_INFORMATION_GET_MENU; else if (!strncmp(cmd, "6", len)) - _send(); + __send(); else if (!strncmp(cmd, "7", len)) - _subscribe(); + __subscribe(); else if (!strncmp(cmd, "8", len)) - _unsubscribe(); + __unsubscribe(); else if (!strncmp(cmd, "9", len)) - _destroy(); + __destroy(); else if (!strncmp(cmd, "0", len)) - quit(); + __quit(); } else { g_print("wrong command\n"); } } -static void interpret_cmd(char *cmd) +static void __interpret_cmd(char *cmd) { switch (g_menu_state) { case CURRENT_STATE_MAIN_MENU: - _interpret_main_menu(cmd); - display_menu(); + __interpret_main_menu(cmd); + __display_menu(); break; case CURRENT_STATE_INFORMATION_GET_MENU: - _interpret_information_menu(cmd); - display_menu(); + __interpret_information_menu(cmd); + __display_menu(); break; default: g_print("Invalid command\n"); } } -gboolean input(GIOChannel *channel, GIOCondition cond, gpointer data) +static gboolean __input(GIOChannel *channel, GIOCondition cond, gpointer data) { gchar buf[MAX_STRING_LEN]; gsize read; @@ -1204,7 +1196,7 @@ gboolean input(GIOChannel *channel, GIOCondition cond, gpointer data) buf[read] = '\0'; g_strstrip(buf); - interpret_cmd(buf); + __interpret_cmd(buf); return TRUE; @@ -1303,7 +1295,7 @@ int main(int argc, char **argv) GIOChannel *stdin_channel = NULL; stdin_channel = g_io_channel_unix_new(0); g_io_channel_set_flags(stdin_channel, G_IO_FLAG_NONBLOCK, NULL); - g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)input, NULL); + g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)__input, NULL); g_playback_state = MC_PLAYBACK_STATE_PLAYING; g_playback_action = MC_PLAYBACK_ACTION_PLAY; @@ -1314,7 +1306,7 @@ int main(int argc, char **argv) mainloop = g_main_loop_new(NULL, FALSE); //_test_app_launch(); - display_menu(); + __display_menu(); g_main_loop_run(mainloop); g_main_loop_unref(mainloop); |