Add new API sound_manager_get_device_list,and deprecate sound_manager_get_current_dev... 36/99536/7
authorJeongho Mok <jho.mok@samsung.com>
Wed, 23 Nov 2016 07:22:18 +0000 (16:22 +0900)
committerJeongho Mok <jho.mok@samsung.com>
Fri, 25 Nov 2016 10:23:23 +0000 (19:23 +0900)
[Version] 0.3.79
[Profile] Common
[Issue Type] Add/Deprecate API

Change-Id: I14f6fa7e1940ad167eb9ad7f1cb6eb1f544fae6a

include/sound_manager.h
packaging/capi-media-sound-manager.spec
src/sound_manager.c
src/sound_manager_private.c
test/sound_manager_test.c

index 0eb46d8..30a5c47 100644 (file)
@@ -675,7 +675,7 @@ int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *
  * @brief Adds the device to the stream information for the stream routing.
  * @since_tizen 3.0
  *
- * @remarks    Use sound_manager_get_current_device_list() and sound_manager_get_next_device() to get the device.\n
+ * @remarks    Use sound_manager_get_device_list() and sound_manager_get_next_device() to get the device.\n
  *     #SOUND_MANAGER_ERROR_POLICY could be returned according to the stream type of the @a stream_info.\n
  *     The available types of the @a stream_info for this function are #SOUND_STREAM_TYPE_VOIP and #SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY.
  *
@@ -699,7 +699,7 @@ int sound_manager_add_device_for_stream_routing(sound_stream_info_h stream_info,
  * @brief Removes the device to the stream information for the stream routing.
  * @since_tizen 3.0
  *
- * @remarks    Use sound_manager_get_current_device_list() and sound_manager_get_next_device() to get the device.\n
+ * @remarks    Use sound_manager_get_device_list() and sound_manager_get_next_device() to get the device.\n
  *
  * @param[in]  stream_info     The handle of stream information
  * @param[in]  device          The device item from sound_device_list_h
@@ -1228,10 +1228,11 @@ int sound_manager_unset_session_interrupted_cb(void) TIZEN_DEPRECATED_API;
  */
 
 /**
+ * @deprecated Deprecated since 3.0. Use sound_manager_get_device_list() instead.
  * @brief Gets the list consisting of connected devices.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks    @a device_list should be freed using sound_manager_free_device_list() since 3.0.\n
+ * @remarks    @a Calling this API will deallocate previously obtained list and each item.\n
  *     Use sound_manager_get_next_device() to get the first node of the list.
  *
  * @param[in]  device_mask     The mask value
@@ -1249,9 +1250,39 @@ int sound_manager_unset_session_interrupted_cb(void) TIZEN_DEPRECATED_API;
  * @see sound_manager_get_device_id()
  * @see sound_manager_get_device_name()
  * @see sound_manager_get_device_state()
+ */
+int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound_device_list_h *device_list) TIZEN_DEPRECATED_API;
+
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_DEVICE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Gets the list consisting of connected devices.
+ * @since_tizen 3.0
+ *
+ * @remarks    @a device_list should be freed using sound_manager_free_device_list().\n
+ *     Use sound_manager_get_next_device() to get the first node of the list.
+ *
+ * @param[in]  device_mask     The mask values of #sound_device_mask_e combined with bitwise 'or'
+ * @param[out] device_list     The list of connected devices
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_next_device()
+ * @see sound_manager_get_prev_device()
+ * @see sound_manager_get_device_type()
+ * @see sound_manager_get_device_io_direction()
+ * @see sound_manager_get_device_id()
+ * @see sound_manager_get_device_name()
+ * @see sound_manager_get_device_state()
  * @see sound_manager_free_device_list()
  */
