testsuite : print device list when get current device list 86/96286/3
authorJeongho Mok <jho.mok@samsung.com>
Tue, 8 Nov 2016 05:50:40 +0000 (14:50 +0900)
committerJeongho Mok <jho.mok@samsung.com>
Thu, 10 Nov 2016 07:01:47 +0000 (16:01 +0900)
[Version] 0.3.75
[Profile] Common
[Issue Type] Testsuite

Change-Id: I0af0941d3e3e09d1d59376797c0f36f78e97535f

packaging/capi-media-sound-manager.spec
test/sound_manager_test.c

index 4804054..e10e5fa 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.74
+Version:    0.3.75
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 5301384..3981aab 100644 (file)
@@ -53,6 +53,7 @@ enum {
        CURRENT_STATUS_SET_DEVICE_MASK,
        CURRENT_STATUS_GET_DEVICE_MASK,
        CURRENT_STATUS_GET_DEVICE_LIST,
+       CURRENT_STATUS_PRINT_DEVICE_LIST,
        CURRENT_STATUS_FREE_DEVICE_LIST,
        CURRENT_STATUS_GET_DEVICE_NEXT,
        CURRENT_STATUS_GET_DEVICE_PREV,
@@ -196,6 +197,8 @@ void _interpret_main_menu(char *cmd)
                g_menu_state = CURRENT_STATUS_GET_DEVICE_MASK;
        else if (strncmp(cmd, "gl", 3) == 0)
                g_menu_state = CURRENT_STATUS_GET_DEVICE_LIST;
+       else if (strncmp(cmd, "pl", 3) == 0)
+               g_menu_state = CURRENT_STATUS_PRINT_DEVICE_LIST;
        else if (strncmp(cmd, "fl", 3) == 0)
                g_menu_state = CURRENT_STATUS_FREE_DEVICE_LIST;
        else if (strncmp(cmd, "gn", 3) == 0)
@@ -311,6 +314,7 @@ void display_sub_basic()
        g_print("sk. Set Devices Mask(default ALL)\t");
        g_print("gk. Get Devices Mask\n");
        g_print("gl. Get Devices List\t");
+       g_print("pl. Print Devices List\t");
        g_print("fl. Free Devices List\n");
        g_print("gn. Get Next Device\t\t");
        g_print("gp. Get Prev Device\n");
@@ -404,6 +408,8 @@ static void displaymenu()
                g_print("*** press enter to get device mask\n");
        else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_LIST)
                g_print("*** press enter to get device list\n");
+       else if (g_menu_state == CURRENT_STATUS_PRINT_DEVICE_LIST)
+               g_print("*** press enter to print device list\n");
        else if (g_menu_state == CURRENT_STATUS_FREE_DEVICE_LIST)
                g_print("*** press enter to free device list\n");
        else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_NEXT)
@@ -956,6 +962,31 @@ static void interpret(char *cmd)
                reset_menu_state();
                break;
        }
+       case CURRENT_STATUS_PRINT_DEVICE_LIST: {
+               sound_device_list_h device_list;
+               sound_device_h device;
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int id = -1;
+               char *type;
+               char *name;
+               const char *direc;
+               const char *state;
+               const char *avail_modes;
+               if (!(ret = sound_manager_get_current_device_list(g_device_mask, &device_list))) {
+                       g_print("success to get current device list\n");
+                       while (!sound_manager_get_next_device(device_list, &device)) {
+                               _get_device_props_simple(device, &id, &type, &name, &direc, &state, &avail_modes);
+                               g_print("[ Device #%d %s %s ]\n", id, type, name);
+                               g_print("    Direc[ %-4s ] State[ %-12s ] Avail-Modes[ %s ]\n", direc, state, avail_modes);
+                       }
+                       if ((ret = sound_manager_free_device_list(device_list)))
+                               g_print("fail to free device list, ret[0x%x]\n", ret);
+               } else {
+                       g_print("fail to get current device list, ret[0x%x]\n", ret);
+               }
+               reset_menu_state();
+               break;
+       }
        case CURRENT_STATUS_FREE_DEVICE_LIST: {
                int ret = SOUND_MANAGER_ERROR_NONE;
                if (!(ret = sound_manager_free_device_list(g_device_list))) {