From: Sangchul Lee Date: Fri, 2 Aug 2019 02:11:21 +0000 (+0900) Subject: sound_manager_test: Print device type with string format X-Git-Tag: submit/tizen/20190807.082039~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7d244f3a7f68aca5db527cfd76e52da0703b219;p=platform%2Fcore%2Fapi%2Fsound-manager.git sound_manager_test: Print device type with string format [Version] 0.5.33 [Issue Type] Testsuite Change-Id: I6cf221190eb7f33d2fd24b0874c5e015375bb923 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index 0c957ee..0e03bda 100644 --- a/packaging/capi-media-sound-manager.spec +++ b/packaging/capi-media-sound-manager.spec @@ -1,6 +1,6 @@ Name: capi-media-sound-manager Summary: Sound Manager library -Version: 0.5.32 +Version: 0.5.33 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/test/sound_manager_test.c b/test/sound_manager_test.c index 36e2e66..40c2f8e 100644 --- a/test/sound_manager_test.c +++ b/test/sound_manager_test.c @@ -19,7 +19,6 @@ #include #include -#include #include #include #include @@ -669,7 +668,7 @@ void _volume_changed_cb(sound_type_e type, unsigned int volume, void *user_data) } /* If failed to get some property, just give some default value */ -void _get_device_props_simple(sound_device_h device, int *id, char **type, char **name, +void _get_device_props_simple(sound_device_h device, int *id, const char **type, char **name, const char **direc, const char **state, int *vendor_id, int *product_id, bool *is_running) { int ret; @@ -685,7 +684,7 @@ void _get_device_props_simple(sound_device_h device, int *id, char **type, char if ((ret = sound_manager_get_device_type(device, &_type))) g_print("failed to get device type, ret[0x%x]\n", ret); else - _convert_device_type_enum_to_str(_type, type); + *type = g_device_type_str[_type]; if ((ret = sound_manager_get_device_id(device, id))) g_print("failed to get device id, ret[0x%x]\n", ret); @@ -732,8 +731,8 @@ void _device_connected_cb(sound_device_h device, bool is_connected, void *user_d int id = -1; int vendor_id = -1; int product_id = -1; - char *type, *name; - const char *direc, *state; + char *name; + const char *type, *direc, *state; bool is_running = false; int ret; sound_device_type_e device_type; @@ -749,7 +748,7 @@ void _device_connected_cb(sound_device_h device, bool is_connected, void *user_d if (ret) g_print("fail to sound_manager_get_current_media_playback_device_type, ret(0x%x)\n", ret); else - g_print("current media playback device type is [%d] (0:BuiltinSPK 1:BuiltinRcv 2:BuiltinMic 3:AudioJack 4:BTMedia 5:HDMI 6:Forwarding 7:USBAduio 8:BTVoice)\n", device_type); + g_print("current media playback device type is [%s]\n", g_device_type_str[device_type]); } void _device_running_changed_cb(sound_device_h device, bool is_running, void *user_data) @@ -757,15 +756,15 @@ void _device_running_changed_cb(sound_device_h device, bool is_running, void *us int id = -1; int vendor_id = -1; int product_id = -1; - char *type, *name; - const char *direc, *_state; + char *name; + const char *type, *direc, *state; bool _is_running = false; - _get_device_props_simple(device, &id, &type, &name, &direc, &_state, &vendor_id, &product_id, &_is_running); + _get_device_props_simple(device, &id, &type, &name, &direc, &state, &vendor_id, &product_id, &_is_running); g_print("[Device #%d %s %s] running changed to [ %d ]\n", id, type, name, is_running); g_print(" Direc[ %-4s ] State[ %-12s ] Running[ %d ] VendorID[ %04x ], ProductID[ %04x ]\n", - direc, _state, _is_running, vendor_id, product_id); + direc, state, _is_running, vendor_id, product_id); } void reset_menu_state(void) @@ -965,8 +964,8 @@ static void interpret(char *cmd) int id = -1; int vendor_id = -1; int product_id = -1; - char *type; char *name; + const char *type; const char *direc; const char *state; bool is_running; @@ -1032,8 +1031,8 @@ static void interpret(char *cmd) if ((ret = sound_manager_is_device_running(g_device, &is_running))) g_print("failed to get device state, ret[0x%x]\n", ret); if (!ret) - g_print("-- NEXT device type[%d], io_direction[%d], id[%d], name[%s], state[%s]\n", - type, io_direction, id, name, is_running ? "Running" : "Not running"); + g_print("-- NEXT device type[%s], io_direction[%d], id[%d], name[%s], state[%s]\n", + g_device_type_str[type], io_direction, id, name, is_running ? "Running" : "Not running"); } else { g_print("failed to get next device, ret[0x%x]\n", ret); g_device = NULL; @@ -1061,8 +1060,8 @@ static void interpret(char *cmd) if ((ret = sound_manager_is_device_running(g_device, &is_running))) g_print("failed to get device state, ret[0x%x]\n", ret); if (!ret) - g_print("-- PREV device type[%d], io_direction[%d], id[%d], name[%s], state[%s]\n", - type, io_direction, id, name, is_running ? "Running" : "Not running"); + g_print("-- PREV device type[%s], io_direction[%d], id[%d], name[%s], state[%s]\n", + g_device_type_str[type], io_direction, id, name, is_running ? "Running" : "Not running"); } else { g_print("failed to get previous device, ret[0x%x]\n", ret); } @@ -2056,7 +2055,7 @@ static void interpret(char *cmd) if (ret) g_print("fail to sound_manager_get_current_media_playback_device_type, ret(0x%x)\n", ret); else - g_print("device_type(%d)\n", device_type); + g_print("device type is [%s]\n", g_device_type_str[device_type]); reset_menu_state(); break;