-int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound_device_list_h *device_list);
+int sound_manager_get_device_list(int device_mask, sound_device_list_h *device_list);
 
 /**
  * @brief Frees device list and each item of list.
@@ -1259,14 +1290,14 @@ int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound
  *
  * @remarks    This function will deallocate not only device list itself but also each item.
  *
- * @param[in]  device_list     The device list got with sound_manager_get_current_device_list.
+ * @param[in]  device_list     The device list got with sound_manager_get_device_list.
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  *
  *
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1287,7 +1318,7 @@ int sound_manager_free_device_list(sound_device_list_h device_list);
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_device_list()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
  * @see sound_manager_get_device_io_direction()
@@ -1308,7 +1339,7 @@ int sound_manager_get_next_device(sound_device_list_h device_list, sound_device_
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_device_type()
  * @see sound_manager_get_device_io_direction()
@@ -1328,7 +1359,7 @@ int sound_manager_get_prev_device(sound_device_list_h device_list, sound_device_
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_io_direction()
@@ -1348,7 +1379,7 @@ int sound_manager_get_device_type(sound_device_h device, sound_device_type_e *ty
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1368,7 +1399,7 @@ int sound_manager_get_device_io_direction(sound_device_h device, sound_device_io
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1389,7 +1420,7 @@ int sound_manager_get_device_id(sound_device_h device, int *id);
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1409,7 +1440,7 @@ int sound_manager_get_device_name(sound_device_h device, char **name);
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
@@ -1432,7 +1463,7 @@ int sound_manager_get_device_state(sound_device_h device, sound_device_state_e *
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_device_list()
  * @see sound_manager_get_next_device()
  * @see sound_manager_get_prev_device()
  * @see sound_manager_get_device_type()
index f035615..f609dc7 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.76
+Version:    0.3.79
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 36affde..628f7df 100644 (file)
@@ -1148,7 +1148,17 @@ int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound
 {
        int ret = MM_ERROR_NONE;
 
-       ret = mm_sound_get_current_device_list((mm_sound_device_flags_e)device_mask, device_list);
+       LOGW("DEPRECATION WARNING: %s() is deprecated and will be removed from next release. Use sound_manager_get_device_list() instead.", __func__);
+       ret = mm_sound_get_device_list(device_mask, device_list);
+
+       return _convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_device_list(int device_mask, sound_device_list_h *device_list)
+{
+       int ret = MM_ERROR_NONE;
+
+       ret = mm_sound_get_device_list(device_mask, device_list);
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
index c223443..c0d4390 100644 (file)
@@ -1255,7 +1255,7 @@ int _set_session_mode(_session_mode_e mode)
        case _SESSION_MODE_VOICE_WITH_AUDIO_JACK:       /* Earphone spk & mic */
        case _SESSION_MODE_VOICE_WITH_BLUETOOTH:        /* Bluetooth spk & mic */
                /* check if the device is available now */
-               ret = mm_sound_get_current_device_list(MM_SOUND_DEVICE_ALL_FLAG, &device_list);
+               ret = mm_sound_get_device_list(MM_SOUND_DEVICE_ALL_FLAG, &device_list);
                if (ret != MM_ERROR_NONE) {
                        LOGE("failed to get current device list");
                        goto ERROR_CASE;
index 3981aab..33d2308 100644 (file)
@@ -52,8 +52,9 @@ enum {
        CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB,
        CURRENT_STATUS_SET_DEVICE_MASK,
        CURRENT_STATUS_GET_DEVICE_MASK,
-       CURRENT_STATUS_GET_DEVICE_LIST,
+       CURRENT_STATUS_GET_CURRENT_DEVICE_LIST,
        CURRENT_STATUS_PRINT_DEVICE_LIST,
+       CURRENT_STATUS_GET_DEVICE_LIST,
        CURRENT_STATUS_FREE_DEVICE_LIST,
        CURRENT_STATUS_GET_DEVICE_NEXT,
        CURRENT_STATUS_GET_DEVICE_PREV,
@@ -195,6 +196,8 @@ void _interpret_main_menu(char *cmd)
                g_menu_state = CURRENT_STATUS_SET_DEVICE_MASK;
        else if (strncmp(cmd, "gk", 3) == 0)
                g_menu_state = CURRENT_STATUS_GET_DEVICE_MASK;
+       else if (strncmp(cmd, "gcl", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_CURRENT_DEVICE_LIST;
        else if (strncmp(cmd, "gl", 3) == 0)
                g_menu_state = CURRENT_STATUS_GET_DEVICE_LIST;
        else if (strncmp(cmd, "pl", 3) == 0)
@@ -313,8 +316,9 @@ void display_sub_basic()
        g_print("-----------------------------------------------------------------------------------------\n");
        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("gcl. Get Devices List\t");
        g_print("pl. Print Devices List\t");
+       g_print("gl. Get 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");
@@ -406,6 +410,8 @@ static void displaymenu()
                g_print("*** input device mask (0:ALL, 1:INTERNAL, 2:EXTERNAL, 3:INPUT, 4:OUTPUT, 5:BOTH, 6:ACTIVATED, 7:DEACTIVATED, b:back to the menu\n");
        else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_MASK)
                g_print("*** press enter to get device mask\n");
+       else if (g_menu_state == CURRENT_STATUS_GET_CURRENT_DEVICE_LIST)
+               g_print("*** press enter to get current device list\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)
@@ -953,7 +959,7 @@ static void interpret(char *cmd)
                reset_menu_state();
                break;
        }
-       case CURRENT_STATUS_GET_DEVICE_LIST: {
+       case CURRENT_STATUS_GET_CURRENT_DEVICE_LIST: {
                int ret = SOUND_MANAGER_ERROR_NONE;
                if (!(ret = sound_manager_get_current_device_list(g_device_mask, &g_device_list)))
                        g_print("success to get current device list\n");
@@ -962,6 +968,15 @@ static void interpret(char *cmd)
                reset_menu_state();
                break;
        }
+       case CURRENT_STATUS_GET_DEVICE_LIST: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (!(ret = sound_manager_get_device_list(g_device_mask, &g_device_list)))
+                       g_print("success to get device list\n");
+               else
+                       g_print("fail to get device list, ret[0x%x]\n", ret);
+               reset_menu_state();
+               break;
+       }
        case CURRENT_STATUS_PRINT_DEVICE_LIST: {
                sound_device_list_h device_list;
                sound_device_h device;
@@ -979,8 +994,6 @@ static void interpret(char *cmd)
                                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);
                }