sound_manager_test: Print device type with string format 62/211362/4
authorSangchul Lee <sc11.lee@samsung.com>
Fri, 2 Aug 2019 02:11:21 +0000 (11:11 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 7 Aug 2019 07:10:08 +0000 (16:10 +0900)
[Version] 0.5.33
[Issue Type] Testsuite

Change-Id: I6cf221190eb7f33d2fd24b0874c5e015375bb923
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-sound-manager.spec
test/sound_manager_test.c

index 0c957ee9d34316cb3018e2d7b21ac1b7f2712a4d..0e03bdabed37e08e7fae5f58717c7e03b9ed457f 100644 (file)
@@ -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
index 36e2e66081b60a3293b59e9b0489a9b74f61eaee..40c2f8ee753020957ef8b0e8c2dc872e0d1c5119 100644 (file)
@@ -19,7 +19,6 @@
 #include <stdlib.h>
 
 #include <sound_manager.h>
-#include <sound_manager_private.h>
 #include <sound_manager_internal.h>
 #include <mm_sound.h>
 #include <pthread.h>
@@ -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;