--- /dev/null
+Seungbae Shin <seungbae.shin@samsung.com>
+Sangchul Lee <sc11.lee@samsung.com>
SET(project_prefix "capi")
SET(prefix "/usr")
SET(version "0.0.1")
-SET(maintainer "Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>")
SET(description "A Sound Manager library in Tizen Native API")
SET(service "media")
SET(submodule "sound-manager")
)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
-#ADD_SUBDIRECTORY(test)
+ADD_SUBDIRECTORY(test)
IF(UNIX)
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __TIZEN_MEDIA_SOUND_MANAGER_DOC_H__
+#define __TIZEN_MEDIA_SOUND_MANAGER_DOC_H__
+
+
+/**
+ * @file sound_manager_doc.h
+ * @brief This file contains high level documentation of the Sound Manager API.
+ */
+
+/**
+ * @ingroup CAPI_MEDIA_FRAMEWORK
+ * @defgroup CAPI_MEDIA_SOUND_MANAGER_MODULE Sound Manager
+ * @brief The @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API provides functions to get and set sound parameters like volume and session policy.
+ *
+ * @section CAPI_MEDIA_SOUND_MANAGER_MODULE_HEADER Required Header
+ * \#include <sound_manager.h>
+ *
+ * @section CAPI_MEDIA_SOUND_MANAGER_OVERVIEW Overview
+ * The Sound Manager service allows APIs to manage audio output.
+ *
+ * The Sound Manager API allows you to:
+ * - check/control output volumes
+ * - handle a volume changed notification
+ * - determine a sound session policy
+ * - handle the notification of a sound session interruption
+ * - query the basic information of connected sound devices
+ * - handle the notification for connection of a sound device, and for changed information of a sound device
+ *
+ * @subsection CAPI_MEDIA_SOUND_MANAGER_LIFE_CYCLE_ASYNCHRONOUS_OPERATIONS Asynchronous operations
+ * The Sound Manager API allows only asynchronous operations. \n
+ * Thus the result will be passed to the application via the callback mechanism.
+ * An appropriate callback can be called in response to changes initiated from outside the application. \n
+ * Possible callbacks are listed below:
+ * <p>
+ * <ul>
+ * <li> sound_manager_volume_changed_cb() - invoked when volume level is changed.<p></li>
+ * <li> sound_session_interrupted_cb() - invoked when the session is interrupted.<p></li>
+ * <li> sound_device_connected_cb() - invoked when the connection of a sound device is changed.<p></li>
+ * <li> sound_device_information_changed_cb() - invoked when the information of a sound device is changed.<p></li>
+ * </ul>
+ *
+ * @subsection CAPI_MEDIA_SOUND_MANAGER_MODULE_LIFE_CYCLE_CALLBACK_OPERATIONS Callback(Event) Operations
+ * The callback mechanism is used to notify the application about significant sound manager events.
+ * <div><table class="doxtable" >
+ * <tr>
+ * <th><b> REGISTER</b></th>
+ * <th><b> UNREGISTER</b></th>
+ * <th><b> CALLBACK</b></th>
+ * <th><b> DESCRIPTION</b></th>
+ * </tr>
+ * <tr>
+ * <td> sound_manager_set_volume_changed_cb()</td>
+ * <td> sound_manager_unset_volume_changed_cb()</td>
+ * <td> sound_manager_volume_changed_cb()</td>
+ * <td> This callback is called when volume value is changed.</td>
+ * </tr>
+ * <tr>
+ * <td> sound_manager_set_session_interrupted_cb()</td>
+ * <td> sound_manager_unset_session_interrupted_cb()</td>
+ * <td> sound_session_interrupted_cb()</td>
+ * <td> This callback is called when audio session is interrupted.</td>
+ * </tr>
+ * <tr>
+ * <td> sound_manager_set_device_connected_cb()</td>
+ * <td> sound_manager_unset_device_connected_cb()</td>
+ * <td> sound_device_connected_cb()</td>
+ * <td> This callback is called when the connection of a sound device is changed.</td>
+ * </tr>
+ * <tr>
+ * <td> sound_manager_set_device_information_changed_cb()</td>
+ * <td> sound_manager_unset_device_information_changed_cb()</td>
+ * <td> sound_device_information_changed_cb()</td>
+ * <td> This callback is called when the information of a sound device is changed.</td>
+ * </tr>
+ * </table></div>
+ *
+*/
+
+/**
+ * @ingroup CAPI_MEDIA_SOUND_MANAGER_MODULE
+ * @defgroup CAPI_MEDIA_SOUND_MANAGER_VOLUME_MODULE Volume
+ * @brief The @ref CAPI_MEDIA_SOUND_MANAGER_VOLUME_MODULE API provides functions to check and control volumes.
+ * @section CAPI_MEDIA_SOUND_MANAGER_VOLUME_MODULE_HEADER Required Header
+ * \#include <sound_manager.h>
+ *
+ * @section CAPI_MEDIA_SOUND_MANAGER_VOLUME_MODULE_OVERVIEW Overview
+ * The Sound Manager Volume API allows you to:
+ * - check/control output volumes
+ * - handle a volume changed notification
+ *
+ * The Sound Manager has predefined types of sounds.(system, notification, alarm, ringtone, media, call, voip, voice).
+ *
+ * Current volume level of each type can be checked with sound_manager_get_volume().
+ * To get the maximum supported volume level of each type, call sound_manager_get_max_volume().
+ * The volume level of each type can be adjusted with sound_manager_set_volume().
+ *
+ * The type of currently playing sound may be obtained by calling sound_manager_get_current_sound_type().
+ * To set the type of the currently playing sound forcibly, call sound_manager_set_current_sound_type().
+ *
+ *
+*/
+
+/**
+ * @ingroup CAPI_MEDIA_SOUND_MANAGER_MODULE
+ * @defgroup CAPI_MEDIA_SOUND_MANAGER_SESSION_MODULE Session
+ * @brief The @ref CAPI_MEDIA_SOUND_MANAGER_SESSION_MODULE API provides functions to control a session.
+ * @section CAPI_MEDIA_SOUND_MANAGER_SESSION_MODULE_HEADER Required Header
+ * \#include <sound_manager.h>
+ *
+ * @section CAPI_MEDIA_SOUND_MANAGER_SESSION_MODULE_OVERVIEW Overview
+ * The Sound Manager Session API allows you to:
+ * - determine a sound session policy
+ * - handle the notification of a sound session interruption
+ *
+ * The Sound Manager has predefined sound sessions (media, alarm, notification, emergency, voip)
+ *
+ * @section CAPI_MEDIA_SOUND_MANAGER_MODULE_FEATURE Related Features
+ * APIs for voip sound session are related with the following features:\n
+ * - http://tizen.org/feature/microphone\n
+ * - http://tizen.org/feature/sip.voip\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+*/
+
+/**
+ * @ingroup CAPI_MEDIA_SOUND_MANAGER_MODULE
+ * @defgroup CAPI_MEDIA_SOUND_MANAGER_DEVICE_MODULE Device
+ * @brief The @ref CAPI_MEDIA_SOUND_MANAGER_DEVICE_MODULE API provides functions to query the information of sound devices.
+ * @section CAPI_MEDIA_SOUND_MANAGER_DEIVCE_MODULE_HEADER Required Header
+ * \#include <sound_manager.h>
+ *
+ * @section CAPI_MEDIA_SOUND_MANAGER_DEVICE_MODULE_OVERVIEW Overview
+ * The Sound Manager Device API allows you to:
+ * - query the basic information of connected sound devices.
+ * - handle the sound device's connection and information change notification.
+ *
+ * The list of currently connected sound device can be obtained by calling sound_manager_get_current_device_list().
+ * To get the handle of each sound device, call sound_manager_get_next_device() and sound_manager_get_prev_device().
+ *
+ * Device information, such as "type", "IO direction", "state", "ID", "name", can be obtained by calling corresponding APIs.
+ *
+ *
+*/
+
+#endif /* __TIZEN_MEDIA_SOUND_MANAGER_DOC_H__ */
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TIZEN_MEDIA_SOUND_MANAGER_H__
+#define __TIZEN_MEDIA_SOUND_MANAGER_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @file sound_manager.h
+ * @brief This file contains the Sound Manager API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for sound manager's error codes.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ SOUND_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ SOUND_MANAGER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ SOUND_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ SOUND_MANAGER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
+ SOUND_MANAGER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ SOUND_MANAGER_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+ SOUND_MANAGER_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data */
+ SOUND_MANAGER_ERROR_INTERNAL = TIZEN_ERROR_SOUND_MANAGER | 01, /**< Internal error inside the sound system */
+ SOUND_MANAGER_ERROR_POLICY = TIZEN_ERROR_SOUND_MANAGER | 02, /**< Noncompliance with the sound system policy */
+ SOUND_MANAGER_ERROR_NO_PLAYING_SOUND = TIZEN_ERROR_SOUND_MANAGER | 03, /**< No playing sound */
+} sound_manager_error_e;
+
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_VOLUME_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for sound type.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ SOUND_TYPE_SYSTEM, /**< Sound type for system */
+ SOUND_TYPE_NOTIFICATION, /**< Sound type for notifications */
+ SOUND_TYPE_ALARM, /**< Sound type for alarm */
+ SOUND_TYPE_RINGTONE, /**< @internal Sound type for ringtones */
+ SOUND_TYPE_MEDIA, /**< Sound type for media */
+ SOUND_TYPE_CALL, /**< @internal Sound type for call */
+ SOUND_TYPE_VOIP, /**< @internal Sound type for voip */
+ SOUND_TYPE_VOICE, /**< Sound type for voice */
+} sound_type_e;
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_SESSION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for session type.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ SOUND_SESSION_TYPE_MEDIA = 0, /**< Media type */
+ SOUND_SESSION_TYPE_ALARM, /**< Alarm type */
+ SOUND_SESSION_TYPE_NOTIFICATION, /**< Notification type */
+ SOUND_SESSION_TYPE_EMERGENCY, /**< Emergency type */
+ SOUND_SESSION_TYPE_VOIP, /**< VOIP type */
+} sound_session_type_e;
+
+/**
+ * @brief Enumeration for session option for starting.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ SOUND_SESSION_OPTION_MIX_WITH_OTHERS_WHEN_START = 0, /**< This session will be mixed with others when starting (default) */
+ SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START, /**< This session will interrupt other sessions when starting */
+} sound_session_option_for_starting_e;
+
+/**
+ * @brief Enumeration for session option during play.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY = 0, /**< This session will be interrupted by other sessions during play (default) */
+ SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY, /**< This session will not be interrupted by other media sessions */
+} sound_session_option_for_during_play_e;
+
+/**
+ * @brief Enumeration for session option for resumption.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM = 0, /**< This session will be resumed according to system policy (default) */
+ SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED, /**< This session will be resumed according to system policy and when the media session which interrupted this session is paused */
+} sound_session_option_for_resumption_e;
+
+/**
+ * @brief Enumeration for voip session mode.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ SOUND_SESSION_VOIP_MODE_RINGTONE = 0, /**< voip mode for ringtone */
+ SOUND_SESSION_VOIP_MODE_VOICE_WITH_BUILTIN_RECEIVER, /**< voip mode for during call with built-in receiver */
+ SOUND_SESSION_VOIP_MODE_VOICE_WITH_BUILTIN_SPEAKER, /**< voip mode for during call with built-in speaker */
+ SOUND_SESSION_VOIP_MODE_VOICE_WITH_AUDIO_JACK, /**< voip mode for during call with audio jack */
+ SOUND_SESSION_VOIP_MODE_VOICE_WITH_BLUETOOTH, /**< voip mode for during call with bluetooth */
+} sound_session_voip_mode_e;
+
+/**
+ * @brief Enumeration for sound session interrupted type.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ SOUND_SESSION_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed*/
+ SOUND_SESSION_INTERRUPTED_BY_MEDIA, /**< Interrupted by media application*/
+ SOUND_SESSION_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call*/
+ SOUND_SESSION_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones*/
+ SOUND_SESSION_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict*/
+ SOUND_SESSION_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm*/
+ SOUND_SESSION_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency*/
+ SOUND_SESSION_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification*/
+} sound_session_interrupted_code_e;
+
+/**
+ * @brief Called when the playing sound session is interrupted.
+ * @since_tizen 2.3
+ * @param[in] code The interrupted code
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre You should register this callback using sound_manager_set_session_interrupted_cb().
+ * @see sound_manager_set_session_interrupted_cb()
+ * @see sound_manager_unset_session_interrupted_cb()
+ */
+typedef void(* sound_session_interrupted_cb)(sound_session_interrupted_code_e code, void *user_data);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_DEVICE_MODULE
+ * @{
+ */
+
+/**
+ * @brief sound device handle
+ * @since_tizen 2.3
+ */
+typedef void* sound_device_h;
+
+/**
+ * @brief sound device list handle
+ * @since_tizen 2.3
+ */
+typedef void* sound_device_list_h;
+
+/**
+* @brief Enumeration for sound device type.
+* @since_tizen 2.3
+*/
+typedef enum{
+ SOUND_DEVICE_BUILTIN_SPEAKER, /**< Built-in speaker */
+ SOUND_DEVICE_BUILTIN_RECEIVER, /**< Built-in receiver */
+ SOUND_DEVICE_BUILTIN_MIC, /**< Built-in mic */
+ SOUND_DEVICE_AUDIO_JACK, /**< Audio jack that can be connected to wired accessory such as headphone, headset, and so on */
+ SOUND_DEVICE_BLUETOOTH, /**< Bluetooth */
+ SOUND_DEVICE_HDMI, /**< HDMI */
+ SOUND_DEVICE_MIRRORING, /**< MIRRORING */
+ SOUND_DEVICE_USB_AUDIO, /**< USB Audio */
+} sound_device_type_e;
+
+/**
+* @brief Enumeration for sound device direction.
+* @since_tizen 2.3
+*/
+typedef enum {
+ SOUND_DEVICE_IO_DIRECTION_IN, /**< Input device */
+ SOUND_DEVICE_IO_DIRECTION_OUT, /**< Output device */
+ SOUND_DEVICE_IO_DIRECTION_BOTH, /**< Input/output device (both directions are available) */
+} sound_device_io_direction_e;
+
+
+/**
+* @brief Enumeration for sound device state.
+* @since_tizen 2.3
+*/
+typedef enum {
+ SOUND_DEVICE_STATE_DEACTIVATED, /**< Deactivated state */
+ SOUND_DEVICE_STATE_ACTIVATED, /**< Activated state */
+} sound_device_state_e;
+
+/**
+* @brief Enumeration for sound device mask.
+* @since_tizen 2.3
+*/
+typedef enum {
+ SOUND_DEVICE_IO_DIRECTION_IN_MASK = 0x0001, /**< Mask for input devices */
+ SOUND_DEVICE_IO_DIRECTION_OUT_MASK = 0x0002, /**< Mask for output devices */
+ SOUND_DEVICE_IO_DIRECTION_BOTH_MASK = 0x0004, /**< Mask for input/output devices (both directions are available) */
+ SOUND_DEVICE_TYPE_INTERNAL_MASK = 0x0010, /**< Mask for built-in devices */
+ SOUND_DEVICE_TYPE_EXTERNAL_MASK = 0x0020, /**< Mask for external devices */
+ SOUND_DEVICE_STATE_DEACTIVATED_MASK = 0x1000, /**< Mask for deactivated devices */
+ SOUND_DEVICE_STATE_ACTIVATED_MASK = 0x2000, /**< Mask for activated devices */
+ SOUND_DEVICE_ALL_MASK = 0xFFFF, /**< Mask for all devices */
+} sound_device_mask_e;
+
+/**
+* @brief Enumeration for changed information of sound device.
+* @since_tizen 2.3
+*/
+typedef enum {
+ SOUND_DEVICE_CAHNGED_INFO_STATE, /**< State of the device was changed */
+ SOUND_DEVICE_CHANGED_INFO_IO_DIRECTION, /**< IO direction of the device was changed */
+} sound_device_changed_info_e;
+
+/**
+ * @brief Called when the state of connection of a sound device was changed.
+ * @since_tizen 2.3
+ * @param[in] sound_device_h The sound_device
+ * @param[in] is_connected The state of device connection
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre You should register this callback using sound_manager_set_device_connected_cb().
+ * @see sound_manager_set_device_connected_cb()
+ * @see sound_manager_unset_device_connected_cb()
+ */
+typedef void(* sound_device_connected_cb)(sound_device_h device, bool is_connected, void *user_data);
+
+/**
+ * @brief Called when the information of a sound device was changed.
+ * @since_tizen 2.3
+ * @param[in] sound_device_h The sound_device
+ * @param[in] changed_info The entry of sound device information
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre You should register this callback using sound_manager_set_device_information_changed_cb().
+ * @see sound_manager_set_device_information_changed_cb()
+ * @see sound_manager_unset_device_information_changed_cb()
+ */
+typedef void(* sound_device_information_changed_cb)(sound_device_h device, sound_device_changed_info_e changed_info, void *user_data);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_VOLUME_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called when the system volume has changed.
+ * @since_tizen 2.3
+ * @param[in] type The sound type of the changed volume
+ * @param[in] volume The new volume value
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre sound_manager_set_volume() will invoke this callback if you register it using sound_manager_set_volume_changed_cb().
+ * @see sound_manager_set_volume_changed_cb()
+ * @see sound_manager_unset_volume_changed_cb()
+ */
+typedef void (*sound_manager_volume_changed_cb)(sound_type_e type, unsigned int volume, void *user_data);
+
+/**
+ * @brief Gets the maximum volume level supported for a particular sound type.
+ * @since_tizen 2.3
+ * @param[in] type The sound type
+ * @param[out] max The maximum volume level
+ * @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_set_volume()
+ * @see sound_manager_get_volume()
+ */
+int sound_manager_get_max_volume(sound_type_e type, int *max);
+
+/**
+ * @brief Sets the volume level specified for a particular sound type.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/volume.set
+ * @param[in] type The sound type
+ * @param[in] volume The volume level to be set
+ * @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_PERMISSION_DENIED Permission denied
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_max_volume()
+ * @see sound_manager_get_volume()
+ */
+int sound_manager_set_volume(sound_type_e type, int volume);
+
+/**
+ * @brief Gets the volume level specified for a particular sound type.
+ * @since_tizen 2.3
+ * @param[in] type The sound type
+ * @param[out] volume The current volume level
+ * @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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_max_volume()
+ * @see sound_manager_set_volume()
+ */
+int sound_manager_get_volume(sound_type_e type, int *volume);
+
+/**
+ * @brief Sets the type of the sound being currently played.
+ * @since_tizen 2.3
+ * @param[in] type The sound type to set
+ * @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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_current_sound_type()
+ * @see sound_manager_unset_current_sound_type()
+ */
+int sound_manager_set_current_sound_type(sound_type_e type);
+
+/**
+ * @brief Gets the type of the sound being currently played.
+ * @since_tizen 2.3
+ * @param[out] type The current sound type
+ * @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_PLAYING_SOUND No playing sound
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_set_current_sound_type()
+ * @see sound_manager_unset_current_sound_type()
+ */
+int sound_manager_get_current_sound_type(sound_type_e *type);
+
+/**
+ * @brief Unsets the type of the sound being currently played.
+ * @since_tizen 2.3
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_set_current_sound_type()
+ * @see sound_manager_get_current_sound_type()
+ */
+int sound_manager_unset_current_sound_type(void);
+
+/**
+ * @brief Registers a callback function to be invoked when the volume level is changed.
+ * @since_tizen 2.3
+ * @param[in] callback Callback function to indicate change in volume
+ * @param[in] user_data The user data to be passed to the callback function
+ * @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_INTERNAL Internal error inside the sound system
+ * @post sound_manager_volume_changed_cb() will be invoked.
+ * @see sound_manager_unset_volume_changed_cb()
+ * @see sound_manager_volume_changed_cb()
+ */
+int sound_manager_set_volume_changed_cb(sound_manager_volume_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the volume change callback.
+ * @since_tizen 2.3
+ * @return 0 on success, otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_set_volume_changed_cb()
+ */
+int sound_manager_unset_volume_changed_cb(void);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_SESSION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Sets the application's sound session type.
+ * @since_tizen 2.3
+ * @param[in] type The session type to set
+ * @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_NOT_SUPPORTED Not supported
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @see sound_manager_get_session_type()
+ * @see sound_manager_set_media_session_option()
+ * @see sound_manager_get_media_session_option()
+ * @see sound_manager_set_media_session_resumption_option()
+ * @see sound_manager_get_media_session_resumption_option()
+ * @see sound_manager_set_voip_session_mode()
+ * @see sound_manager_get_voip_session_mode()
+ */
+int sound_manager_set_session_type(sound_session_type_e type);
+
+/**
+ * @brief Gets the application's sound session type.
+ * @since_tizen 2.3
+ * @param[in] type The session type
+ * @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_set_session_type()
+ * @see sound_manager_set_media_session_option()
+ * @see sound_manager_get_media_session_option()
+ * @see sound_manager_set_media_session_resumption_option()
+ * @see sound_manager_get_media_session_resumption_option()
+ * @see sound_manager_set_voip_session_mode()
+ * @see sound_manager_get_voip_session_mode()
+ */
+int sound_manager_get_session_type(sound_session_type_e *type);
+
+/**
+ * @brief Sets the media sound session option.
+ * @since_tizen 2.3
+ * @param[in] s_option The session option for starting
+ * @param[in] d_option The session option for during play
+ * @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_INVALID_OPERATION Invalid operation
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @pre Call sound_manager_set_session_type(SOUND_SESSION_TYPE_MEDIA) before calling this function.
+ * @see sound_manager_set_session_type()
+ * @see sound_manager_get_session_type()
+ * @see sound_manager_get_media_session_option()
+ * @see sound_manager_set_media_session_resumption_option()
+ * @see sound_manager_get_media_session_resumption_option()
+ */
+int sound_manager_set_media_session_option(sound_session_option_for_starting_e s_option, sound_session_option_for_during_play_e d_option);
+
+/**
+ * @brief Gets the media sound session option.
+ * @since_tizen 2.3
+ * @param[out] s_option The session option for starting
+ * @param[out] d_option The session option for during play
+ * @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_INVALID_OPERATION Invalid operation
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @see sound_manager_set_session_type()
+ * @see sound_manager_get_session_type()
+ * @see sound_manager_set_media_session_option()
+ * @see sound_manager_set_media_session_resumption_option()
+ * @see sound_manager_get_media_session_resumption_option()
+ */
+int sound_manager_get_media_session_option(sound_session_option_for_starting_e *s_option, sound_session_option_for_during_play_e *d_option);
+
+/**
+ * @brief Sets the media sound session resumption option.
+ * @since_tizen 2.3
+ * @param[in] option The session resumption option
+ * @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_INVALID_OPERATION Invalid operation
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @pre Call sound_manager_set_session_type(SOUND_SESSION_TYPE_MEDIA) before calling this function.
+ * @see sound_manager_set_session_type()
+ * @see sound_manager_get_session_type()
+ * @see sound_manager_set_media_session_option()
+ * @see sound_manager_get_media_session_option()
+ * @see sound_manager_get_media_session_resumption_option()
+ */
+int sound_manager_set_media_session_resumption_option(sound_session_option_for_resumption_e option);
+
+/**
+ * @brief Gets the media sound session resumption option.
+ * @since_tizen 2.3
+ * @param[out] option The session resumption option
+ * @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_INVALID_OPERATION Invalid operation
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @see sound_manager_set_session_type()
+ * @see sound_manager_get_session_type()
+ * @see sound_manager_set_media_session_option()
+ * @see sound_manager_get_media_session_option()
+ * @see sound_manager_set_media_session_resumption_option()
+ */
+int sound_manager_get_media_session_resumption_option(sound_session_option_for_resumption_e *option);
+
+/**
+ * @brief Sets the mode of the voip sound session.
+ * @since_tizen 2.3
+ * @param[in] mode The voip session mode
+ * @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_NOT_SUPPORTED Not supported
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @pre Call sound_manager_set_session_type(SOUND_SESSION_TYPE_VOIP) before calling this function.
+ * @see sound_manager_set_session_type()
+ * @see sound_manager_get_session_type()
+ * @see sound_manager_get_voip_session_mode()
+*/
+int sound_manager_set_voip_session_mode(sound_session_voip_mode_e mode);
+
+/**
+ * @brief Gets the mode of the voip sound session.
+ * @since_tizen 2.3
+ * @param[out] mode The voip session mode
+ * @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_NOT_SUPPORTED Not supported
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
+ * @pre Call sound_manager_set_session_type(SOUND_SESSION_TYPE_VOIP) before calling this function.
+ * @see sound_manager_set_session_type()
+ * @see sound_manager_get_session_type()
+ * @see sound_manager_set_voip_session_mode()
+*/
+int sound_manager_get_voip_session_mode(sound_session_voip_mode_e *mode);
+
+/**
+ * @brief Registers a callback function to be invoked when the sound session being played was interrupted.
+ * @since_tizen 2.3
+ * @param[in] callback The interrupted callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @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_POLICY Noncompliance with the sound system policy
+ * @post sound_session_interrupted_cb() will be invoked.
+ * @see sound_manager_unset_session_interrupted_cb()
+ * @see sound_session_interrupted_cb()
+ */
+int sound_manager_set_session_interrupted_cb(sound_session_interrupted_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function which is called when the sound session being played is interrupted.
+ * @since_tizen 2.3
+ * @return 0 on success,
+ * otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_set_session_interrupted_cb()
+ */
+int sound_manager_unset_session_interrupted_cb(void);
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_SOUND_MANAGER_DEVICE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Gets the list consisting of connected devices.
+ * @since_tizen 2.3
+ * @param[in] device_mask The mask value
+ * @param[out] device_list The list of connected devices
+ *
+ * @remarks @a Use sound_manager_get_next_device() to get the first node of the 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
+ * @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()
+ */
+int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound_device_list_h *device_list);
+
+/**
+ * @brief Gets the next item of the device list.
+ * @since_tizen 2.3
+ * @param[in] device_list The list of connected devices
+ * @param[out] device The device item
+ * @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
+ * @see sound_manager_get_current_device_list()
+ * @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()
+ */
+int sound_manager_get_next_device (sound_device_list_h device_list, sound_device_h *device);
+
+/**
+ * @brief Gets the previous item of the device list.
+ * @since_tizen 2.3
+ * @param[in] device_list The list of connected devices
+ * @param[out] device The device item
+ * @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
+ * @see sound_manager_get_current_device_list()
+ * @see sound_manager_get_next_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()
+ */
+int sound_manager_get_prev_device (sound_device_list_h device_list, sound_device_h *device);
+
+/**
+ * @brief Gets the type of the device.
+ * @since_tizen 2.3
+ * @param[in] device The device item
+ * @param[out] type The type of the device
+ * @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_next_device()
+ * @see sound_manager_get_prev_device()
+ * @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()
+ */
+int sound_manager_get_device_type (sound_device_h device, sound_device_type_e *type);
+
+/**
+ * @brief Gets the io direction of the device.
+ * @since_tizen 2.3
+ * @param[in] device The device item
+ * @param[out] io_direction The io direction of the device
+ * @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_next_device()
+ * @see sound_manager_get_prev_device()
+ * @see sound_manager_get_device_type()
+ * @see sound_manager_get_device_id()
+ * @see sound_manager_get_device_name()
+ * @see sound_manager_get_device_state()
+ */
+int sound_manager_get_device_io_direction (sound_device_h device, sound_device_io_direction_e *io_direction);
+
+/**
+ * @brief Gets the id of the device.
+ * @since_tizen 2.3
+ * @param[in] device The device item
+ * @param[out] id The id of the device
+ * @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_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_name()
+ * @see sound_manager_get_device_state()
+ */
+int sound_manager_get_device_id (sound_device_h device, int *id);
+
+/**
+ * @brief Gets the name of the device.
+ * @since_tizen 2.3
+ * @param[in] device The device item
+ * @param[out] name The name of the device
+ * @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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_current_device_list()
+ * @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_state()
+ */
+int sound_manager_get_device_name (sound_device_h device, char **name);
+
+/**
+ * @brief Gets the state of the device.
+ * @since_tizen 2.3
+ * @param[in] device The device item
+ * @param[out] state The state of the device
+ * @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_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()
+ */
+int sound_manager_get_device_state (sound_device_h device, sound_device_state_e *state);
+
+/**
+ * @brief Registers a callback function to be invoked when the state of connection of a sound device was changed.
+ * @since_tizen 2.3
+ * @param[in] device_mask The mask value
+ * @param[in] callback The interrupted callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @remarks @a The initial state of sound devices connected is deactivated.
+ *
+ * @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_INTERNAL Internal error inside the sound system
+ * @post sound_device_connected_cb() will be invoked.
+ * @see sound_manager_unset_device_connected_cb()
+ * @see sound_device_connected_cb()
+ */
+int sound_manager_set_device_connected_cb (sound_device_mask_e device_mask, sound_device_connected_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function which is called when the state of connection of a sound device was changed.
+ * @since_tizen 2.3
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_set_device_connected_cb()
+ */
+int sound_manager_unset_device_connected_cb (void);
+
+/**
+ * @brief Registers a callback function to be invoked when the information of a sound device was changed.
+ * @since_tizen 2.3
+ * @param[in] device_mask The mask value
+ * @param[in] callback The interrupted callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ * @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_INTERNAL Internal error inside the sound system
+ * @post sound_device_information_changed_cb() will be invoked.
+ * @see sound_manager_unset_device_information_changed_cb()
+ * @see sound_device_information_changed_cb()
+ */
+int sound_manager_set_device_information_changed_cb (sound_device_mask_e device_mask, sound_device_information_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function which is called when the information of a sound device was changed.
+ * @since_tizen 2.3
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_set_device_information_changed_cb()
+ */
+int sound_manager_unset_device_information_changed_cb (void);
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_MEDIA_SOUND_MANAGER_H__ */
* limitations under the License.
*/
-#ifndef __TIZEN_MEDIA_SOUND_MANAGER_PRIVATE_H__
-#define __TIZEN_MEDIA_SOUND_MANAGER_PRIVATE_H__
+#ifndef __TIZEN_MEDIA_SOUND_MANAGER_INTERNAL_H__
+#define __TIZEN_MEDIA_SOUND_MANAGER_INTERNAL_H__
#ifdef __cplusplus
extern "C"
{
#endif
-struct sound_call_session_s
-{
- int previous_session;
-};
-
-struct sound_multi_session_s
-{
- int previous_session;
- sound_multi_session_type_e type;
- int type_option;
-};
+#define SOUND_TYPE_NUM SOUND_TYPE_VOICE + 1
+#define SOUND_CALL_SESSION_MODE_NUM SOUND_CALL_SESSION_MODE_VOICE_CALL_FORWARDING + 1
+#define SOUND_SESSION_WATCH_TYPE_NUM SOUND_SESSION_WATCH_TYPE_ALARM + 1
+#define SOUND_SESSION_WATCH_STATE_NUM SOUND_SESSION_WATCH_STATE_START + 1
-int __convert_sound_manager_error_code(const char *func, int code);
+/**
+ * @file sound_manager_internal.h
+ * @brief This file contains the Sound Manager API (internal header)
+ */
#ifdef __cplusplus
}
#endif
-#endif /* __TIZEN_MEDIA_SOUND_MANAGER_PRIVATE_H__ */
+#endif /* __TIZEN_MEDIA_SOUND_MANAGER_INTERNAL_H__ */
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TIZEN_MEDIA_SOUND_MANAGER_PRIVATE_H__
+#define __TIZEN_MEDIA_SOUND_MANAGER_PRIVATE_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdio.h>
+#include <limits.h>
+#include <string.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <dlog.h>
+#include <mm_session.h>
+#include <mm_session_private.h>
+#include <mm_sound.h>
+#include <mm_sound_private.h>
+#include "sound_manager_internal.h"
+
+#define SOUND_SESSION_TYPE_DEFAULT SOUND_SESSION_TYPE_MEDIA
+
+typedef struct {
+ int is_registered;
+ void *user_data;
+ sound_session_interrupted_cb user_cb;
+}_session_interrupt_info_s;
+
+typedef struct {
+ void *user_data;
+ sound_manager_volume_changed_cb user_cb;
+}_volume_changed_info_s;
+
+typedef struct {
+ void *user_data;
+ sound_device_connected_cb user_cb;
+}_device_connected_info_s;
+
+typedef struct {
+ void *user_data;
+ sound_device_information_changed_cb user_cb;
+}_device_changed_info_s;
+
+int __convert_sound_manager_error_code(const char *func, int code);
+
+void __session_interrupt_cb(session_msg_t msg, session_event_t event, void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_MEDIA_SOUND_MANAGER_PRIVATE_H__ */
+++ /dev/null
-Seungkeun Lee <sngn.lee@samsung.com>
-Kangho Hur <kanho.hur@samsung.com>
-Seungbae Shin <seungbae.shin at samsung.com>
+++ /dev/null
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-
+++ /dev/null
-Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
-Except as noted, this software is licensed under Apache License, Version 2.
-Please, see the LICENSE file for Apache License terms and conditions.
+++ /dev/null
-<manifest>
- <request>
- <domain name="_" />
- </request>
-</manifest>
+++ /dev/null
-
-# Package Information for pkg-config
-
-prefix=@PREFIX@
-exec_prefix=/usr
-libdir=/usr/lib
-includedir=/usr/include/media
-
-Name: @PC_NAME@
-Description: @PACKAGE_DESCRIPTION@
-Version: @VERSION@
-Requires: @PC_REQUIRED@
-Libs: -L${libdir} @PC_LDFLAGS@
-Cflags: -I${includedir}
-
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-
-#ifndef __TIZEN_MEDIA_SOUND_MANAGER_H__
-#define __TIZEN_MEDIA_SOUND_MANAGER_H__
-
-#include <tizen.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define SOUND_MANAGER_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x30
-
-/**
- * @file sound_manager.h
- * @brief This file contains the Sound Manager API
- */
-
-/**
- * @addtogroup CAPI_MEDIA_SOUND_MANAGER_MODULE
- * @{
- */
-
-/**
- * @brief Enumerations of sound type
- */
-typedef enum
-{
- SOUND_TYPE_SYSTEM, /**< Sound type for system */
- SOUND_TYPE_NOTIFICATION, /**< Sound type for notifications */
- SOUND_TYPE_ALARM, /**< Sound type for alarm */
- SOUND_TYPE_RINGTONE, /**< Sound type for ringtones */
- SOUND_TYPE_MEDIA, /**< Sound type for media */
- SOUND_TYPE_CALL, /**< Sound type for call */
-} sound_type_e;
-
-/**
- * @brief Enumerations of volume key type
- */
-typedef enum
-{
- VOLUME_KEY_TYPE_NONE=-1, /**< Volume key type for current played sound */
- VOLUME_KEY_TYPE_SYSTEM=0, /**< Volume key type for system sound */
- VOLUME_KEY_TYPE_NOTIFICATION, /**< Volume key type for notifications sound*/
- VOLUME_KEY_TYPE_ALARM, /**< Volume key type for alarm sound */
- VOLUME_KEY_TYPE_RINGTONE, /**< Volume key type for ringtones sound */
- VOLUME_KEY_TYPE_MEDIA, /**< Volume key type for media sound */
- VOLUME_KEY_TYPE_CALL, /**< Volume key type for call sound */
-} volume_key_type_e;
-
-/**
- * @brief error codes for sound manager
- */
-typedef enum{
- SOUND_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- SOUND_MANAGER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- SOUND_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- SOUND_MANAGER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
- SOUND_MANAGER_ERROR_NO_PLAYING_SOUND = SOUND_MANAGER_ERROR_CLASS | 01, /**< No playing sound */
-} sound_manager_error_e;
-
-/**
- * @brief Enumerations of session type
- */
-typedef enum{
- SOUND_SESSION_TYPE_SHARE = 0, /**< Share type : shares it's session with other share type application. */
- SOUND_SESSION_TYPE_EXCLUSIVE, /**< Exclusive type : make previous session stop.*/
- SOUND_SESSION_TYPE_ALARM, /**< Alarm type */
- SOUND_SESSION_TYPE_EMERGENCY, /**< Emergency type */
-} sound_session_type_e;
-
-/**
- * @brief Enumerations of session notification
- */
-typedef enum{
- SOUND_SESSION_NOTIFY_STOP = 0, /**< Stop : session of application has interrupted by policy. */
- SOUND_SESSION_NOTIFY_RESUME, /**< Resume : session interrupt of application has ended. */
-} sound_session_notify_e;
-
-/**
- * @brief Enumerations of audio input device type.
- */
-typedef enum{
- SOUND_DEVICE_IN_MIC = 0x01, /**< Device builtin mic. */
- SOUND_DEVICE_IN_WIRED_ACCESSORY = 0x02, /**< Wired input devices */
- SOUND_DEVICE_IN_BT_SCO = 0x04, /**< Bluetooth SCO device */
-} sound_device_in_e;
-
-/**
- * @brief Enumerations of audio output device type.
- */
-typedef enum{
- SOUND_DEVICE_OUT_SPEAKER = 0x01<<8, /**< Device builtin speaker */
- SOUND_DEVICE_OUT_RECEIVER = 0x02<<8, /**< Device builtin receiver */
- SOUND_DEVICE_OUT_WIRED_ACCESSORY = 0x04<<8, /**< Wired output devices such as headphone, headset, and so on. */
- SOUND_DEVICE_OUT_BT_SCO = 0x08<<8, /**< Bluetooth SCO device */
- SOUND_DEVICE_OUT_BT_A2DP = 0x10<<8, /**< Bluetooth A2DP device */
- SOUND_DEVICE_OUT_DOCK = 0x020<<8, /**< DOCK device */
- SOUND_DEVICE_OUT_HDMI = 0x040<<8, /**< HDMI device */
- SOUND_DEVICE_OUT_WFD = 0x080<<8, /**< WFD device */
- SOUND_DEVICE_OUT_USB_AUDIO = 0x100<<8, /**< USB Audio device */
-} sound_device_out_e;
-
-/**
- * @brief Enumerations of route type.
- */
-typedef enum{
- SOUND_ROUTE_OUT_SPEAKER = SOUND_DEVICE_OUT_SPEAKER, /**< Routing audio output to builtin device such as internal speaker. */
- SOUND_ROUTE_OUT_WIRED_ACCESSORY = SOUND_DEVICE_OUT_WIRED_ACCESSORY,/**< Routing audio output to wired accessory such as headphone, headset, and so on. */
- SOUND_ROUTE_OUT_BLUETOOTH = SOUND_DEVICE_OUT_BT_A2DP, /**< Routing audio output to bluetooth A2DP. */
- SOUND_ROUTE_OUT_DOCK = SOUND_DEVICE_OUT_DOCK, /**< Routing audio output to DOCK */
- SOUND_ROUTE_OUT_HDMI = SOUND_DEVICE_OUT_HDMI, /**< Routing audio output to HDMI */
- SOUND_ROUTE_OUT_WFD = SOUND_DEVICE_OUT_WFD, /**< Routing audio output to WFD */
- SOUND_ROUTE_OUT_USB_AUDIO = SOUND_DEVICE_OUT_USB_AUDIO, /**< Routing audio output to USB Audio */
- SOUND_ROUTE_IN_MIC = SOUND_DEVICE_IN_MIC, /**< Routing audio input to device builtin mic. */
- SOUND_ROUTE_IN_WIRED_ACCESSORY = SOUND_DEVICE_IN_WIRED_ACCESSORY, /**< Routing audio input to wired accessory. */
- SOUND_ROUTE_IN_MIC_OUT_RECEIVER = SOUND_DEVICE_IN_MIC |SOUND_DEVICE_OUT_RECEIVER, /**< Routing audio input to device builtin mic and routing audio output to builtin receiver*/
- SOUND_ROUTE_IN_MIC_OUT_SPEAKER = SOUND_DEVICE_IN_MIC |SOUND_DEVICE_OUT_SPEAKER , /**< Routing audio input to device builtin mic and routing audio output to builtin speaker */
- SOUND_ROUTE_IN_MIC_OUT_HEADPHONE = SOUND_DEVICE_IN_MIC | SOUND_DEVICE_OUT_WIRED_ACCESSORY,/**< Routing audio input to device builtin mic and routing audio output to headphone */
- SOUND_ROUTE_INOUT_HEADSET = SOUND_DEVICE_IN_WIRED_ACCESSORY | SOUND_DEVICE_OUT_WIRED_ACCESSORY, /**< Routing audio input and output to headset*/
- SOUND_ROUTE_INOUT_BLUETOOTH = SOUND_DEVICE_IN_BT_SCO |SOUND_DEVICE_OUT_BT_SCO /**< Routing audio input and output to bluetooth SCO */
-} sound_route_e;
-
-/**
- * @brief Enumerations of call session type
- */
-typedef enum{
- SOUND_CALL_SESSION_TYPE_CALL = 0, /**< call type */
- SOUND_CALL_SESSION_TYPE_VOIP = 1, /**< voip type */
- SOUND_SESSION_TYPE_CALL = 0,
- SOUND_SESSION_TYPE_VOIP = 1,
-} sound_call_session_type_e;
-
-/**
- * @brief Enumerations of communication session type
- */
-typedef enum{
- SOUND_CALL_SESSION_MODE_VOICE = 0, /**< normal talking mode */
- SOUND_CALL_SESSION_MODE_RINGTONE, /**< ringtone mode */
- SOUND_CALL_SESSION_MODE_MEDIA, /**< notification sound in call*/
-} sound_call_session_mode_e;
-
-/**
- * @brief Enumerations of sound interrupted type
- */
-typedef enum
-{
- SOUND_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed*/
- SOUND_INTERRUPTED_BY_MEDIA, /**< Interrupted by non-resumable media application*/
- SOUND_INTERRUPTED_BY_CALL, /**< Interrupted by incoming call*/
- SOUND_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphone*/
- SOUND_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by resource conflict*/
- SOUND_INTERRUPTED_BY_ALARM, /**< Interrupted by alarm*/
- SOUND_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by emergency*/
- SOUND_INTERRUPTED_BY_RESUMABLE_MEDIA, /**< Interrupted by resumable media application*/
-} sound_interrupted_code_e;
-
-/**
- * @brief Sound call session handle type.
- */
-typedef struct sound_call_session_s *sound_call_session_h;
-
-/**
- * @brief Called when the sound session notification has occured.
- * @param[in] notify The sound session notification
- * @param[in] user_data The user data passed from the callback registration function
- * @pre You should register this callback by sound_manager_set_session_notify_cb()
- * @see sound_manager_set_session_notify_cb()
- */
-typedef void (*sound_session_notify_cb) (sound_session_notify_e notify, void *user_data);
-
-/**
- * @brief Called when the playing sound was interrupted.
- * @param[in] code The interrupted code
- * @param[in] user_data The user data passed from the callback registration function
- * @pre You should register this callback by sound_manager_set_interrupted_cb()
- * @see sound_manager_set_interrupted_cb()
- */
-typedef void(* sound_interrupted_cb)(sound_interrupted_code_e code, void *user_data);
-
-
-/**
- * @brief Called when the system volume has changed.
- * @param[in] type The sound type of changed volume
- * @param[in] volume The new volume value
- * @param[in] user_data The user data passed from the callback registration function
- * @pre sound_manager_set_volume() will invoke this callback if you register it using sound_manager_set_volume_changed_cb()
- * @see sound_manager_set_volume_changed_cb()
- * @see sound_manager_unset_volume_changed_cb()
- */
-typedef void (*sound_manager_volume_changed_cb)(sound_type_e type, unsigned int volume, void *user_data);
-
-/**
- * @brief Gets the maximum volume level supported for a particular sound type
- * @param[in] type The sound type
- * @param[out] max The maximum volume level
- * @return 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_set_volume()
- */
-int sound_manager_get_max_volume(sound_type_e type, int *max);
-
-/**
- * @brief Sets the volume level specified for a particular sound type
- * @param[in] type The sound type
- * @param[out] volume The volume level to be set
- * @return 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_max_volume()
- * @see sound_manager_get_volume()
- */
-int sound_manager_set_volume(sound_type_e type, int volume);
-
-/**
- * @brief Gets the volume level specified for a particular sound type
- * @param[in] type The sound type
- * @param[out] volume The current volume level
- * @return 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_max_volume()
- * @see sound_manager_set_volume()
- */
-int sound_manager_get_volume(sound_type_e type, int *volume);
-
-/**
- * @brief Gets the current playing sound type
- * @param[out] type The current sound type
- * @return 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_PLAYING_SOUND No playing sound
- * @see player_set_sound_type()
- * @see audio_out_create()
- * @see wav_player_start()
- */
-int sound_manager_get_current_sound_type(sound_type_e *type);
-
-/**
- * @brief Registers a callback function to be invoked when the volume level is changed.
- * @param[in] callback Callback function to indicate change in volume
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_manager_volume_changed_cb() will be invoked
- * @see sound_manager_unset_volume_changed_cb()
- * @see sound_manager_volume_changed_cb()
- */
-int sound_manager_set_volume_changed_cb(sound_manager_volume_changed_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the volume change callback
- * @see sound_manager_set_volume_changed_cb()
- */
-void sound_manager_unset_volume_changed_cb(void);
-
-/**
- * @brief Gets the A2DP activation information.
- * @remarks If @a connected is @c true, @a bt_name must be released with free() by you. If @a connected is @c false, @a bt_name is set to NULL.
- * @param[out] connected The Bluetooth A2DP connection status (@c true = connected, @c false = disconnected)
- * @param[out] bt_name The Bluetooth A2DP connected device name
- * @return 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_INVALID_OPERATION Invalid operation
- */
-int sound_manager_get_a2dp_status(bool *connected, char **bt_name);
-
-
-/**
- * @brief Sets the application's sound session type
- * @param[in] type The session type to set
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int sound_manager_set_session_type(sound_session_type_e type);
-
-
-/**
- * @brief Gets the application's sound session type
- * @param[in] type The session type
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int sound_manager_get_session_type(sound_session_type_e *type);
-
-
-/**
- * @brief Registers a callback function to be invoked when the sound session notification is occured.
- * @param[in] callback The session notify callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_session_notify_cb() will be invoked
- * @see sound_manager_unset_session_notify_cb()
- * @see sound_session_notify_cb()
- */
-int sound_manager_set_session_notify_cb(sound_session_notify_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function which is called when the session notification is occured
- * @see sound_manager_set_session_notify_cb()
- */
-void sound_manager_unset_session_notify_cb(void);
-
-/**
- * @brief Registers a callback function to be invoked when the playing sound was interrupted.
- * @param[in] callback The interrupted callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_interrupted_cb() will be invoked
- * @see sound_manager_unset_interrupted_cb()
- * @see sound_interrupted_cb()
- */
-int sound_manager_set_interrupted_cb(sound_interrupted_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function which is called when the playing sound was interrupted
- * @see sound_manager_set_interrupted_cb()
- */
-void sound_manager_unset_interrupted_cb(void);
-
-
-
-/**
- * @brief Sets the volume key type
- * @param[in] type The volume key type to set
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int sound_manager_set_volume_key_type(volume_key_type_e type);
-
-/**
- * @brief Gets called iteratively to notify you of available route.
- * @param[in] route The available route
- * @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @pre sound_manager_foreach_available_route() will invoke this callback.
- * @see sound_manager_foreach_available_route()
- */
-typedef bool(* sound_available_route_cb)(sound_route_e route, void *user_data);
-
-/**
- * @brief Called when the available audio route is changed.
- * @param[in] route The audio route
- * @param[in] available The status of given route
- * @param[in] user_data The user data passed from the foreach function
- * @pre sound_manager_foreach_available_route() will invoke this callback.
- * @see sound_manager_foreach_available_route()
- */
-typedef void(* sound_available_route_changed_cb)(sound_route_e route, bool available, void *user_data);
-
-/**
- * @brief Called when the audio route is changed.
- * @param[in] route The audio route
- * @param[in] user_data The user data passed from the callback registration function
- * @pre You should register this callback by sound_manager_set_active_device_changed_cb()
- * @see sound_manager_set_active_device_changed_cb()
- */
-typedef void(* sound_active_device_changed_cb)(sound_device_in_e in, sound_device_out_e out, void *user_data);
-
-/**
- * @brief Retrieves all available audio routes by invoking a specific callback for each valid route.
- * @param[in] callback The session notify callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_available_route_cb() will be invoked
- * @see sound_available_route_cb()
- */
-int sound_manager_foreach_available_route (sound_available_route_cb callback, void *user_data);
-
-/**
- * @brief Changes the audio routes.
- * @param[in] route The route to set
- * @return 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_active_device()
- */
-int sound_manager_set_active_route (sound_route_e route);
-
-/**
- * @brief Changes the audio route.
- * @param[out] in The current sound input device
- * @param[out] in The current sound output device
- * @return 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_set_active_route()
- */
-int sound_manager_get_active_device (sound_device_in_e *in, sound_device_out_e *out);
-
-/**
- * @brief Check if given audio route is available or not.
- * @param[in] route The route to set
- * @return 0 on success, otherwise a negative error value.
- * @return @c true if the specified route is supported, \n else @c false
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-bool sound_manager_is_route_available (sound_route_e route);
-
-/**
- * @brief Registers a callback function to be invoked when the available status is changed.
- * @param[in] callback The available status changed callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_available_route_changed_cb() will be invoked
- * @see sound_manager_unset_available_route_changed_cb()
- * @see sound_available_route_changed_cb()
- */
-int sound_manager_set_available_route_changed_cb (sound_available_route_changed_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function.
- * @see sound_manager_set_available_route_changed_cb()
- */
-void sound_manager_unset_available_route_changed_cb (void);
-
-/**
- * @brief Registers a callback function to be invoked when the audio device is changed.
- * @param[in] callback The session notify callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_active_device_changed_cb() will be invoked
- * @see sound_manager_unset_active_device_changed_cb()
- * @see sound_active_device_changed_cb()
- */
-int sound_manager_set_active_device_changed_cb (sound_active_device_changed_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function which is called when the route notification is occured.
- * @see sound_manager_set_active_device_changed_cb()
- */
-void sound_manager_unset_active_device_changed_cb (void);
-
-/**
- * @brief Creates a call session handle.
- * @remarks @a session must be released sound_manager_call_session_destroy() by you.
- * @param[out] session A new handle to call session
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_OUT_OF_MEMORY Out of memory
- * @see sound_manager_call_session_destroy()
- */
-int sound_manager_call_session_create(sound_call_session_type_e type, sound_call_session_h *session);
-
-/**
- * @brief Sets the call session mode.
- *
- * @param[in] session The handle to call session
- * @param[in] mode The call session mode
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_call_session_get_mode()
- */
-int sound_manager_call_session_set_mode(sound_call_session_h session, sound_call_session_mode_e mode);
-
-/**
- * @brief Gets the call session mode.
- *
- * @param[in] session The handle to call session
- * @param[out] mode The call session mode
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_call_session_set_mode()
- */
-int sound_manager_call_session_get_mode(sound_call_session_h session, sound_call_session_mode_e *mode);
-
-/**
- * @brief Destroys the call session handle.
- *
- * @param[in] session The handle to call session to be destroyed
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_call_session_create()
- */
-int sound_manager_call_session_destroy(sound_call_session_h session);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_MEDIA_SOUND_MANAGER_H__ */
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-#define LOG_TAG "TIZEN_N_SOUND_MANGER"
-
-#include <sound_manager.h>
-#include <mm_sound.h>
-#include <mm_sound_private.h>
-#include <stdio.h>
-#include <limits.h>
-#include <string.h>
-#include <malloc.h>
-#include <unistd.h>
-#include <dlog.h>
-#include <mm_session.h>
-#include <mm_session_private.h>
-
-#define MAX_VOLUME_TYPE 5
-
-typedef struct {
- void *user_data;
- sound_manager_volume_changed_cb user_cb;
-}_changed_volume_info_s;
-
-typedef struct {
- int is_registered;
- void *user_data;
- sound_session_notify_cb user_cb;
- void *interrupted_user_data;
- sound_interrupted_cb interrupted_cb;
-}_session_notify_info_s;
-
-typedef struct {
- void *user_data;
- sound_available_route_changed_cb user_cb;
-}_changed_available_route_info_s;
-
-typedef struct {
- void *user_data;
- sound_active_device_changed_cb user_cb;
-}_changed_active_device_info_s;
-
-static _changed_volume_info_s g_volume_changed_cb_table;
-static _session_notify_info_s g_session_notify_cb_table = {0, NULL, NULL, NULL, NULL};
-static sound_session_type_e g_cached_session = -1;
-
-#define SOUND_SESSION_TYPE_DEFAULT SOUND_SESSION_TYPE_SHARE
-
-static void __volume_changed_cb(void *user_data)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
- sound_type_e type = (sound_type_e)user_data;
-
- int new_volume;
- ret = sound_manager_get_volume(type, &new_volume);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- if(g_volume_changed_cb_table.user_cb)
- (g_volume_changed_cb_table.user_cb)(type, new_volume, g_volume_changed_cb_table.user_data);
- } else {
- LOGE("sound_manager_get_volume() error code(0x%08x)", ret);
- }
-}
-
-static void __session_notify_cb(session_msg_t msg, session_event_t event, void *user_data){
- if(g_session_notify_cb_table.user_cb){
- g_session_notify_cb_table.user_cb(msg, g_session_notify_cb_table.user_data);
- }
- if( g_session_notify_cb_table.interrupted_cb ){
- sound_interrupted_code_e e = SOUND_INTERRUPTED_COMPLETED;
- if( msg == MM_SESSION_MSG_RESUME )
- e = SOUND_INTERRUPTED_COMPLETED;
- else{
- switch(event){
- case MM_SESSION_EVENT_MEDIA :
- e = SOUND_INTERRUPTED_BY_MEDIA;
- break;
- case MM_SESSION_EVENT_RESUMABLE_MEDIA :
- e = SOUND_INTERRUPTED_BY_RESUMABLE_MEDIA;
- break;
- case MM_SESSION_EVENT_CALL :
- e = SOUND_INTERRUPTED_BY_CALL;
- break;
- case MM_SESSION_EVENT_ALARM :
- e = SOUND_INTERRUPTED_BY_ALARM;
- break;
- case MM_SESSION_EVENT_EARJACK_UNPLUG:
- e = SOUND_INTERRUPTED_BY_EARJACK_UNPLUG;
- break;
- case MM_SESSION_EVENT_RESOURCE_CONFLICT:
- e = SOUND_INTERRUPTED_BY_RESOURCE_CONFLICT;
- break;
- case MM_SESSION_EVENT_EMERGENCY:
- e = SOUND_INTERRUPTED_BY_EMERGENCY;
- break;
- default :
- e = SOUND_INTERRUPTED_BY_MEDIA;
- break;
- }
- }
- g_session_notify_cb_table.interrupted_cb(e, g_session_notify_cb_table.interrupted_user_data);
- }
-}
-
-static int __convert_sound_manager_error_code(const char *func, int code){
- int ret = SOUND_MANAGER_ERROR_NONE;
- char *errorstr = NULL;
-
- switch(code)
- {
- case SOUND_MANAGER_ERROR_INVALID_PARAMETER:
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- errorstr = "INVALID_PARAMETER";
- break;
- case SOUND_MANAGER_ERROR_INVALID_OPERATION:
- ret = SOUND_MANAGER_ERROR_INVALID_OPERATION;
- errorstr = "INVALID_OPERATION";
- break;
- case MM_ERROR_NONE:
- ret = SOUND_MANAGER_ERROR_NONE;
- errorstr = "ERROR_NONE";
- break;
- case MM_ERROR_INVALID_ARGUMENT:
- case MM_ERROR_SOUND_INVALID_POINTER:
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- errorstr = "INVALID_PARAMETER";
- break;
- case MM_ERROR_SOUND_INTERNAL:
- case MM_ERROR_POLICY_DUPLICATED:
- case MM_ERROR_POLICY_BLOCKED:
- case MM_ERROR_POLICY_INTERNAL:
- ret = SOUND_MANAGER_ERROR_INVALID_OPERATION;
- errorstr = "INVALID_OPERATION" ;
- break;
- case MM_ERROR_SOUND_VOLUME_NO_INSTANCE:
- case MM_ERROR_SOUND_VOLUME_CAPTURE_ONLY:
- ret = SOUND_MANAGER_ERROR_NO_PLAYING_SOUND;
- errorstr = "NO_PLAYING_SOUND" ;
- break;
- }
- LOGE("[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code);
- return ret;
-}
-
-int sound_manager_get_max_volume(sound_type_e type, int *max)
-{
- int volume;
- if(max == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- if(type > MAX_VOLUME_TYPE || type < 0)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret = mm_sound_volume_get_step(type, &volume);
-
- if(ret == 0)
- *max = volume -1; // actual volume step can be max step - 1
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_volume(sound_type_e type, int volume)
-{
- if(type > MAX_VOLUME_TYPE || type < 0)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- if(volume < 0)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- int ret = mm_sound_volume_set_value(type, volume);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_volume(sound_type_e type, int *volume)
-{
- unsigned int uvolume;
- if(type > MAX_VOLUME_TYPE || type < 0)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- if(volume == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret = mm_sound_volume_get_value(type, &uvolume);
-
- if(ret == 0)
- *volume = uvolume;
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_current_sound_type(sound_type_e *type)
-{
- if(type == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret;
- ret = mm_sound_volume_get_current_playing_type((volume_type_t *)type);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_volume_changed_cb(sound_manager_volume_changed_cb callback, void* user_data)
-{
- if(callback == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int i;
- g_volume_changed_cb_table.user_cb = callback;
- g_volume_changed_cb_table.user_data = user_data;
- for(i = 0 ; i <= MAX_VOLUME_TYPE ; i++)
- {
- mm_sound_volume_add_callback(i , __volume_changed_cb ,(void*) i);
- }
- return 0;
-}
-
-void sound_manager_unset_volume_changed_cb(void)
-{
- int i;
- for(i = 0 ; i <= MAX_VOLUME_TYPE ; i++)
- {
- mm_sound_volume_remove_callback(i);
- }
- g_volume_changed_cb_table.user_cb = NULL;
- g_volume_changed_cb_table.user_data = NULL;
-}
-
-int sound_manager_get_a2dp_status(bool *connected , char** bt_name){
- int ret = mm_sound_route_get_a2dp_status(connected , bt_name);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_session_type(sound_session_type_e type){
- int ret = 0;
- int session = 0;
- if(type < 0 || type > SOUND_SESSION_TYPE_EMERGENCY)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- /* if call session is activated, can't set session */
- ret = mm_session_get_current_type(&session);
- if( ret == 0 && session >= MM_SESSION_TYPE_CALL ) {
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_OPERATION);
- }
-
- if(g_session_notify_cb_table.is_registered){
- ret = mm_session_finish();
- if (ret != MM_ERROR_NONE) {
- return __convert_sound_manager_error_code(__func__, ret);
- }
- g_session_notify_cb_table.is_registered = 0;
- }
-
- ret = mm_session_init_ex(type , __session_notify_cb, NULL);
- if(ret == 0){
- g_session_notify_cb_table.is_registered = 1;
- }
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_session_type(sound_session_type_e *type){
- if( type == NULL )
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret = 0;
- int session;
- ret = mm_session_get_current_type(&session);
- if( ret !=0 )
- session = SOUND_SESSION_TYPE_DEFAULT;
- if( session > SOUND_SESSION_TYPE_EMERGENCY ){ // call session or voip session
- if( g_cached_session != -1 )
- session = g_cached_session; // saved session
- else //will be never reach here. just prevent code
- session = SOUND_SESSION_TYPE_DEFAULT;
- }
-
- *type = session;
- return 0;
-}
-
-
-int sound_manager_set_session_notify_cb(sound_session_notify_cb callback , void *user_data){
- int ret =0 ;
- if(callback == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
-
- if(g_session_notify_cb_table.is_registered ==0){
- ret = mm_session_init_ex(SOUND_SESSION_TYPE_DEFAULT /*default*/ , __session_notify_cb, NULL);
- if(ret != 0)
- return __convert_sound_manager_error_code(__func__, ret);
- g_session_notify_cb_table.is_registered = 1;
- }
-
- g_session_notify_cb_table.user_cb = callback;
- g_session_notify_cb_table.user_data = user_data;
- return SOUND_MANAGER_ERROR_NONE;
-}
-
-void sound_manager_unset_session_notify_cb(void){
- g_session_notify_cb_table.user_cb = NULL;
- g_session_notify_cb_table.user_data = NULL;
-}
-
-int sound_manager_set_interrupted_cb(sound_interrupted_cb callback, void *user_data){
- int ret =0 ;
- if(callback == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- if(g_session_notify_cb_table.is_registered ==0){
- ret = mm_session_init_ex(SOUND_SESSION_TYPE_DEFAULT /*default*/ , __session_notify_cb, NULL);
- if(ret != 0)
- return __convert_sound_manager_error_code(__func__, ret);
- g_session_notify_cb_table.is_registered = 1;
- }
-
- g_session_notify_cb_table.interrupted_cb= callback;
- g_session_notify_cb_table.interrupted_user_data = user_data;
- return SOUND_MANAGER_ERROR_NONE;
-}
-
-void sound_manager_unset_interrupted_cb(void){
- g_session_notify_cb_table.interrupted_cb= NULL;
- g_session_notify_cb_table.interrupted_user_data = NULL;
-}
-
-
-int sound_manager_set_volume_key_type(volume_key_type_e type){
- if(type < VOLUME_KEY_TYPE_NONE || type > VOLUME_KEY_TYPE_CALL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret;
- if(type == VOLUME_KEY_TYPE_NONE)
- ret = mm_sound_volume_primary_type_clear();
- else
- ret = mm_sound_volume_primary_type_set(type);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_foreach_available_route (sound_available_route_cb callback, void *user_data)
-{
- int ret;
- ret = mm_sound_foreach_available_route_cb((mm_sound_available_route_cb)callback, user_data);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_active_route (sound_route_e route)
-{
- int ret;
- ret = mm_sound_set_active_route(route);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_active_device (sound_device_in_e *in, sound_device_out_e *out)
-{
- int ret;
- ret = mm_sound_get_active_device((mm_sound_device_in *)in, (mm_sound_device_out *)out);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-bool sound_manager_is_route_available (sound_route_e route)
-{
- bool is_available;
- mm_sound_is_route_available(route, &is_available);
-
- return is_available;
-}
-
-int sound_manager_set_available_route_changed_cb (sound_available_route_changed_cb callback, void *user_data)
-{
- int ret;
- ret = mm_sound_add_available_route_changed_callback((mm_sound_available_route_changed_cb)callback, user_data);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-void sound_manager_unset_available_route_changed_cb (void)
-{
- mm_sound_remove_available_route_changed_callback();
-}
-
-int sound_manager_set_active_device_changed_cb (sound_active_device_changed_cb callback, void *user_data)
-{
- int ret;
- ret = mm_sound_add_active_device_changed_callback((mm_sound_active_device_changed_cb)callback, user_data);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-void sound_manager_unset_active_device_changed_cb (void)
-{
- mm_sound_remove_active_device_changed_callback();
-}
-
-struct sound_call_session_s
-{
- int previous_session;
-};
-
-int sound_manager_call_session_create(sound_call_session_type_e type, sound_call_session_h *session)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
- sound_call_session_h handle = NULL;
-
- /* Check input parameters */
- if(type < SOUND_SESSION_TYPE_CALL || type > SOUND_SESSION_TYPE_VOIP || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- /* Allocate handle */
- handle = malloc(sizeof(struct sound_call_session_s));
- if(!handle) {
- ret = SOUND_MANAGER_ERROR_OUT_OF_MEMORY;
- goto ERROR;
- }
- memset(handle, 0, sizeof(struct sound_call_session_s));
-
- /* Finish previous session if exists */
- if(g_session_notify_cb_table.is_registered){
- sound_manager_get_session_type((sound_session_type_e*)&handle->previous_session);
- g_cached_session = handle->previous_session;
-
- ret = mm_session_finish();
- if (ret != MM_ERROR_NONE) {
- goto ERROR;
- }
- g_session_notify_cb_table.is_registered = 0;
-
- }else{
- g_cached_session = SOUND_SESSION_TYPE_DEFAULT;
- handle->previous_session = SOUND_SESSION_TYPE_DEFAULT;
- }
-
- /* Initialize session */
- switch(type) {
- case SOUND_SESSION_TYPE_CALL:
- ret = mm_session_init_ex(MM_SESSION_TYPE_CALL, __session_notify_cb, NULL);
- break;
- case SOUND_SESSION_TYPE_VOIP:
- ret = mm_session_init_ex(MM_SESSION_TYPE_VIDEOCALL,__session_notify_cb, NULL);
- break;
- }
- if(ret != MM_ERROR_NONE)
- goto ERROR;
-
- g_session_notify_cb_table.is_registered = 1;
- *session = handle;
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- if(handle)
- free(handle);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_call_session_set_mode(sound_call_session_h session, sound_call_session_mode_e mode)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- if(mode < SOUND_CALL_SESSION_MODE_VOICE || mode > SOUND_CALL_SESSION_MODE_MEDIA || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- ret = mm_session_set_subsession ((mm_subsession_t)mode);
-
- if(ret != MM_ERROR_NONE)
- goto ERROR;
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_call_session_get_mode(sound_call_session_h session, sound_call_session_mode_e *mode)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- if(mode == NULL || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- ret = mm_session_get_subsession ((mm_subsession_t *)mode);
-
- if(ret != MM_ERROR_NONE)
- goto ERROR;
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_call_session_destroy(sound_call_session_h session)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- if(session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- if(g_session_notify_cb_table.is_registered){
- ret = mm_session_finish();
- if(ret != MM_ERROR_NONE)
- goto ERROR;
- g_session_notify_cb_table.is_registered = 0;
- }
-
- /* Restore previous session */
- ret = mm_session_init_ex(session->previous_session , __session_notify_cb, NULL);
- if(ret == 0){
- g_session_notify_cb_table.is_registered = 1;
- }
-
- if(session)
- free(session);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-#include <stdio.h>
-#include <sound_manager.h>
-#include <glib.h>
-#include <mm_sound.h>
-#include <unistd.h>
-#include <string.h>
-#include <player.h>
-#include <stdlib.h>
-
-static GMainLoop *g_mainloop = NULL;
-static GThread *event_thread;
-#define MAX_VOLUME_TYPE 5
-
-gpointer GmainThread(gpointer data){
- g_mainloop = g_main_loop_new (NULL, 0);
- g_main_loop_run (g_mainloop);
-
- return NULL;
-}
-
-void _sound_manager_volume_changed_cb(sound_type_e type, unsigned int volume, void* user_data)
-{
- printf("changed!! type=%d, volume = %d\n", type, volume);
-}
-
-int set_volume_test()
-{
- printf("set volume test\n");
- int i;
- sound_manager_set_volume_changed_cb(_sound_manager_volume_changed_cb ,NULL);
- for( i = SOUND_TYPE_SYSTEM ; i <=MAX_VOLUME_TYPE; i++){
- int max_value;
- int j;
- sound_manager_get_max_volume(i, &max_value);
- printf(" sound type = %d , max volume = %d\n", i, max_value);
- for( j = 0; j <= max_value+1 ; j++){
- int ret;
- int getvalue;
- ret = sound_manager_set_volume(i, j);
- if( j <= max_value && ret == 0 ){
- sound_manager_get_volume(i, &getvalue);
- if( j == getvalue )
- printf("PASS\n");
- else
- printf("FAIL!set=%d, get=%d\n", j, getvalue);
- } else if( j > max_value && ret == 0 )
- printf("FAIL! max_value over!!\n");
-
- }
- }
- //sound_manager_unset_volume_changed_cb();
- printf("end set volume test!!!\n");
- sleep(10);
- return 0;
-}
-
-void _sound_manager_route_policy_changed_cb(sound_route_policy_e route , void* user_data)
-{
- printf("new route policy %d\n", route);
-}
-
-int set_policy_test()
-{
- printf("-----------set policy test--------------\n");
- int ret;
- //int i;
- //sound_route_policy_e value;
- sound_manager_set_route_policy_changed_cb(_sound_manager_route_policy_changed_cb,NULL);
- /*
- for( i = SOUND_ROUTE_DEFAULT ; i <= SOUND_ROUTE_HANDSET_ONLY ; i++){
- ret = sound_manager_set_route_policy(i);
- ret = sound_manager_get_route_policy(&value);
- if( i == value )
- printf("PASS\n");
- else
- printf("FAIL\n");
- }
- */
- ret = sound_manager_set_route_policy(SOUND_ROUTE_DEFAULT);
- ret = sound_manager_set_route_policy(SOUND_ROUTE_DEFAULT);
- ret = sound_manager_set_route_policy(SOUND_ROUTE_DEFAULT);
- ret = sound_manager_set_route_policy(SOUND_ROUTE_DEFAULT);
-
-
- return 0;
-}
-
-
-static void mm_volume_changed_cb(void *user_data)
-{
- int v = (int)user_data;
- unsigned int value = 0;
- int ret = mm_sound_volume_get_value(v, &value);
- printf("mm_volume_changed_cb type = %d ,volume = %d , ret = %x\n", v, value, ret );
-}
-
-
-int mm_bug_test()
-{
- int ret = 0;
- mm_sound_volume_add_callback(0 , mm_volume_changed_cb , (void*)0);
- mm_sound_volume_add_callback(1 , mm_volume_changed_cb ,(void*) 1);
- mm_sound_volume_add_callback(2 , mm_volume_changed_cb , (void*)2);
- mm_sound_volume_add_callback(5 , mm_volume_changed_cb , (void*)5);
-
- int i;
-
- for( i = 0 ; i < 10 ; i++)
- {
- ret = mm_sound_volume_set_value(0, i);
- printf("type = 0 , volume = %d set , ret = %x\n", i, ret);
- ret = mm_sound_volume_set_value(1, i);
- printf("type = 1 , volume = %d set , ret = %x\n", i, ret);
- ret = mm_sound_volume_set_value(2, i);
- printf("type = 2 , volume = %d set , ret = %x\n", i, ret);
- ret = mm_sound_volume_set_value(5, i);
- printf("type = 5 , volume = %d set , ret = %x\n", i, ret);
- sleep(1);
- }
-
- //mm_sound_volume_remove_callback(0);
- //mm_sound_volume_remove_callback(1);
- //mm_sound_volume_remove_callback(2);
- //mm_sound_volume_remove_callback(5);
-
-
- ret = mm_sound_volume_set_value(5, 4);
-
- mm_sound_route_set_system_policy(SOUND_ROUTE_DEFAULT);
- mm_sound_route_set_system_policy(SOUND_ROUTE_DEFAULT);
- mm_sound_route_set_system_policy(SOUND_ROUTE_DEFAULT);
- return 0;
-}
-
-void mm_test(){
-
- char path[255];
- int id;
- int i;
- getcwd(path, 255);
- strcat(path, "/test2.wav");
- for( i =0 ; i < 10 ; i++){
- mm_sound_play_sound(path, SOUND_TYPE_MEDIA, NULL ,NULL, &id);
- mm_sound_stop_sound(id);
- }
-}
-
-void session_notify_cb(sound_session_notify_e notify, void *user_data)
-{
- printf("notify %d\n", notify);
-
-
-}
-
-
-void session_test(){
- printf("session_test\n");
- int ret = 0;
- player_h player;
-
- ret = sound_manager_set_session_type(SOUND_SESSION_TYPE_EXCLUSIVE);
- sound_manager_set_session_notify_cb(session_notify_cb,NULL);
-
-
-
- ret = player_create(&player);
- printf("player_create ret =%x\n", ret);
- ret = player_set_uri(player, "title_theme.mp3");
- printf("player_set_uri ret =%x\n", ret);
- ret =player_prepare(player);
- printf("player_prepare ret =%x\n", ret);
- ret = player_start(player);
- printf("player_start ret =%x\n", ret);
-
- while(1){
- player_state_e state;
- player_get_state(player, &state);
- printf("state %d\n", state);
- //if( state == 4)
- //player_start(player);
- sleep(1);
- //wav_player_start("test.wav", SOUND_TYPE_MEDIA,NULL, NULL,NULL);
- }
-
-
-}
-
-
-void a2dp_test(){
- bool isconnected;
- char * name;
- sound_manager_get_a2dp_status(&isconnected, &name);
- if( isconnected ){
- printf("name = %s\n", name);
- free(name);
- }else{
- printf("disconnected\n");
- }
- sound_device_e device;
- sound_manager_get_current_sound_device(&device);
- printf("device =%d\n", device);
-
-}
-
-int main()
-{
- if( !g_thread_supported() )
- {
- g_thread_init(NULL);
- }
-
- GError *gerr = NULL;
- event_thread = g_thread_create(GmainThread, NULL, 1, &gerr);
-
-
-
- //set_volume_test();
- //set_policy_test();
- //mm_bug_test();
- //wav_play_test();
- //tone_play_test();
- //wav_play_test();
- session_test();
- //a2dp_test();
- return 0;
-}
Name: capi-media-sound-manager
Summary: Sound Manager library
-%if 0%{?tizen_profile_mobile}
-Version: 0.1.1
-Release: 1
-%else
-Version: 0.1.22
+Version: 0.2.26
Release: 0
-VCS: framework/api/sound-manager#capi-media-sound-manager_0.1.6-1-29-g1fe3a1eaf827615ba46909f7aaa8f770f88b6a50
-%endif
Group: TO_BE/FILLED_IN
-License: Apache-2.0
+License: TO BE FILLED IN
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(mm-sound)
BuildRequires: pkgconfig(mm-session)
BuildRequires: pkgconfig(capi-base-common)
-%if "%{_repository}" == "wearable"
BuildRequires: pkgconfig(vconf)
-%endif
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
+Requires(post): libprivilege-control
%description
A Sound Manager library in Tizen C API
%build
-%if 0%{?tizen_profile_mobile}
-cd mobile
-%else
-cd wearable
-%define sec_product_feature_tizenmicro_enable 1
-
-%if 0%{?sec_product_feature_tizenmicro_enable}
- CFLAGS+=" -DTIZEN_MICRO";export CFLAGS
-%endif
-%endif
-
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
%install
rm -rf %{buildroot}
-%if 0%{?tizen_profile_mobile}
-cd mobile
-mkdir -p %{buildroot}/usr/share/license
-cp LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
-%else
-cd wearable
mkdir -p %{buildroot}/usr/share/license
+mkdir -p %{buildroot}/opt/usr/devel
cp LICENSE %{buildroot}/usr/share/license/%{name}
-%endif
-
+cp test/sound_manager_test %{buildroot}/opt/usr/devel
%make_install
-%post -p /sbin/ldconfig
+%post
+/sbin/ldconfig
+/usr/bin/api_feature_loader --verbose --dir=/usr/share/privilege-control
%postun -p /sbin/ldconfig
%files
%{_libdir}/libcapi-media-sound-manager.so.*
%{_datadir}/license/%{name}
-%if 0%{?tizen_profile_mobile}
-%manifest mobile/capi-media-sound-manager.manifest
-%else
-%manifest wearable/capi-media-sound-manager.manifest
-%endif
+/opt/usr/devel/*
+%manifest capi-media-sound-manager.manifest
%files devel
%{_includedir}/media/sound_manager.h
+%{_includedir}/media/sound_manager_internal.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-media-sound-manager.so
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#define LOG_TAG "TIZEN_N_SOUND_MANAGER"
+
+#include <sound_manager.h>
+#include <sound_manager_private.h>
+
+typedef struct {
+ void *user_data;
+ sound_manager_volume_changed_cb user_cb;
+}_changed_volume_info_s;
+
+_session_interrupt_info_s g_session_interrupt_cb_table = {0, NULL, NULL};
+_volume_changed_info_s g_volume_changed_cb_table = {NULL, NULL};
+_device_connected_info_s g_device_connected_cb_table = {NULL, NULL};
+_device_changed_info_s g_device_info_changed_cb_table = {NULL, NULL};
+
+sound_session_type_e g_cached_session = -1;
+sound_session_voip_mode_e g_cached_voip_mode = -1;
+
+int sound_manager_get_max_volume(sound_type_e type, int *max)
+{
+ int volume;
+ if(max == NULL)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+
+ if(type >= SOUND_TYPE_NUM || type < 0)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+ int ret = mm_sound_volume_get_step(type, &volume);
+
+ if(ret == 0)
+ *max = volume -1; // actual volume step can be max step - 1
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_set_volume(sound_type_e type, int volume)
+{
+ if(type >= SOUND_TYPE_NUM || type < 0)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+ if(volume < 0)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+
+ int ret = mm_sound_volume_set_value(type, volume);
+ LOGI("returns : type=%d, volume=%d, ret=0x%x", type, volume, ret);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_volume(sound_type_e type, int *volume)
+{
+ unsigned int uvolume;
+ if(type >= SOUND_TYPE_NUM || type < 0)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+ if(volume == NULL)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+ int ret = mm_sound_volume_get_value(type, &uvolume);
+
+ if(ret == 0)
+ *volume = uvolume;
+
+ LOGI("returns : type=%d, volume=%d, ret=0x%x", type, *volume, ret);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_set_current_sound_type(sound_type_e type)
+{
+ int ret = MM_ERROR_NONE;
+ if(type >= SOUND_TYPE_NUM || type < 0)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+
+ ret = mm_sound_volume_primary_type_set(type);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_current_sound_type(sound_type_e *type)
+{
+ int ret = MM_ERROR_NONE;
+ if(type == NULL)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+ ret = mm_sound_volume_get_current_playing_type((volume_type_t *)type);
+
+ LOGI("returns : type=%d, ret=0x%x", *type, ret);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_unset_current_sound_type(void)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_volume_primary_type_clear();
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_set_volume_changed_cb(sound_manager_volume_changed_cb callback, void* user_data)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_add_volume_changed_callback((mm_sound_volume_changed_cb)callback, user_data);
+ if (ret == MM_ERROR_NONE) {
+ g_volume_changed_cb_table.user_cb = (sound_manager_volume_changed_cb)callback;
+ g_volume_changed_cb_table.user_data = user_data;
+ }
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_unset_volume_changed_cb(void)
+{
+ int ret = MM_ERROR_NONE;
+ if (g_volume_changed_cb_table.user_cb) {
+ ret = mm_sound_remove_volume_changed_callback();
+ if (ret == MM_ERROR_NONE) {
+ g_volume_changed_cb_table.user_cb = NULL;
+ g_volume_changed_cb_table.user_data = NULL;
+ }
+ } else {
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_set_session_type(sound_session_type_e type)
+{
+ int ret = MM_ERROR_NONE;
+ int cur_session = -1;
+ int new_session = MM_SESSION_TYPE_MEDIA;
+
+ LOGI(">> enter : type=%d", type);
+
+ if(type < SOUND_SESSION_TYPE_MEDIA || type > SOUND_SESSION_TYPE_VOIP)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+
+ switch(type) {
+ case SOUND_SESSION_TYPE_MEDIA:
+ new_session = MM_SESSION_TYPE_MEDIA;
+ break;
+ case SOUND_SESSION_TYPE_ALARM:
+ new_session = MM_SESSION_TYPE_ALARM;
+ break;
+ case SOUND_SESSION_TYPE_NOTIFICATION:
+ new_session = MM_SESSION_TYPE_NOTIFY;
+ break;
+ case SOUND_SESSION_TYPE_EMERGENCY:
+ new_session = MM_SESSION_TYPE_EMERGENCY;
+ break;
+ case SOUND_SESSION_TYPE_VOIP:
+ new_session = MM_SESSION_TYPE_VOIP;
+ break;
+ }
+
+ /* valid session check */
+ ret = mm_session_get_current_type(&cur_session);
+ if(ret == 0) {
+ if (cur_session == MM_SESSION_TYPE_MEDIA_RECORD) {
+ if (type > SOUND_SESSION_TYPE_MEDIA) {
+ LOGE("<< leave : Could not set this type(%d) during camera/recorder/audio-io(in)/radio", type);
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ }
+ if (cur_session == MM_SESSION_TYPE_CALL ||
+ cur_session == MM_SESSION_TYPE_VIDEOCALL ||
+ cur_session >= MM_SESSION_TYPE_VOICE_RECOGNITION) {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ }
+
+ if(g_session_interrupt_cb_table.is_registered) {
+ if (new_session == cur_session ||
+ ((new_session == SOUND_SESSION_TYPE_MEDIA) && (cur_session == MM_SESSION_TYPE_MEDIA_RECORD))) {
+ LOGI("<< leave : already set type=%d, ret=0x%x", type, ret);
+ return SOUND_MANAGER_ERROR_NONE;
+ } else {
+ ret = mm_session_finish();
+ if (ret != MM_ERROR_NONE) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ g_session_interrupt_cb_table.is_registered = 0;
+ g_cached_voip_mode = -1;
+ }
+ }
+ ret = mm_session_init_ex(new_session , __session_interrupt_cb, NULL);
+ if(ret == 0){
+ g_session_interrupt_cb_table.is_registered = 1;
+ }
+ if (new_session == MM_SESSION_TYPE_VOIP) {
+ /* set default sub-session for voip */
+ ret = mm_session_set_subsession (MM_SUBSESSION_TYPE_RINGTONE, MM_SUBSESSION_OPTION_NONE);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ g_cached_voip_mode = SOUND_SESSION_VOIP_MODE_RINGTONE;
+ }
+ LOGI("<< leave : type=%d, ret=0x%x", type, ret);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_session_type(sound_session_type_e *type)
+{
+ int ret = MM_ERROR_NONE;
+ int cur_session;
+
+ if( type == NULL )
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+ ret = mm_session_get_current_type(&cur_session);
+ if (ret != 0)
+ cur_session = SOUND_SESSION_TYPE_DEFAULT;
+ if ((cur_session > MM_SESSION_TYPE_EMERGENCY) && (cur_session != MM_SESSION_TYPE_VOIP)) {
+ if( g_cached_session != -1 )
+ cur_session = g_cached_session;
+ else //will be never reach here. just prevent code
+ cur_session = SOUND_SESSION_TYPE_DEFAULT;
+ }
+
+ switch(cur_session) {
+ case MM_SESSION_TYPE_MEDIA:
+ case MM_SESSION_TYPE_MEDIA_RECORD:
+ *type = SOUND_SESSION_TYPE_MEDIA;
+ break;
+ case MM_SESSION_TYPE_ALARM:
+ *type = SOUND_SESSION_TYPE_ALARM;
+ break;
+ case MM_SESSION_TYPE_NOTIFY:
+ *type = SOUND_SESSION_TYPE_NOTIFICATION;
+ break;
+ case MM_SESSION_TYPE_EMERGENCY:
+ *type = SOUND_SESSION_TYPE_EMERGENCY;
+ break;
+ case MM_SESSION_TYPE_VOIP:
+ *type = SOUND_SESSION_TYPE_VOIP;
+ break;
+ default:
+ *type = cur_session;
+ break;
+ }
+
+ LOGI("returns : type=%d, ret=0x%x", *type, ret);
+
+ return 0;
+}
+
+int sound_manager_set_media_session_option(sound_session_option_for_starting_e s_option, sound_session_option_for_during_play_e d_option)
+{
+ int ret = MM_ERROR_NONE;
+ int session = 0;
+ int session_option = 0;
+ int updated = 0;
+
+ LOGI(">> enter : option for starting=%d, for during play=%d", s_option, d_option);
+
+ if(s_option < 0 || s_option > SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+ if(d_option < 0 || d_option > SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+
+ ret = mm_session_get_current_information(&session, &session_option);
+ if ( ret != 0 || !g_session_interrupt_cb_table.is_registered) {
+ LOGW("need to set session type first");
+ return __convert_sound_manager_error_code(__func__, ret);
+ } else if ( ret == 0 && session > MM_SESSION_TYPE_MEDIA ) {
+ if (session == MM_SESSION_TYPE_MEDIA_RECORD) {
+ if (!g_session_interrupt_cb_table.is_registered) {
+ LOGE("Already set by camera/recorder/audio-io(in)/radio API, but need to set session to Media first");
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ } else {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ }
+
+ switch (s_option) {
+ case SOUND_SESSION_OPTION_MIX_WITH_OTHERS_WHEN_START:
+ if (session_option & MM_SESSION_OPTION_PAUSE_OTHERS) {
+ ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_REMOVE, MM_SESSION_OPTION_PAUSE_OTHERS);
+ if(ret){
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ updated = 1;
+ }
+ break;
+ case SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START:
+ if (!(session_option & MM_SESSION_OPTION_PAUSE_OTHERS)) {
+ ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_ADD, MM_SESSION_OPTION_PAUSE_OTHERS);
+ if(ret){
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ updated = 1;
+ }
+ break;
+ }
+
+ switch (d_option) {
+ case SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY:
+ if (session_option & MM_SESSION_OPTION_UNINTERRUPTIBLE) {
+ ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_REMOVE, MM_SESSION_OPTION_UNINTERRUPTIBLE);
+ if(ret){
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ updated = 1;
+ }
+ break;
+ case SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY:
+ if (!(session_option & MM_SESSION_OPTION_UNINTERRUPTIBLE)) {
+ ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_ADD, MM_SESSION_OPTION_UNINTERRUPTIBLE);
+ if(ret){
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ updated = 1;
+ }
+ break;
+ }
+
+ if (updated) {
+ LOGI("<< leave : updated");
+ } else {
+ LOGI("<< leave : already set same option(%x), skip it", session_option);
+ }
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_media_session_option(sound_session_option_for_starting_e *s_option, sound_session_option_for_during_play_e *d_option)
+{
+ int ret = MM_ERROR_NONE;
+ int session = 0;
+ int session_options = 0;
+
+ LOGI(">> enter");
+
+ if( s_option == NULL || d_option == NULL )
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+
+ ret = mm_session_get_current_information(&session, &session_options);
+ if( ret != 0 ) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ } else if (session > SOUND_SESSION_TYPE_MEDIA ) {
+ if (session == MM_SESSION_TYPE_MEDIA_RECORD) {
+ if (!g_session_interrupt_cb_table.is_registered) {
+ LOGE("Already set by camera/recorder/audio-io(in)/radio API, but need to set session to Media first");
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ } else {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ }
+ /* get option */
+ if (session_options & MM_SESSION_OPTION_PAUSE_OTHERS) {
+ *s_option = SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START;
+ } else {
+ *s_option = SOUND_SESSION_OPTION_MIX_WITH_OTHERS_WHEN_START;
+ }
+ if (session_options & MM_SESSION_OPTION_UNINTERRUPTIBLE) {
+ *d_option = SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY;
+ } else {
+ *d_option = SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY;
+ }
+
+ LOGI("<< leave : option for starting=%d, for during play=%d", *s_option, *d_option);
+
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
+int sound_manager_set_media_session_resumption_option(sound_session_option_for_resumption_e option)
+{
+ int ret = MM_ERROR_NONE;
+ int session = 0;
+ int session_option = 0;
+ int updated = 0;
+
+ LOGI(">> enter : option for resumption=%d (0:by system, 1:by system or media paused)", option);
+
+ if(option < SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM || option > SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+
+ ret = mm_session_get_current_information(&session, &session_option);
+ if ( ret != 0 || !g_session_interrupt_cb_table.is_registered) {
+ LOGW("need to set session type first");
+ return __convert_sound_manager_error_code(__func__, ret);
+ } else if ( ret == 0 && session > MM_SESSION_TYPE_MEDIA ) {
+ if (session == MM_SESSION_TYPE_MEDIA_RECORD) {
+ if (!g_session_interrupt_cb_table.is_registered) {
+ LOGE("Already set by camera/recorder/audio-io(in)/radio API, but need to set session to Media first");
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ } else {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ }
+
+ switch (option) {
+ case SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM:
+ if (session_option & MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED) {
+ ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_REMOVE, MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED);
+ if(ret){
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ updated = 1;
+ }
+ break;
+ case SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED:
+ if (!(session_option & MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED)) {
+ ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_ADD, MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED);
+ if(ret){
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ updated = 1;
+ }
+ break;
+ }
+
+ if (updated) {
+ LOGI("<< leave : updated");
+ } else {
+ LOGI("<< leave : already set same option(%x), skip it", session_option);
+ }
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_media_session_resumption_option(sound_session_option_for_resumption_e *option)
+{
+ int ret = MM_ERROR_NONE;
+ int session = 0;
+ int session_options = 0;
+
+ LOGI(">> enter");
+
+ if( option == NULL )
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+ ret = mm_session_get_current_information(&session, &session_options);
+ if( ret != 0 ) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ } else if (session > SOUND_SESSION_TYPE_MEDIA ) {
+ if (session == MM_SESSION_TYPE_MEDIA_RECORD) {
+ if (!g_session_interrupt_cb_table.is_registered) {
+ LOGE("Already set by camera/recorder/audio-io(in)/radio API, but need to set session to Media first");
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ } else {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ }
+ /* get option */
+ if (session_options & MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED) {
+ *option = SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED;
+ } else {
+ *option = SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM;
+ }
+
+ LOGI("<< leave : option for resumption=%d (0:by system, 1:by system or media paused)", *option);
+
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
+int sound_manager_set_voip_session_mode(sound_session_voip_mode_e mode)
+{
+ int ret = MM_ERROR_NONE;
+ int session = 0;
+ int session_options = 0;
+
+ LOGI(">> enter : mode=%d", mode);
+
+ ret = mm_session_get_current_information(&session, &session_options);
+ if( ret != MM_ERROR_NONE ) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ } else if (session != MM_SESSION_TYPE_VOIP ) {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+
+ if(mode < SOUND_SESSION_VOIP_MODE_RINGTONE || mode > SOUND_SESSION_VOIP_MODE_VOICE_WITH_BLUETOOTH) {
+ ret = MM_ERROR_INVALID_ARGUMENT;
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+
+ if (mode == SOUND_SESSION_VOIP_MODE_RINGTONE) {
+ /* sub-session */
+ if (g_cached_voip_mode != mode) {
+ ret = mm_session_set_subsession (MM_SUBSESSION_TYPE_RINGTONE, MM_SUBSESSION_OPTION_NONE);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ }
+ g_cached_voip_mode = mode;
+ } else {
+ mm_sound_route route;
+ bool need_to_check_device = false;
+ bool do_subsession = true;
+ switch (mode) {
+ case SOUND_SESSION_VOIP_MODE_RINGTONE:
+ do_subsession = false;
+ break;
+ case SOUND_SESSION_VOIP_MODE_VOICE_WITH_BUILTIN_RECEIVER:
+ route = MM_SOUND_ROUTE_IN_MIC_OUT_RECEIVER;
+ break;
+ case SOUND_SESSION_VOIP_MODE_VOICE_WITH_BUILTIN_SPEAKER:
+ route = MM_SOUND_ROUTE_IN_MIC_OUT_SPEAKER;
+ break;
+ case SOUND_SESSION_VOIP_MODE_VOICE_WITH_AUDIO_JACK:
+ route = MM_SOUND_ROUTE_IN_MIC_OUT_HEADPHONE;
+ need_to_check_device = true;
+ break;
+ case SOUND_SESSION_VOIP_MODE_VOICE_WITH_BLUETOOTH:
+ route = MM_SOUND_ROUTE_INOUT_BLUETOOTH;
+ need_to_check_device = true;
+ break;
+ }
+
+ if (need_to_check_device) {
+ int w_ret = MM_ERROR_NONE;
+ MMSoundDeviceList_t device_list;
+ MMSoundDevice_t device;
+ do_subsession = false;
+
+ ret = mm_sound_get_current_device_list(MM_SOUND_DEVICE_STATE_DEACTIVATED_FLAG, &device_list);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ } else {
+ while ((w_ret = mm_sound_get_next_device(device_list, &device)) == MM_ERROR_NONE) {
+ mm_sound_device_type_e type;
+ ret = mm_sound_get_device_type(device, &type);
+ if (ret != MM_ERROR_NONE)
+ return __convert_sound_manager_error_code(__func__, ret);
+
+ switch (mode) {
+ case SOUND_SESSION_VOIP_MODE_VOICE_WITH_AUDIO_JACK:
+ if (type == MM_SOUND_DEVICE_TYPE_AUDIOJACK)
+ do_subsession = true;
+ break;
+ case SOUND_SESSION_VOIP_MODE_VOICE_WITH_BLUETOOTH:
+ if (type == MM_SOUND_DEVICE_TYPE_BLUETOOTH) {
+ mm_sound_device_io_direction_e io_direction;
+ ret = mm_sound_get_device_io_direction(device, &io_direction);
+ if (ret != MM_ERROR_NONE)
+ return __convert_sound_manager_error_code(__func__, ret);
+ if (io_direction == MM_SOUND_DEVICE_IO_DIRECTION_BOTH)
+ do_subsession = true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ /* sub-session */
+ if (do_subsession && (g_cached_voip_mode != mode)) {
+ ret = mm_session_set_subsession (MM_SUBSESSION_TYPE_VOICE, MM_SUBSESSION_OPTION_NONE);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ /* route */
+ ret = mm_sound_set_active_route(route);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ g_cached_voip_mode = mode;
+ } else {
+ if (!do_subsession)
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+ }
+
+ LOGI("<< leave : session=%p, mode=%d, ret=0x%x", session, mode, ret);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_voip_session_mode(sound_session_voip_mode_e *mode)
+{
+ int ret = MM_ERROR_NONE;
+ int session = 0;
+ int session_options = 0;
+ int subsession = 0;
+
+ if(mode == NULL) {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+ }
+
+ ret = mm_session_get_current_information(&session, &session_options);
+ if( ret != MM_ERROR_NONE ) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ } else if (session != MM_SESSION_TYPE_VOIP ) {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+
+ ret = mm_session_get_subsession ((mm_subsession_t *)&subsession);
+ if(ret != MM_ERROR_NONE) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ }
+ switch (subsession) {
+ case MM_SUBSESSION_TYPE_VOICE:
+ {
+ int w_ret = MM_ERROR_NONE;
+ bool need_to_out = false;
+ MMSoundDeviceList_t device_list;
+ MMSoundDevice_t device;
+ ret = mm_sound_get_current_device_list(MM_SOUND_DEVICE_STATE_ACTIVATED_FLAG, &device_list);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_sound_manager_error_code(__func__, ret);
+ } else {
+ while ((w_ret = mm_sound_get_next_device(device_list, &device)) == MM_ERROR_NONE) {
+ mm_sound_device_type_e type;
+ ret = mm_sound_get_device_type(device, &type);
+ if (ret != MM_ERROR_NONE)
+ return __convert_sound_manager_error_code(__func__, ret);
+ switch (type) {
+ case MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER:
+ *mode = SOUND_SESSION_VOIP_MODE_VOICE_WITH_BUILTIN_SPEAKER;
+ need_to_out = true;
+ break;
+ case MM_SOUND_DEVICE_TYPE_BUILTIN_RECEIVER:
+ *mode = SOUND_SESSION_VOIP_MODE_VOICE_WITH_BUILTIN_RECEIVER;
+ need_to_out = true;
+ break;
+ case MM_SOUND_DEVICE_TYPE_AUDIOJACK:
+ *mode = SOUND_SESSION_VOIP_MODE_VOICE_WITH_AUDIO_JACK;
+ need_to_out = true;
+ break;
+ case MM_SOUND_DEVICE_TYPE_BLUETOOTH:
+ *mode = SOUND_SESSION_VOIP_MODE_VOICE_WITH_BLUETOOTH;
+ need_to_out = true;
+ break;
+ default:
+ break;
+ }
+ if (need_to_out)
+ break;
+ }
+ }
+ }
+ break;
+ case MM_SUBSESSION_TYPE_RINGTONE:
+ *mode = SOUND_SESSION_VOIP_MODE_RINGTONE;
+ break;
+ default:
+ break;
+ }
+
+ LOGI("returns : session=%p, mode=%d, ret=0x%x", session, *mode, ret);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_set_session_interrupted_cb(sound_session_interrupted_cb callback, void *user_data)
+{
+ int ret = MM_ERROR_NONE;
+ if(callback == NULL)
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+
+ if(g_session_interrupt_cb_table.is_registered ==0){
+ ret = mm_session_init_ex(SOUND_SESSION_TYPE_DEFAULT /*default*/ , __session_interrupt_cb, NULL);
+ if(ret != 0)
+ return __convert_sound_manager_error_code(__func__, ret);
+ g_session_interrupt_cb_table.is_registered = 1;
+ }
+
+ g_session_interrupt_cb_table.user_cb = (sound_session_interrupted_cb)callback;
+ g_session_interrupt_cb_table.user_data = user_data;
+ return SOUND_MANAGER_ERROR_NONE;
+}
+
+int sound_manager_unset_session_interrupted_cb(void)
+{
+ int ret = MM_ERROR_NONE;
+ if (g_session_interrupt_cb_table.user_cb) {
+ g_session_interrupt_cb_table.user_cb = NULL;
+ g_session_interrupt_cb_table.user_data = NULL;
+ } else {
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound_device_list_h *device_list)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_get_current_device_list((mm_sound_device_flags_e)device_mask, device_list);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_next_device (sound_device_list_h device_list, sound_device_h *device)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_get_next_device(device_list, device);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_prev_device (sound_device_list_h device_list, sound_device_h *device)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_get_prev_device(device_list, device);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_device_type (sound_device_h device, sound_device_type_e *type)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_get_device_type(device, (mm_sound_device_type_e*)type);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_device_io_direction (sound_device_h device, sound_device_io_direction_e *io_direction)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_get_device_io_direction(device, (mm_sound_device_io_direction_e*)io_direction);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_device_id (sound_device_h device, int *id)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_get_device_id(device, id);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_device_name (sound_device_h device, char **name)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_get_device_name(device, name);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_device_state (sound_device_h device, sound_device_state_e *state)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_get_device_state(device, (mm_sound_device_state_e*)state);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_set_device_connected_cb (sound_device_mask_e device_mask, sound_device_connected_cb callback, void *user_data)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_add_device_connected_callback((mm_sound_device_flags_e)device_mask, (mm_sound_device_connected_cb)callback, user_data);
+ if (ret == MM_ERROR_NONE) {
+ g_device_connected_cb_table.user_cb = (sound_device_connected_cb)callback;
+ g_device_connected_cb_table.user_data = user_data;
+ }
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_unset_device_connected_cb (void)
+{
+ int ret = MM_ERROR_NONE;
+ if (g_device_connected_cb_table.user_cb) {
+ ret = mm_sound_remove_device_connected_callback();
+ if (ret == MM_ERROR_NONE) {
+ g_device_connected_cb_table.user_cb = NULL;
+ g_device_connected_cb_table.user_data = NULL;
+ }
+ } else {
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_set_device_information_changed_cb (sound_device_mask_e device_mask, sound_device_information_changed_cb callback, void *user_data)
+{
+ int ret = MM_ERROR_NONE;
+ ret = mm_sound_add_device_information_changed_callback((mm_sound_device_flags_e)device_mask, (mm_sound_device_info_changed_cb)callback, user_data);
+ if (ret == MM_ERROR_NONE) {
+ g_device_info_changed_cb_table.user_cb = (sound_device_information_changed_cb)callback;
+ g_device_info_changed_cb_table.user_data = user_data;
+ }
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_unset_device_information_changed_cb (void)
+{
+ int ret = MM_ERROR_NONE;
+ if (g_device_info_changed_cb_table.user_cb) {
+ ret = mm_sound_remove_device_information_changed_callback();
+ if (ret == MM_ERROR_NONE) {
+ g_device_info_changed_cb_table.user_cb = NULL;
+ g_device_info_changed_cb_table.user_data = NULL;
+ }
+ } else {
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+__attribute__ ((destructor))
+void __sound_manager_finalize(void)
+{
+ int ret = MM_ERROR_NONE;
+
+ if(g_session_interrupt_cb_table.is_registered){
+ LOGI("<ENTER>");
+ ret = mm_session_finish();
+ if (ret != MM_ERROR_NONE) {
+ LOGE("[%s] failed to mm_session_finish(), ret(0x%x)", __func__, ret);
+ }
+ g_session_interrupt_cb_table.is_registered = 0;
+ LOGI("<LEAVE>");
+ }
+}
+
+__attribute__ ((constructor))
+void __sound_manager_initialize(void)
+{
+
+}
#include <mm_sound.h>
#include <dlog.h>
+extern _session_interrupt_info_s g_session_interrupt_cb_table;
+
int __convert_sound_manager_error_code(const char *func, int code) {
int ret = SOUND_MANAGER_ERROR_NONE;
char *errorstr = NULL;
switch(code)
{
- case SOUND_MANAGER_ERROR_INVALID_PARAMETER:
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- errorstr = "INVALID_PARAMETER";
- break;
- case SOUND_MANAGER_ERROR_INVALID_OPERATION:
+ case MM_ERROR_FILE_WRITE:
case MM_ERROR_INVALID_HANDLE:
ret = SOUND_MANAGER_ERROR_INVALID_OPERATION;
errorstr = "INVALID_OPERATION";
ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
errorstr = "INVALID_PARAMETER";
break;
+ case MM_ERROR_SOUND_PERMISSION_DENIED:
+ ret = SOUND_MANAGER_ERROR_PERMISSION_DENIED;
+ errorstr = "PERMISSION_DENIED";
+ break;
+ case MM_ERROR_SOUND_NO_DATA:
+ ret = SOUND_MANAGER_ERROR_NO_DATA;
+ errorstr = "NO_DATA";
+ break;
case MM_ERROR_SOUND_INTERNAL:
+ case MM_ERROR_SOUND_VOLUME_CAPTURE_ONLY:
ret = SOUND_MANAGER_ERROR_INTERNAL;
errorstr = "INTERNAL";
break;
ret = SOUND_MANAGER_ERROR_POLICY;
errorstr = "POLICY";
break;
- case MM_ERROR_POLICY_BLOCKED_BY_CALL:
- ret = SOUND_MANAGER_ERROR_POLICY_BLOCKED_BY_CALL;
- errorstr = "POLICY_BLOCKED_BY_CALL";
- break;
- case MM_ERROR_POLICY_BLOCKED_BY_ALARM:
- ret = SOUND_MANAGER_ERROR_POLICY_BLOCKED_BY_ALARM;
- errorstr = "POLICY_BLOCKED_BY_ALARM";
- break;
case MM_ERROR_SOUND_VOLUME_NO_INSTANCE:
ret = SOUND_MANAGER_ERROR_NO_PLAYING_SOUND;
errorstr = "NO_PLAYING_SOUND";
break;
- case MM_ERROR_SOUND_VOLUME_CAPTURE_ONLY:
- ret = SOUND_MANAGER_ERROR_CAPTURE_ONLY;
- errorstr = "CAPTURE_ONLY";
- break;
- case MM_ERROR_SOUND_VOLUME_BLOCKED_BY_SAFETY:
- ret = SOUND_MANAGER_ERROR_NO_OPERATION;
- errorstr = "NO_OPERATION";
- break;
}
LOGE("[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code);
return ret;
}
+
+void __session_interrupt_cb(session_msg_t msg, session_event_t event, void *user_data){
+ if( g_session_interrupt_cb_table.user_cb ){
+ sound_session_interrupted_code_e e = SOUND_SESSION_INTERRUPTED_COMPLETED;
+ if( msg == MM_SESSION_MSG_RESUME )
+ e = SOUND_SESSION_INTERRUPTED_COMPLETED;
+ else{
+ switch(event){
+ case MM_SESSION_EVENT_MEDIA :
+ e = SOUND_SESSION_INTERRUPTED_BY_MEDIA;
+ break;
+ case MM_SESSION_EVENT_CALL :
+ e = SOUND_SESSION_INTERRUPTED_BY_CALL;
+ break;
+ case MM_SESSION_EVENT_ALARM :
+ e = SOUND_SESSION_INTERRUPTED_BY_ALARM;
+ break;
+ case MM_SESSION_EVENT_EARJACK_UNPLUG:
+ e = SOUND_SESSION_INTERRUPTED_BY_EARJACK_UNPLUG;
+ break;
+ case MM_SESSION_EVENT_RESOURCE_CONFLICT:
+ e = SOUND_SESSION_INTERRUPTED_BY_RESOURCE_CONFLICT;
+ break;
+ case MM_SESSION_EVENT_EMERGENCY:
+ e = SOUND_SESSION_INTERRUPTED_BY_EMERGENCY;
+ break;
+ case MM_SESSION_EVENT_NOTIFICATION :
+ e = SOUND_SESSION_INTERRUPTED_BY_NOTIFICATION;
+ break;
+ default :
+ e = SOUND_SESSION_INTERRUPTED_BY_MEDIA;
+ break;
+ }
+ }
+ g_session_interrupt_cb_table.user_cb(e, g_session_interrupt_cb_table.user_data);
+ }
+}
SET(fw_test "${fw_name}-test")
INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED mm-sound glib-2.0 gthread-2.0 capi-media-player)
+pkg_check_modules(${fw_test} REQUIRED mm-sound glib-2.0 gthread-2.0)
FOREACH(flag ${${fw_test}_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
MESSAGE(${flag})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
-#ADD_EXECUTABLE("system-sensor" system-sensor.c)
-#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS})
-
aux_source_directory(. sources)
FOREACH(src ${sources})
GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
--- /dev/null
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <sound_manager.h>
+#include <pthread.h>
+#include <glib.h>
+//#include <dlfcn.h>
+
+#define MAX_STRING_LEN 2048
+
+
+enum
+{
+ CURRENT_STATUS_MAINMENU,
+ CURRENT_STATUS_GET_MAX_VOLUME,
+ CURRENT_STATUS_SET_VOLUME,
+ CURRENT_STATUS_GET_VOLUME,
+ CURRENT_STATUS_SET_CURRENT_SOUND_TYPE,
+ CURRENT_STATUS_GET_CURRENT_SOUND_TYPE,
+ CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE,
+ CURRENT_STATUS_SET_VOLUME_CHANGED_CB,
+ CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB,
+ CURRENT_STATUS_SET_SESSION_TYPE,
+ CURRENT_STATUS_GET_SESSION_TYPE,
+ CURRENT_STATUS_SET_MEDIA_SESSION_OPTION,
+ CURRENT_STATUS_GET_MEDIA_SESSION_OPTION,
+ CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION,
+ CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION,
+ CURRENT_STATUS_SET_VOIP_SESSION_MODE,
+ CURRENT_STATUS_GET_VOIP_SESSION_MODE,
+ CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB,
+ CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB,
+ CURRENT_STATUS_SET_DEVICE_MASK,
+ CURRENT_STATUS_GET_DEVICE_MASK,
+ CURRENT_STATUS_GET_DEVICE_LIST,
+ CURRENT_STATUS_GET_DEVICE_NEXT,
+ CURRENT_STATUS_GET_DEVICE_PREV,
+ CURRENT_STATUS_SET_DEVICE_CONNECTED_CB,
+ CURRENT_STATUS_UNSET_DEVICE_CONNECTED_CB,
+ CURRENT_STATUS_SET_DEVICE_INFO_CHANGED_CB,
+ CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB,
+};
+
+
+static int g_menu_state = CURRENT_STATUS_MAINMENU;
+
+GMainLoop* g_loop;
+sound_device_list_h g_device_list = NULL;
+sound_device_mask_e g_device_mask = SOUND_DEVICE_ALL_MASK;
+
+void quit_program()
+{
+ g_main_loop_quit(g_loop);
+}
+
+void _interpret_main_menu(char *cmd)
+{
+ if (strncmp(cmd, "gx", 2) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_GET_MAX_VOLUME;
+ }
+ else if (strncmp(cmd, "sv", 2) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_SET_VOLUME;
+ }
+ else if (strncmp(cmd, "gv", 2) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_GET_VOLUME;
+ }
+ else if (strncmp(cmd, "st", 2) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_SET_CURRENT_SOUND_TYPE;
+ }
+ else if (strncmp(cmd, "gt", 2) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_GET_CURRENT_SOUND_TYPE;
+ }
+ else if (strncmp(cmd, "ut", 2) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE;
+ }
+ else if (strncmp(cmd, "vc", 2) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_SET_VOLUME_CHANGED_CB;
+ }
+ else if (strncmp(cmd, "uv", 2) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB;
+ }
+ else if (strncmp(cmd, "ss", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_SET_SESSION_TYPE;
+ }
+ else if (strncmp(cmd, "gs", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_GET_SESSION_TYPE;
+ }
+ else if (strncmp(cmd, "sm", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_SET_MEDIA_SESSION_OPTION;
+ }
+ else if (strncmp(cmd, "gm", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_GET_MEDIA_SESSION_OPTION;
+ }
+ else if (strncmp(cmd, "sr", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION;
+ }
+ else if (strncmp(cmd, "gr", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION;
+ }
+ else if (strncmp(cmd, "so", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_SET_VOIP_SESSION_MODE;
+ }
+ else if (strncmp(cmd, "go", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_GET_VOIP_SESSION_MODE;
+ }
+ else if (strncmp(cmd, "sc", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB;
+ }
+ else if (strncmp(cmd, "us", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB;
+ }
+ else if (strncmp(cmd, "sk", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_SET_DEVICE_MASK;
+ }
+ else if (strncmp(cmd, "gk", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_GET_DEVICE_MASK;
+ }
+ else if (strncmp(cmd, "gl", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_GET_DEVICE_LIST;
+ }
+ else if (strncmp(cmd, "gn", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_GET_DEVICE_NEXT;
+ }
+ else if (strncmp(cmd, "gp", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_GET_DEVICE_PREV;
+ }
+ else if (strncmp(cmd, "sd", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_SET_DEVICE_CONNECTED_CB;
+ }
+ else if (strncmp(cmd, "ud", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_UNSET_DEVICE_CONNECTED_CB;
+ }
+ else if (strncmp(cmd, "si", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_SET_DEVICE_INFO_CHANGED_CB;
+ }
+ else if (strncmp(cmd, "ui", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB;
+ }
+ else if (strncmp(cmd, "q", 1) == 0 )
+ {
+ g_print("closing the test suite\n");
+ quit_program();
+ }
+ else
+ {
+ g_print("unknown menu \n");
+ }
+
+}
+
+void display_sub_basic()
+{
+ g_print("\n");
+ g_print("=========================================================================================\n");
+ g_print(" Sound Manager Test (press q to quit) \n");
+ g_print("-----------------------------------------------------------------------------------------\n");
+ g_print(" VOLUME MODULE \n");
+ g_print("-----------------------------------------------------------------------------------------\n");
+ g_print("gx. Get Max Volume \n");
+ g_print("sv. Set Volume \t");
+ g_print("gv. Get Volume \n");
+ g_print("st. Set Current Sound Type \t");
+ g_print("gt. Get Current Sound Type \t");
+ g_print("ut. Unset Current Sound Type \n");
+ g_print("vc. Set Volume Changed CB \t");
+ g_print("uv. Unset Volume Changed CB \n");
+ g_print("-----------------------------------------------------------------------------------------\n");
+ g_print(" SESSION MODULE \n");
+ g_print("-----------------------------------------------------------------------------------------\n");
+ g_print("ss. Set Session Type\t\t");
+ g_print("gs. Get Session Type\n");
+ g_print("sm. Set Media Session Option \t");
+ g_print("gm. Get Media Session Option \n");
+ g_print("sr. Set Media Session Resumption Option \t");
+ g_print("gr. Get Media Session Resumption Option \n");
+ g_print("so. Set Voip Session Mode \t");
+ g_print("go. Get Voip Session Mode \n");
+ g_print("sc. Set Session Interruped CB \t");
+ g_print("us. Unset Session Interrupted CB \n");
+ g_print("-----------------------------------------------------------------------------------------\n");
+ g_print(" DEVICE MODULE \n");
+ 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\n");
+ g_print("gn. Get Next Device\t\t");
+ g_print("gp. Get Prev Device\n");
+ g_print("sd. Set Device Connenected CB\t\t");
+ g_print("ud. Unset Device Connenected CB\n");
+ g_print("si. Set Device Information Changed CB\t");
+ g_print("ui. Unset Device Information Changed CB\n");
+ g_print("\n");
+ g_print("=========================================================================================\n");
+}
+
+static void displaymenu()
+{
+ static int flag = 0;
+ if (g_menu_state == CURRENT_STATUS_MAINMENU)
+ {
+ display_sub_basic();
+ flag = 0;
+ }
+ else if (g_menu_state == CURRENT_STATUS_GET_MAX_VOLUME)
+ {
+ g_print("*** input sound type(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE)\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_VOLUME)
+ {
+ if(flag == 0)
+ g_print("*** input sound type and desired volume level(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE, (0~max volum).\n");
+ flag =1;
+ }
+ else if (g_menu_state == CURRENT_STATUS_GET_VOLUME)
+ {
+ g_print("*** input sound type(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE)\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_CURRENT_SOUND_TYPE)
+ {
+ g_print("*** input sound type.(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE)\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_GET_CURRENT_SOUND_TYPE)
+ {
+ g_print("*** press enter to get current sound type\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE)
+ {
+ g_print("*** press enter to unset current sound type\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_VOLUME_CHANGED_CB)
+ {
+ g_print("*** press enter to set volume changed cb\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB)
+ {
+ g_print("*** press enter to unset volume changed cb\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_SESSION_TYPE)
+ {
+ g_print("*** input session type(0:MEDIA, 1:ALARM, 2:NOTIFICATION, 3:EMERGENCY, 4:VOIP)\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_GET_SESSION_TYPE)
+ {
+ g_print("*** press enter to get session type\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_MEDIA_SESSION_OPTION)
+ {
+ if(flag == 0)
+ g_print("*** input starting option, and ongoing(for starting(0:MIX WITH OTHERS, 1:PAUSE OTHERS), for ongoing(0:INTERRUPTABLE, 1:UNINTERRUPABLE)\n");
+ flag = 1;
+ }
+ else if (g_menu_state == CURRENT_STATUS_GET_MEDIA_SESSION_OPTION)
+ {
+ g_print("*** press enter to get media session option\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION)
+ {
+ g_print("*** input media session resumption option(0:BY SYSTEM, 1:OR MEDIA PAUSE)\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION)
+ {
+ g_print("*** press enter to get media session resumption option\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_VOIP_SESSION_MODE)
+ {
+ g_print("*** input voip session mode (0:RINGTONE, 1:VOICE with RCV, 2:VOICE with SPK, 3:VOICE with AudioJack, 4:VOICE with BT)\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_GET_VOIP_SESSION_MODE)
+ {
+ g_print("*** press enter to get voip session mode\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB)
+ {
+ g_print("*** press enter to set session interrupted cb\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB)
+ {
+ g_print("*** press enter to unset session interrupted cb\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_DEVICE_MASK)
+ {
+ 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_DEVICE_LIST)
+ {
+ g_print("*** press enter to get device list\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_NEXT)
+ {
+ g_print("*** press enter to get next device from the list\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_PREV)
+ {
+ g_print("*** press enter to get previous device from the list\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_DEVICE_CONNECTED_CB)
+ {
+ g_print("*** press enter to set device connected cb\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_UNSET_DEVICE_CONNECTED_CB)
+ {
+ g_print("*** press enter to unset device connected cb\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_SET_DEVICE_INFO_CHANGED_CB)
+ {
+ g_print("*** press enter to set device information changed cb\n");
+ }
+ else if (g_menu_state == CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB)
+ {
+ g_print("*** press enter to unset device information changed cb\n");
+ }
+ else
+ {
+ g_print("*** unknown status.\n");
+ quit_program();
+ }
+ g_print(" >>> ");
+}
+
+gboolean timeout_menu_display(void* data)
+{
+ displaymenu();
+ return FALSE;
+}
+
+gboolean timeout_quit_program(void* data)
+{
+ //elm_exit();
+ quit_program();
+ return FALSE;
+}
+
+int convert_sound_type(sound_type_e *type, char *cmd)
+{
+ int sound_type_n = atoi(cmd);
+ if (SOUND_TYPE_SYSTEM > sound_type_n || sound_type_n > SOUND_TYPE_VOICE)
+ {
+ g_print("not supported sound type(%d)\n", sound_type_n);
+ return 0;
+ }
+ else
+ {
+ switch (sound_type_n)
+ {
+ case 0:
+ *type = SOUND_TYPE_SYSTEM;
+ break;
+ case 1:
+ *type = SOUND_TYPE_NOTIFICATION;
+ break;
+ case 2:
+ *type = SOUND_TYPE_ALARM;
+ break;
+ case 3:
+ *type = SOUND_TYPE_RINGTONE;
+ break;
+ case 4:
+ *type = SOUND_TYPE_MEDIA;
+ break;
+ case 5:
+ *type = SOUND_TYPE_CALL;
+ break;
+ case 6:
+ *type = SOUND_TYPE_VOIP;
+ break;
+ case 7:
+ *type = SOUND_TYPE_VOICE;
+ break;
+ default:
+ break;
+ }
+ }
+ return 1;
+}
+
+int convert_session_type(sound_session_type_e *type, char *cmd)
+{
+ int session_type_n = atoi(cmd);
+ if (SOUND_SESSION_TYPE_MEDIA > session_type_n || session_type_n > SOUND_SESSION_TYPE_VOIP)
+ {
+ g_print("not supported session type(%d)\n", session_type_n);
+ return 0;
+ }
+ else
+ {
+ switch (session_type_n)
+ {
+ case 0:
+ *type = SOUND_SESSION_TYPE_MEDIA;
+ break;
+ case 1:
+ *type = SOUND_SESSION_TYPE_ALARM;
+ break;
+ case 2:
+ *type = SOUND_SESSION_TYPE_NOTIFICATION;
+ break;
+ case 3:
+ *type = SOUND_SESSION_TYPE_EMERGENCY;
+ break;
+ case 4:
+ *type = SOUND_SESSION_TYPE_VOIP;
+ break;
+ default:
+ break;
+ }
+ }
+ return 1;
+}
+
+void _set_volume_changed_cb(sound_type_e type, unsigned int volume, void *user_data)
+{
+ g_print("***the volume has changed. the volume of this sound type(%d) is : %d \n", type, volume);
+}
+
+void _set_session_interrupted_cb(sound_session_interrupted_code_e code, void *user_data)
+{
+ g_print("***your session has been interrupted by (%d)\n", code);
+}
+
+void _set_device_connected_cb(sound_device_h device, bool is_connected, void *user_data)
+{
+ sound_device_type_e type;
+ sound_device_io_direction_e io_direction;
+ sound_device_state_e state;
+ int id;
+ char *name;
+ int ret = SOUND_MANAGER_ERROR_NONE;
+
+ g_print("***device connected callback is called, is_connected[%d]\n", is_connected);
+
+ if ((ret = sound_manager_get_device_type (device, &type)))
+ g_print("failed to get device type, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_io_direction (device, &io_direction)))
+ g_print("failed to get device io direction, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_id (device, &id)))
+ g_print("failed to get device id, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_name (device, &name)))
+ g_print("failed to get device name, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_state (device, &state)))
+ g_print("failed to get device state, ret[0x%x]\n", ret);
+ if (!ret)
+ g_print(" -- device type[%d], io_direction[%d], id[%d], name[%s], state[%d]\n", type, io_direction, id, name, state);
+}
+
+void _set_device_info_changed_cb(sound_device_h device, sound_device_changed_info_e changed_info, void *user_data)
+{
+ sound_device_type_e type;
+ sound_device_io_direction_e io_direction;
+ sound_device_state_e state;
+ int id;
+ char *name;
+ int ret = SOUND_MANAGER_ERROR_NONE;
+
+ g_print("***device information changed callback is called, changed_info[%d](0:STATE 1:IO_DIRECTION)\n", changed_info);
+
+ if ((ret = sound_manager_get_device_type (device, &type)))
+ g_print("failed to get device type, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_io_direction (device, &io_direction)))
+ g_print("failed to get device io direction, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_id (device, &id)))
+ g_print("failed to get device id, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_name (device, &name)))
+ g_print("failed to get device name, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_state (device, &state)))
+ g_print("failed to get device state, ret[0x%x]\n", ret);
+ if (!ret)
+ g_print(" -- device type[%d], io_direction[%d], id[%d], name[%s], state[%d]\n", type, io_direction, id, name, state);
+}
+
+void reset_menu_state(void)
+{
+ g_menu_state = CURRENT_STATUS_MAINMENU;
+}
+
+static void interpret (char *cmd)
+{
+ switch (g_menu_state)
+ {
+ case CURRENT_STATUS_MAINMENU:
+ {
+ _interpret_main_menu(cmd);
+ }
+ break;
+ case CURRENT_STATUS_GET_MAX_VOLUME:
+ {
+ static sound_type_e type;
+ static int max;
+ if(convert_sound_type(&type,cmd) == 1)
+ {
+ if(sound_manager_get_max_volume(type, &max) != 0)
+ g_print("failt to get max volume\n");
+ else
+ g_print("the max volume of this type(%d) is %d\n", type, max);
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_VOLUME:
+ {
+ static int cnt =0;
+ static sound_type_e type;
+ static int volume;
+ switch(cnt)
+ {
+ case 0:
+ if(convert_sound_type(&type,cmd) == 1)
+ cnt ++;
+ else
+ reset_menu_state();
+ break;
+ case 1:
+ volume = atoi(cmd);
+ if(sound_manager_set_volume(type, volume) != 0)
+ g_print("fail to set volume(%d) check sound type(%d)'s available volume level\n", volume, type);
+ else
+ g_print("set volume success : sound type(%d), volume(%d)\n",type, volume);
+ cnt = 0;
+ reset_menu_state();
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case CURRENT_STATUS_GET_VOLUME:
+ {
+ static sound_type_e type;
+ static int volume;
+ if(convert_sound_type(&type,cmd) == 1)
+ {
+ if(sound_manager_get_volume(type, &volume) != 0)
+ g_print("fail to get volume\n");
+ else
+ g_print("current volume of this type(%d) is : %d\n", type, volume);
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_CURRENT_SOUND_TYPE:
+ {
+ static sound_type_e type;
+ if(convert_sound_type(&type,cmd) == 1)
+ {
+ if(sound_manager_set_current_sound_type(type) != 0)
+ g_print("fail to set sound type(%d)\n", type);
+ else
+ g_print("success to set sound type(%d)\n", type);
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_GET_CURRENT_SOUND_TYPE:
+ {
+ static sound_type_e type;
+ if(sound_manager_get_current_sound_type(&type) !=0)
+ g_print("fail to get current sound type\n");
+ else
+ g_print("current sound type is (%d)\n", type);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE:
+ {
+ if(sound_manager_unset_current_sound_type() !=0)
+ g_print("fail to unset current sound type\n");
+ else
+ g_print("success to unset current sound type\n");
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_VOLUME_CHANGED_CB:
+ {
+ if(sound_manager_set_volume_changed_cb(_set_volume_changed_cb, NULL) !=0)
+ g_print("fail to set volume changed cb\n");
+ else
+ g_print("success to set volume changed cb\n");
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB:
+ {
+ if(sound_manager_unset_volume_changed_cb() !=0)
+ g_print("fail to unset volume changed cb\n");
+ else
+ g_print("success to unset volume changed cb\n");
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_SESSION_TYPE:
+ {
+ static sound_session_type_e type;
+ if(convert_session_type(&type, cmd) == 1)
+ {
+ if(sound_manager_set_session_type(type) !=0)
+ g_print("fail to set session type\n");
+ else
+ g_print("success to set session type(%d)\n",type);
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_GET_SESSION_TYPE:
+ {
+ static sound_session_type_e type;
+ if(sound_manager_get_session_type(&type) !=0)
+ g_print("fail to get session type\n");
+ else
+ g_print("current session type is : %d (0:MEDIA, 1:ALARM, 2:NOTIFICATION, 3:EMERGENCY, 4:VOIP)\n", type);
+
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_MEDIA_SESSION_OPTION:
+ {
+ static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+ static sound_session_option_for_starting_e option_s;
+ static sound_session_option_for_during_play_e option_d;
+ static int cnt = 0;
+ if(sound_manager_set_session_type(type) !=0)
+ {
+ g_print("fail to set media session type\n");
+ reset_menu_state();
+ }
+ else
+ {
+ switch(cnt)
+ {
+ case 0:
+ option_s = (sound_session_option_for_starting_e)atoi(cmd);
+ if(SOUND_SESSION_OPTION_MIX_WITH_OTHERS_WHEN_START > option_s || SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START < option_s)
+ g_print("not supported option type\n");
+ else
+ cnt ++;
+ break;
+ case 1:
+ option_d = (sound_session_option_for_during_play_e)atoi(cmd);
+ if(SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY > option_d || SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY < option_d)
+ g_print("not supported option type\n");
+ else
+ {
+ if(sound_manager_set_media_session_option(option_s, option_d) != 0)
+ g_print("fail to set media session option\n");
+ else
+ g_print("success to set media session option\n");
+ cnt = 0;
+ }
+ reset_menu_state();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ break;
+ case CURRENT_STATUS_GET_MEDIA_SESSION_OPTION:
+ {
+ static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+ static sound_session_option_for_starting_e option_s;
+ static sound_session_option_for_during_play_e option_d;
+ if(sound_manager_set_session_type(type) != 0)
+ g_print("fail to set media session type\n");
+ else
+ {
+ if(sound_manager_get_media_session_option(&option_s,&option_d) !=0)
+ g_print("fail to get media session option\n");
+ else
+ g_print("current media session options are (%d) for starting, (%d) for ongoing\n", option_s, option_d);
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION:
+ {
+ static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+ static sound_session_option_for_resumption_e option_r;
+ if(sound_manager_set_session_type(type) != 0)
+ g_print("fail to set media session type\n");
+ else
+ {
+ option_r = (sound_session_option_for_resumption_e)atoi(cmd);
+ if(SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM > option_r || SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED < option_r)
+ g_print("not supported option type\n");
+ else
+ {
+ if(sound_manager_set_media_session_resumption_option(option_r) !=0)
+ g_print("fail to set media session resumption option\n");
+ else
+ g_print("succese to set media session resumption option\n");
+ }
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION:
+ {
+ static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+ static sound_session_option_for_resumption_e option_r;
+ if(sound_manager_set_session_type(type) != 0)
+ g_print("fail to set media session type\n");
+ else
+ {
+ if(sound_manager_get_media_session_resumption_option(&option_r) != 0)
+ g_print("fail to get media session resumption option\n");
+ else
+ g_print("current media session resumption option is : %d\n", option_r);
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_VOIP_SESSION_MODE:
+ {
+ int ret = SOUND_MANAGER_ERROR_NONE;
+ sound_session_voip_mode_e mode;
+ mode = (sound_session_voip_mode_e)atoi(cmd);
+ ret = sound_manager_set_voip_session_mode(mode);
+ if (ret) {
+ g_print("failed to set voip session mode(%d), ret[0x%x]\n", mode, ret);
+ } else {
+ g_print("success to set voip session mode\n");
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_GET_VOIP_SESSION_MODE:
+ {
+ int ret = SOUND_MANAGER_ERROR_NONE;
+ sound_session_voip_mode_e mode;
+ ret = sound_manager_get_voip_session_mode(&mode);
+ if(ret)
+ g_print("fail to get voip session mode, ret[0x%x]\n", ret);
+ else
+ g_print("success to get voip session mode, mode[%d]\n", mode);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB:
+ {
+ if(sound_manager_set_session_interrupted_cb(_set_session_interrupted_cb, NULL) != 0)
+ g_print("fail to set interrupted changed cb\n");
+ else
+ g_print("success to set interrupted changed cb\n");
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB:
+ {
+ if(sound_manager_unset_session_interrupted_cb() != 0)
+ g_print("fail to unset interrupted changed cb\n");
+ else
+ g_print("success to unset interrupted changed cb\n");
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_DEVICE_MASK:
+ {
+ if (strncmp(cmd, "0", 1) == 0) {
+ g_device_mask = SOUND_DEVICE_ALL_MASK;
+ reset_menu_state();
+ } else if (strncmp(cmd, "1", 1) == 0) {
+ if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+ g_device_mask = SOUND_DEVICE_TYPE_INTERNAL_MASK;
+ else
+ g_device_mask |= SOUND_DEVICE_TYPE_INTERNAL_MASK;
+ g_print("add TYPE_INTERNAL MASK\n");
+ } else if (strncmp(cmd, "2", 1) == 0) {
+ if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+ g_device_mask = SOUND_DEVICE_TYPE_EXTERNAL_MASK;
+ else
+ g_device_mask |= SOUND_DEVICE_TYPE_EXTERNAL_MASK;
+ g_print("add TYPE_EXTERNAL MASK\n");
+ } else if (strncmp(cmd, "3", 1) == 0) {
+ if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+ g_device_mask = SOUND_DEVICE_IO_DIRECTION_IN_MASK;
+ else
+ g_device_mask |= SOUND_DEVICE_IO_DIRECTION_IN_MASK;
+ g_print("add IO_DIRECTION_IN MASK\n");
+ } else if (strncmp(cmd, "4", 1) == 0) {
+ if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+ g_device_mask = SOUND_DEVICE_IO_DIRECTION_OUT_MASK;
+ else
+ g_device_mask |= SOUND_DEVICE_IO_DIRECTION_OUT_MASK;
+ g_print("add IO_DIRECTION_OUT MASK\n");
+ } else if (strncmp(cmd, "5", 1) == 0) {
+ if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+ g_device_mask = SOUND_DEVICE_IO_DIRECTION_BOTH_MASK;
+ else
+ g_device_mask |= SOUND_DEVICE_IO_DIRECTION_BOTH_MASK;
+ g_print("add IO_DIRECTION_BOTH MASK\n");
+ } else if (strncmp(cmd, "6", 1) == 0) {
+ if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+ g_device_mask = SOUND_DEVICE_STATE_ACTIVATED_MASK;
+ else
+ g_device_mask |= SOUND_DEVICE_STATE_ACTIVATED_MASK;
+ g_print("add STATE_ACTIVATED MASK\n");
+ } else if (strncmp(cmd, "7", 1) == 0) {
+ if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+ g_device_mask = SOUND_DEVICE_STATE_DEACTIVATED_MASK;
+ else
+ g_device_mask |= SOUND_DEVICE_STATE_DEACTIVATED_MASK;
+ g_print("add STATE_DEACTIVATED MASK\n");
+ } else if (strncmp(cmd, "b", 1) == 0) {
+ g_print("device mask[0x%x]\n", g_device_mask);
+ reset_menu_state();
+ } else {
+ g_print("invalid selection, please select again..\n");
+ }
+ }
+ break;
+ case CURRENT_STATUS_GET_DEVICE_MASK:
+ {
+ g_print("current device mask[0x%x]\n", g_device_mask);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_GET_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");
+ else
+ g_print("fail to get current device list, ret[0x%x]\n", ret);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_GET_DEVICE_NEXT:
+ {
+ sound_device_h device;
+ sound_device_type_e type;
+ sound_device_io_direction_e io_direction;
+ sound_device_state_e state;
+ int id;
+ char *name;
+ int ret = SOUND_MANAGER_ERROR_NONE;
+ if (!(ret = sound_manager_get_next_device(g_device_list, &device))) {
+ g_print("success to get next device\n");
+ if ((ret = sound_manager_get_device_type (device, &type)))
+ g_print("failed to get device type, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_io_direction (device, &io_direction)))
+ g_print("failed to get device io direction, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_id (device, &id)))
+ g_print("failed to get device id, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_name (device, &name)))
+ g_print("failed to get device name, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_state (device, &state)))
+ 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[%d]\n", type, io_direction, id, name, state);
+ } else {
+ g_print("failed to get next device, ret[0x%x]\n", ret);
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_GET_DEVICE_PREV:
+ {
+ sound_device_h device;
+ sound_device_type_e type;
+ sound_device_io_direction_e io_direction;
+ sound_device_state_e state;
+ int id;
+ char *name;
+ int ret = SOUND_MANAGER_ERROR_NONE;
+ if (!(ret = sound_manager_get_prev_device(g_device_list, &device))) {
+ g_print("success to get previous device\n");
+ if ((ret = sound_manager_get_device_type (device, &type)))
+ g_print("failed to get device type, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_io_direction (device, &io_direction)))
+ g_print("failed to get device io direction, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_id (device, &id)))
+ g_print("failed to get device id, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_name (device, &name)))
+ g_print("failed to get device name, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_state (device, &state)))
+ 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[%d]\n", type, io_direction, id, name, state);
+ } else {
+ g_print("failed to get previous device, ret[0x%x]\n", ret);
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_DEVICE_CONNECTED_CB:
+ {
+ if (sound_manager_set_device_connected_cb(g_device_mask, _set_device_connected_cb, NULL))
+ g_print("fail to set device connected cb\n");
+ else
+ g_print("success to set device connected cb\n");
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_UNSET_DEVICE_CONNECTED_CB:
+ {
+ if (sound_manager_unset_device_connected_cb())
+ g_print("fail to unset device connected cb\n");
+ else
+ g_print("success to unset device connected cb\n");
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_SET_DEVICE_INFO_CHANGED_CB:
+ {
+ if (sound_manager_set_device_information_changed_cb(g_device_mask, _set_device_info_changed_cb, NULL))
+ g_print("fail to set device information changed cb\n");
+ else
+ g_print("success to set device information changed cb\n");
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB:
+ {
+ if (sound_manager_unset_device_information_changed_cb())
+ g_print("fail to unset device information changed cb\n");
+ else
+ g_print("success to unset device information changed cb\n");
+ reset_menu_state();
+ }
+ break;
+ }
+ g_timeout_add(100, timeout_menu_display, 0);
+}
+
+gboolean input (GIOChannel *channel)
+{
+ gchar buf[MAX_STRING_LEN];
+ gsize read;
+ GError *error = NULL;
+
+ g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &error);
+ buf[read] = '\0';
+ g_strstrip(buf);
+ interpret (buf);
+
+ return TRUE;
+}
+
+int main(int argc, char *argv[])
+{
+ GIOChannel *stdin_channel;
+ 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_loop = g_main_loop_new (NULL, 1);
+
+ displaymenu();
+ g_main_loop_run (g_loop);
+
+ return 0;
+}
+++ /dev/null
-Seungkeun Lee <sngn.lee@samsung.com>
-Kangho Hur <kanho.hur@samsung.com>
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-
-SET(Services
- "application"
- "base"
- "content"
- "location"
- "media"
- "messaging"
- "network"
- "social"
- "telephony"
- "system"
- )
-
-
-# project
-SET(project_prefix "capi")
-SET(prefix "/usr")
-SET(version "0.0.1")
-SET(maintainer "Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>")
-SET(description "A Sound Manager library in Tizen Native API")
-SET(service "media")
-SET(submodule "sound-manager")
-
-# for package file
-SET(dependents "mm-sound dlog capi-base-common mm-session")
-SET(pc_dependents "capi-base-common")
-
-# for deb
-SET(deb_dependents "libdlog-0 libmm-sound-0")
-
-
-SET(fw_name "${project_prefix}-${service}-${submodule}")
-
-PROJECT(${fw_name})
-
-SET(CMAKE_INSTALL_PREFIX ${prefix})
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(VERSION ${version})
-
-SET(INC_DIR include)
-INCLUDE_DIRECTORIES(${INC_DIR})
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${dependents})
-FOREACH(flag ${${fw_name}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DTIZEN_DEBUG")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
-
-aux_source_directory(src SOURCES)
-ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
-
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
-
-SET_TARGET_PROPERTIES(${fw_name}
- PROPERTIES
- VERSION ${FULLVER}
- SOVERSION ${MAJORVER}
- CLEAN_DIRECT_OUTPUT 1
-)
-
-INSTALL(TARGETS ${fw_name} DESTINATION lib)
-INSTALL(
- DIRECTORY ${INC_DIR}/ DESTINATION include/${service}
- FILES_MATCHING
- PATTERN "*_private.h" EXCLUDE
- PATTERN "${INC_DIR}/*.h"
- )
-
-SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${pc_dependents})
-SET(PC_LDFLAGS -l${fw_name})
-
-CONFIGURE_FILE(
- ${fw_name}.pc.in
- ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
- @ONLY
-)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
-
-#ADD_SUBDIRECTORY(test)
-
-IF(UNIX)
-
-ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
-ADD_CUSTOM_COMMAND(
- DEPENDS clean
- COMMENT "distribution clean"
- COMMAND find
- ARGS .
- -not -name config.cmake -and \(
- -name tester.c -or
- -name Testing -or
- -name CMakeFiles -or
- -name cmake.depends -or
- -name cmake.check_depends -or
- -name CMakeCache.txt -or
- -name cmake.check_cache -or
- -name *.cmake -or
- -name Makefile -or
- -name core -or
- -name core.* -or
- -name gmon.out -or
- -name install_manifest.txt -or
- -name *.pc -or
- -name *~ \)
- | grep -v TC | xargs rm -rf
- TARGET distclean
- VERBATIM
-)
-
-ENDIF(UNIX)
+++ /dev/null
-#!/bin/sh
-
-source ./config
-
-export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
-#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware target path
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
-export PATH=$TET_TARGET_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
-export TET_ROOT=$TET_TARGET_PATH
+++ /dev/null
-#!/bin/sh
-. ./config
-
-export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
-#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
-export PATH=$TET_TARGET_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
-export TET_ROOT=$TET_TARGET_PATH
+++ /dev/null
-#!/bin/sh
-
-. ./_export_env.sh # setting environment variables
-
-export TET_SUITE_ROOT=`pwd`
-FILE_NAME_EXTENSION=`date +%s`
-
-RESULT_DIR=results
-HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir -p $RESULT_DIR
-
-tcc -c -p ./
-tcc -b -j $JOURNAL_RESULT -p ./
-grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+++ /dev/null
-#!/bin/sh
-
-. ./_export_env.sh # setting environment variables
-
-export TET_SUITE_ROOT=`pwd`
-RESULT_DIR=results
-
-tcc -c -p ./ # executing tcc, with clean option (-c)
-rm -r $RESULT_DIR
-rm -r tet_tmp_dir
-rm testcase/tet_captured
+++ /dev/null
-PKG_NAME=sound-manager
-TET_INSTALL_HOST_PATH=/var/tmp/dts_fw/TC/TETware
-TET_INSTALL_TARGET_PATH=/opt/home/$PKG_NAME/TETware
+++ /dev/null
-#!/bin/sh
-
-. ./_export_target_env.sh # setting environment variables
-
-export TET_SUITE_ROOT=`pwd`
-FILE_NAME_EXTENSION=`date +%s`
-
-RESULT_DIR=results
-HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir -p $RESULT_DIR
-
-tcc -e -j $JOURNAL_RESULT -p ./
-grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+++ /dev/null
-#!/bin/sh
-
-. ./config
-
-TC_PATH=/opt/home/$PKG_NAME
-
-echo $TC_PATH
-
-sdb shell "mkdir -p $TC_PATH"
-
-sdb push . $TC_PATH
-
-
+++ /dev/null
-#!/bin/sh
-
-source ./_export_target_env.sh
-
-export TET_SUITE_ROOT=`pwd`
-FILE_NAME_EXTENSION=`date +%s`
-
-RESULT_DIR=results
-HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir -p $RESULT_DIR
-
-tcc -e -j $JOURNAL_RESULT -p ./
-grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+++ /dev/null
-CC ?= gcc
-
-C_FILES = $(shell ls *.c)
-
-PKGS = capi-media-sound-manager dlog glib-2.0
-
-LDFLAGS = `pkg-config --libs $(PKGS)`
-LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
-LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
-LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
-
-CFLAGS = -I. `pkg-config --cflags $(PKGS)`
-CFLAGS += -I$(TET_ROOT)/inc/tet3
-CFLAGS += -Wall
-
-#TARGETS = $(C_FILES:%.c=tc-%)
-TCS := $(shell ls -1 *.c | cut -d. -f1)
-
-all: $(TCS)
-
-%: %.c
- $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
-
-clean:
- rm -f $(TCS)
+++ /dev/null
-/testcase/utc_media_sound_manager
-/testcase/utc_media_sound_manager_callback
\ No newline at end of file
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-
-#include <tet_api.h>
-#include <media/sound_manager.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_media_sound_manager_get_max_volume_p(void);
-static void utc_media_sound_manager_get_max_volume_n(void);
-static void utc_media_sound_manager_set_volume_p(void);
-static void utc_media_sound_manager_set_volume_n(void);
-static void utc_media_sound_manager_get_volume_p(void);
-static void utc_media_sound_manager_get_volume_n(void);
-static void utc_media_sound_manager_get_current_sound_type_p(void);
-static void utc_media_sound_manager_get_current_sound_type_n(void);
-static void utc_media_sound_manager_set_session_type_p(void);
-static void utc_media_sound_manager_set_session_type_n(void);
-static void utc_media_sound_manager_get_a2dp_status_p(void);
-static void utc_media_sound_manager_get_a2dp_status_n(void);
-
-static void utc_media_sound_manager_foreach_available_route_p(void);
-static void utc_media_sound_manager_foreach_available_route_n(void);
-static void utc_media_sound_manager_set_active_route_p(void);
-static void utc_media_sound_manager_set_active_route_n(void);
-static void utc_media_sound_manager_get_active_device_p(void);
-static void utc_media_sound_manager_get_active_device_n(void);
-static void utc_media_sound_manager_is_route_available_p(void);
-static void utc_media_sound_manager_is_route_available_n(void);
-
-static void utc_media_sound_manager_call_session_create_p(void);
-static void utc_media_sound_manager_call_session_create_n(void);
-static void utc_media_sound_manager_call_session_set_mode_p(void);
-static void utc_media_sound_manager_call_session_set_mode_n(void);
-static void utc_media_sound_manager_call_session_get_mode_p(void);
-static void utc_media_sound_manager_call_session_get_mode_n(void);
-static void utc_media_sound_manager_call_session_destroy_p(void);
-static void utc_media_sound_manager_call_session_destroy_n(void);
-
-static void utc_media_sound_manager_get_call_mute_p(void);
-static void utc_media_sound_manager_get_call_mute_n(void);
-static void utc_media_sound_manager_set_call_mute_p(void);
-static void utc_media_sound_manager_set_call_mute_n(void);
-static void utc_media_sound_manager_get_balance_p(void);
-static void utc_media_sound_manager_get_balance_n(void);
-static void utc_media_sound_manager_get_muteall_p(void);
-static void utc_media_sound_manager_get_muteall_n(void);
-static void utc_media_sound_manager_get_session_type_p(void);
-static void utc_media_sound_manager_get_session_type_n(void);
-static void utc_media_sound_manager_multi_session_create_p(void);
-static void utc_media_sound_manager_multi_session_create_n(void);
-static void utc_media_sound_manager_multi_session_destroy_p(void);
-static void utc_media_sound_manager_multi_session_destroy_n(void);
-static void utc_media_sound_manager_multi_session_get_mode_p(void);
-static void utc_media_sound_manager_multi_session_get_mode_n(void);
-static void utc_media_sound_manager_multi_session_get_option_p(void);
-static void utc_media_sound_manager_multi_session_get_option_n(void);
-static void utc_media_sound_manager_multi_session_set_mode_p(void);
-static void utc_media_sound_manager_multi_session_set_mode_n(void);
-static void utc_media_sound_manager_multi_session_set_option_p(void);
-static void utc_media_sound_manager_multi_session_set_option_n(void);
-static void utc_media_sound_manager_set_balance_p(void);
-static void utc_media_sound_manager_set_balance_n(void);
-static void utc_media_sound_manager_set_muteall_p(void);
-//static void utc_media_sound_manager_set_muteall_n(void);
-static void utc_media_sound_manager_set_volume_key_type_p(void);
-static void utc_media_sound_manager_set_volume_key_type_n(void);
-
-struct tet_testlist tet_testlist[] = {
- { utc_media_sound_manager_get_max_volume_p , POSITIVE_TC_IDX },
- { utc_media_sound_manager_get_max_volume_n , NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_volume_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_volume_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_get_volume_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_get_volume_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_get_current_sound_type_p , POSITIVE_TC_IDX },
- { utc_media_sound_manager_get_current_sound_type_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_get_a2dp_status_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_get_a2dp_status_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_foreach_available_route_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_foreach_available_route_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_active_route_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_active_route_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_get_active_device_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_get_active_device_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_is_route_available_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_is_route_available_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_call_session_create_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_call_session_create_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_call_session_set_mode_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_call_session_set_mode_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_call_session_get_mode_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_call_session_get_mode_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_call_session_destroy_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_call_session_destroy_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_session_type_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_session_type_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_get_call_mute_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_get_call_mute_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_call_mute_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_call_mute_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_get_balance_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_get_balance_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_get_muteall_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_get_muteall_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_get_session_type_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_get_session_type_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_create_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_create_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_destroy_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_destroy_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_get_mode_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_get_mode_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_get_option_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_get_option_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_set_mode_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_set_mode_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_set_option_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_multi_session_set_option_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_balance_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_balance_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_muteall_p, POSITIVE_TC_IDX },
-// { utc_media_sound_manager_set_muteall_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_volume_key_type_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_volume_key_type_n, NEGATIVE_TC_IDX },
- { NULL, 0 },
-};
-
-static void startup(void)
-{
- /* start of TC */
-}
-
-static void cleanup(void)
-{
- /* end of TC */
-}
-
-static void utc_media_sound_manager_get_max_volume_p(void)
-{
- int ret, max;
- char* api_name = "sound_manager_get_max_volume";
- if ((ret = sound_manager_get_max_volume(SOUND_TYPE_SYSTEM, &max)) == SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_get_max_volume_n(void)
-{
- int ret, max;
- char* api_name = "sound_manager_get_max_volume";
- if ((ret = sound_manager_get_max_volume(-1, &max)) != SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_set_volume_p(void)
-{
- int ret, max;
- char* api_name = "sound_manager_set_volume";
- if ((ret = sound_manager_get_max_volume(SOUND_TYPE_SYSTEM, &max)) == SOUND_MANAGER_ERROR_NONE)
- {
- if ((ret = sound_manager_set_volume(SOUND_TYPE_NOTIFICATION, max/2)) == SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_set_volume_n(void)
-{
- int ret;
- char* api_name = "sound_manager_set_volume";
- if ((ret = sound_manager_set_volume(-1, 10)) != SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_get_volume_p(void)
-{
- int ret, vol;
- char* api_name = "sound_manager_get_volume";
- if ((ret = sound_manager_get_volume(SOUND_TYPE_ALARM , &vol)) == SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_get_volume_n(void)
-{
- int ret;
- char* api_name = "sound_manager_get_volume";
- if ((ret = sound_manager_get_volume(SOUND_TYPE_ALARM , NULL)) != SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_get_current_sound_type_p(void)
-{
- sound_type_e type;
- int ret;
- char* api_name = "sound_manager_get_current_sound_type";
- ret = sound_manager_get_current_sound_type(&type);
- if (ret == SOUND_MANAGER_ERROR_NONE || ret == SOUND_MANAGER_ERROR_NO_PLAYING_SOUND)
- {
- dts_pass(api_name);
- }
-
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_get_current_sound_type_n(void)
-{
- int ret;
- char* api_name = "sound_manager_get_current_sound_type";
- if ((ret = sound_manager_get_current_sound_type(NULL)) != SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_set_session_type_p(void)
-{
- int ret;
- char* api_name = "sound_manager_set_session_type";
- if ((ret = sound_manager_set_session_type(SOUND_SESSION_TYPE_SHARE)) == SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-static void utc_media_sound_manager_set_session_type_n(void)
-{
- int ret;
- char* api_name = "sound_manager_set_session_type";
- if ((ret = sound_manager_set_session_type(-1)) != SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_get_a2dp_status_p(void)
-{
- bool connected;
- char *name;
- int ret;
- char* api_name = "sound_manager_get_a2dp_status";
- if ((ret = sound_manager_get_a2dp_status(&connected, &name)) == SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-static void utc_media_sound_manager_get_a2dp_status_n(void)
-{
- int ret;
- char* api_name = "sound_manager_get_a2dp_status";
- if ((ret = sound_manager_get_a2dp_status(NULL, NULL)) != SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static bool _sound_available_route_cb (sound_route_e route, void *user_data)
-{
- return false;
-}
-
-static void utc_media_sound_manager_foreach_available_route_p(void)
-{
- int ret;
- char* api_name = "sound_manager_foreach_available_route";
- ret = sound_manager_foreach_available_route(_sound_available_route_cb, NULL);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_foreach_available_route_n(void)
-{
- int ret;
- char* api_name = "sound_manager_foreach_available_route";
- ret = sound_manager_foreach_available_route(NULL, NULL);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_active_route_p(void)
-{
- int ret;
- char* api_name = "sound_manager_set_active_route";
- ret = sound_manager_set_active_route(SOUND_ROUTE_OUT_SPEAKER);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_active_route_n(void)
-{
- int ret;
- char* api_name = "sound_manager_set_active_route";
- ret = sound_manager_set_active_route(SOUND_ROUTE_INOUT_BLUETOOTH+1);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_get_active_device_p(void)
-{
- int ret;
- char* api_name = "sound_manager_get_active_device";
- sound_device_in_e in;
- sound_device_out_e out;
- ret = sound_manager_get_active_device(&in, &out);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_get_active_device_n(void)
-{
- int ret;
- char* api_name = "sound_manager_get_active_device";
- ret = sound_manager_get_active_device(NULL, NULL);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-static void utc_media_sound_manager_is_route_available_p(void)
-{
- int ret;
- char* api_name = "sound_manager_is_route_availiable";
- ret = sound_manager_is_route_available(SOUND_ROUTE_OUT_SPEAKER);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, true);
-}
-static void utc_media_sound_manager_is_route_available_n(void)
-{
- int ret;
- char* api_name = "sound_manager_is_route_availiable";
- ret = sound_manager_is_route_available(SOUND_ROUTE_INOUT_BLUETOOTH+1);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, true);
-}
-
-static void utc_media_sound_manager_call_session_create_p(void)
-{
- int ret;
- char* api_name = "sound_manager_call_session_create";
- sound_call_session_h session;
- ret = sound_manager_call_session_create(SOUND_SESSION_TYPE_CALL, &session);
- if (ret == SOUND_MANAGER_ERROR_NONE)
- sound_manager_call_session_destroy(session);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_call_session_create_n(void)
-{
- int ret;
- char* api_name = "sound_manager_call_session_create";
- ret = sound_manager_call_session_create(SOUND_SESSION_TYPE_CALL, NULL);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-static void utc_media_sound_manager_call_session_set_mode_p(void)
-{
- int ret;
- char* api_name = "sound_manager_call_session_set_mode";
- sound_call_session_h session;
- ret = sound_manager_call_session_create(SOUND_SESSION_TYPE_CALL, &session);
- if (ret != SOUND_MANAGER_ERROR_NONE) {
- dts_fail(api_name);
- }
- ret = sound_manager_call_session_set_mode (session, SOUND_CALL_SESSION_MODE_RINGTONE);
- sound_manager_call_session_destroy(session);
-
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_call_session_set_mode_n(void)
-{
- int ret;
- char* api_name = "sound_manager_call_session_set_mode";
- sound_call_session_h session;
- ret = sound_manager_call_session_create(SOUND_SESSION_TYPE_CALL, &session);
- if (ret != SOUND_MANAGER_ERROR_NONE) {
- dts_fail(api_name);
- }
- ret = sound_manager_call_session_set_mode (NULL, SOUND_CALL_SESSION_MODE_RINGTONE);
- sound_manager_call_session_destroy(session);
-
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-static void utc_media_sound_manager_call_session_get_mode_p(void)
-{
- int ret;
- char* api_name = "sound_manager_call_session_get_mode";
- sound_call_session_h session;
- sound_call_session_mode_e mode;
- ret = sound_manager_call_session_create(SOUND_SESSION_TYPE_CALL, &session);
- if (ret != SOUND_MANAGER_ERROR_NONE) {
- dts_fail(api_name);
- }
- ret = sound_manager_call_session_get_mode (session, &mode);
- sound_manager_call_session_destroy(session);
-
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_call_session_get_mode_n(void)
-{
- int ret;
- char* api_name = "sound_manager_call_session_get_mode";
- sound_call_session_h session;
- ret = sound_manager_call_session_create(SOUND_SESSION_TYPE_CALL, &session);
- if (ret != SOUND_MANAGER_ERROR_NONE) {
- dts_fail(api_name);
- }
- ret = sound_manager_call_session_get_mode (NULL, NULL);
- sound_manager_call_session_destroy(session);
-
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_call_session_destroy_p(void)
-{
- int ret;
- char* api_name = "sound_manager_call_sessioin_destroy";
- sound_call_session_h session;
- ret = sound_manager_call_session_create(SOUND_SESSION_TYPE_CALL, &session);
- if (ret != SOUND_MANAGER_ERROR_NONE) {
- dts_fail(api_name);
- }
- ret = sound_manager_call_session_destroy(session);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_call_session_destroy_n(void)
-{
- int ret;
- char* api_name = "sound_manager_call_sessioin_destroy";
- ret = sound_manager_call_session_destroy(NULL);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_get_call_mute_p(void)
-{
- int ret;
- char* api_name = "sound_manager_get_call_mute";
- int mute;
- sound_type_e type=SOUND_TYPE_CALL;
- ret = sound_manager_get_call_mute(type, &mute);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_get_call_mute_n(void)
-{
- int ret;
- char* api_name = "sound_manager_get_call_mute";
- sound_type_e type=SOUND_TYPE_ALARM;
- ret = sound_manager_get_call_mute(type, NULL);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_call_mute_p(void)
-{
- int ret;
- char* api_name = "sound_manager_set_call_mute";
- sound_type_e type=SOUND_TYPE_CALL;
- ret = sound_manager_set_call_mute(type, true);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_call_mute_n(void)
-{
- int ret;
- int mute=-10;
- char* api_name = "sound_manager_set_call_mute";
- sound_type_e type=SOUND_TYPE_ALARM;
- if( (ret = sound_manager_set_call_mute(type, mute)) != SOUND_MANAGER_ERROR_NONE)
- dts_pass(api_name);
- if( (ret = sound_manager_get_call_mute(type, &mute)) != SOUND_MANAGER_ERROR_NONE)
- dts_pass(api_name);
-
- dts_message(api_name, "get mute value : %d", mute);
- if(mute!=-10)
- dts_pass(api_name);
- else
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_get_balance_p(void)
-{
- int ret;
- char* api_name = "sound_manager_get_balance";
- float balance=0.0;
- ret = sound_manager_get_balance(&balance);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_get_balance_n(void)
-{
- int ret;
- char* api_name = "sound_manager_get_balance";
- ret = sound_manager_get_balance(NULL);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_get_muteall_p(void)
-{
- int ret;
- bool onoff=true;
- char* api_name = "sound_manager_get_muteall";
- ret = sound_manager_get_muteall(&onoff);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_get_muteall_n(void)
-{
- int ret;
- char* api_name = "sound_manager_get_muteall";
- ret = sound_manager_get_muteall(NULL);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_get_session_type_p(void)
-{
- int ret;
- sound_session_type_e type;
- char* api_name = "sound_manager_get_session_type";
- ret = sound_manager_get_session_type(&type);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_get_session_type_n(void)
-{
- int ret;
- char* api_name = "sound_manager_get_session_type";
- ret = sound_manager_get_session_type(NULL);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_multi_session_create_p(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_create";
- sound_multi_session_type_e type = SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION;
- sound_multi_session_h session;
- if( (ret = sound_manager_multi_session_create(type, &session)) == SOUND_MANAGER_ERROR_NONE)
- {
- sound_manager_multi_session_destroy(session);
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_create_n(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_create";
- sound_multi_session_type_e type = SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION;
- sound_multi_session_h *session=NULL;
- ret = sound_manager_multi_session_create(type, session);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_multi_session_destroy_p(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_destroy";
- sound_multi_session_type_e type = SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION;
- sound_multi_session_h session;
- if( (ret = sound_manager_multi_session_create(type, &session)) == SOUND_MANAGER_ERROR_NONE)
- {
- if( (ret = sound_manager_multi_session_destroy(session)) == SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_destroy_n(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_destroy";
- if( (ret = sound_manager_multi_session_destroy(NULL)) == SOUND_MANAGER_ERROR_NONE)
- dts_fail(api_name);
- else
- dts_pass(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_get_mode_p(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_get_mode";
- sound_multi_session_type_e type = SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION;
- sound_multi_session_h session;
- sound_multi_session_mode_e mode;
- if( (ret = sound_manager_multi_session_create(type, &session)) == SOUND_MANAGER_ERROR_NONE)
- {
- if( (ret = sound_manager_multi_session_get_mode(session, &mode)) == SOUND_MANAGER_ERROR_NONE)
- {
- sound_manager_multi_session_destroy(session);
- dts_pass(api_name);
- }
- else
- {
- sound_manager_multi_session_destroy(session);
- dts_fail(api_name);
- }
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_get_mode_n(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_get_mode";
- sound_multi_session_mode_e mode;
- if( (ret = sound_manager_multi_session_get_mode(NULL, &mode)) == SOUND_MANAGER_ERROR_NONE)
- dts_fail(api_name);
- else
- dts_pass(api_name);
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_get_option_p(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_get_option";
- sound_multi_session_type_e type = SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION;
- sound_multi_session_h session;
- sound_multi_session_option_e option;
- if( (ret = sound_manager_multi_session_create(type, &session)) == SOUND_MANAGER_ERROR_NONE)
- {
- if( (ret = sound_manager_multi_session_get_option(session, &option)) == SOUND_MANAGER_ERROR_NONE)
- {
- sound_manager_multi_session_destroy(session);
- dts_pass(api_name);
- }
- else
- {
- sound_manager_multi_session_destroy(session);
- dts_fail(api_name);
- }
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_get_option_n(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_get_option";
- sound_multi_session_option_e option = SOUND_MULTI_SESSION_OPT_RESUME_OTHERS;
- if( (ret = sound_manager_multi_session_get_option(NULL, &option)) == SOUND_MANAGER_ERROR_NONE)
- dts_fail(api_name);
- else
- dts_pass(api_name);
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_set_mode_p(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_set_mode";
- sound_multi_session_type_e type = SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION;
- sound_multi_session_h session;
- sound_multi_session_mode_e mode = SOUND_MULTI_SESSION_MODE_INIT;
- if( (ret = sound_manager_multi_session_create(type, &session)) == SOUND_MANAGER_ERROR_NONE)
- {
- if( (ret = sound_manager_multi_session_set_mode(session, mode)) == SOUND_MANAGER_ERROR_NONE)
- {
- sound_manager_multi_session_destroy(session);
- dts_pass(api_name);
- }
- else
- {
- sound_manager_multi_session_destroy(session);
- dts_fail(api_name);
- }
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_set_mode_n(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_set_mode";
- sound_multi_session_mode_e mode = SOUND_MULTI_SESSION_MODE_INIT;
- if( (ret = sound_manager_multi_session_set_mode(NULL, mode)) == SOUND_MANAGER_ERROR_NONE)
- dts_fail(api_name);
- else
- dts_pass(api_name);
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_set_option_p(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_set_option";
- sound_multi_session_type_e type = SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION;
- sound_multi_session_h session;
- sound_multi_session_option_e option = SOUND_MULTI_SESSION_OPT_RESUME_OTHERS;
- if( (ret = sound_manager_multi_session_create(type, &session)) == SOUND_MANAGER_ERROR_NONE)
- {
- if( (ret = sound_manager_multi_session_set_option(session, option)) == SOUND_MANAGER_ERROR_NONE)
- {
- sound_manager_multi_session_destroy(session);
- dts_pass(api_name);
- }
- else
- {
- sound_manager_multi_session_destroy(session);
- dts_fail(api_name);
- }
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_multi_session_set_option_n(void)
-{
- int ret;
- char* api_name = "sound_manager_multi_session_set_option";
- sound_multi_session_option_e option = SOUND_MULTI_SESSION_OPT_RESUME_OTHERS;
- if( (ret = sound_manager_multi_session_set_option(NULL, option)) == SOUND_MANAGER_ERROR_NONE)
- dts_fail(api_name);
- else
- dts_pass(api_name);
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_set_balance_p(void)
-{
- int ret ;
- char* api_name = "sound_manager_set_balance";
- float balance = 0.0;
- ret = sound_manager_set_balance(balance);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_balance_n(void)
-{
- int ret ;
- char* api_name = "sound_manager_set_balance";
- float balance = -2.0;
- ret = sound_manager_set_balance(balance);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_muteall_p(void)
-{
- int ret;
- char* api_name = "sound_manager_set_muteall";
- bool onoff=true;
- ret = sound_manager_set_muteall(onoff);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-/*
-static void utc_media_sound_manager_set_muteall_n(void)
-{
- int ret;
- bool onoff;
- char* api_name = "sound_manager_set_muteall";
- if( (ret = sound_manager_set_muteall(-1)) != SOUND_MANAGER_ERROR_NONE)
- dts_pass(api_name);
-
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-*/
-
-static void utc_media_sound_manager_set_volume_key_type_p(void)
-{
- int ret;
- volume_key_type_e type = VOLUME_KEY_TYPE_NONE;
- char* api_name = "sound_manager_set_volume_key_type";
- ret = sound_manager_set_volume_key_type(type);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_volume_key_type_n(void)
-{
- int ret;
- volume_key_type_e type = VOLUME_KEY_TYPE_NONE;
- char* api_name = "sound_manager_set_volume_key_type";
- ret = sound_manager_set_volume_key_type(VOLUME_KEY_TYPE_NONE-1);
- dts_message(api_name, "Call log: %d", ret);
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-
-#include <tet_api.h>
-#include <media/sound_manager.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_media_sound_manager_set_volume_changed_cb_p(void);
-static void utc_media_sound_manager_set_volume_changed_cb_n(void);
-static void utc_media_sound_manager_set_session_notify_cb_p(void);
-static void utc_media_sound_manager_set_session_notify_cb_n(void);
-
-static void utc_media_sound_manager_set_available_route_changed_cb_p(void);
-static void utc_media_sound_manager_set_available_route_changed_cb_n(void);
-static void utc_media_sound_manager_set_active_device_changed_cb_p(void);
-static void utc_media_sound_manager_set_active_device_changed_cb_n(void);
-
-static void utc_media_sound_manager_set_interrupted_cb_p(void);
-static void utc_media_sound_manager_set_interrupted_cb_n(void);
-static void utc_media_sound_manager_set_muteall_changed_cb_p(void);
-static void utc_media_sound_manager_set_muteall_changed_cb_n(void);
-static void utc_media_sound_manager_set_watch_cb_p(void);
-static void utc_media_sound_manager_set_watch_cb_n(void);
-/*
-static void utc_media_sound_manager_unset_active_device_changed_cb_p(void);
-static void utc_media_sound_manager_unset_active_device_changed_cb_n(void);
-static void utc_media_sound_manager_unset_available_route_changed_cb_p(void);
-static void utc_media_sound_manager_unset_available_route_changed_cb_n(void);
-static void utc_media_sound_manager_unset_interrupted_cb_p(void);
-static void utc_media_sound_manager_unset_interrupted_cb_n(void);
-static void utc_media_sound_manager_unset_muteall_changed_cb_p(void);
-static void utc_media_sound_manager_unset_muteall_changed_cb_n(void);
-static void utc_media_sound_manager_unset_session_notify_cb_p(void);
-static void utc_media_sound_manager_unset_session_notify_cb_n(void);
-static void utc_media_sound_manager_unset_volume_changed_cb_p(void);
-static void utc_media_sound_manager_unset_volume_changed_cb_n(void);
-*/
-static void utc_media_sound_manager_unset_watch_cb_p(void);
-static void utc_media_sound_manager_unset_watch_cb_n(void);
-
-struct tet_testlist tet_testlist[] = {
- { utc_media_sound_manager_set_volume_changed_cb_p , POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_volume_changed_cb_n , NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_session_notify_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_session_notify_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_available_route_changed_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_available_route_changed_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_active_device_changed_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_active_device_changed_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_interrupted_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_interrupted_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_muteall_changed_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_muteall_changed_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_set_watch_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_set_watch_cb_n, NEGATIVE_TC_IDX },
- /*
- { utc_media_sound_manager_unset_active_device_changed_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_unset_active_device_changed_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_unset_available_route_changed_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_unset_available_route_changed_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_unset_interrupted_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_unset_interrupted_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_unset_muteall_changed_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_unset_muteall_changed_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_unset_session_notify_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_unset_session_notify_cb_n, NEGATIVE_TC_IDX },
- { utc_media_sound_manager_unset_volume_changed_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_unset_volume_changed_cb_n, NEGATIVE_TC_IDX },
- */
- { utc_media_sound_manager_unset_watch_cb_p, POSITIVE_TC_IDX },
- { utc_media_sound_manager_unset_watch_cb_n, NEGATIVE_TC_IDX },
- { NULL, 0 },
-};
-
-static void startup(void)
-{
- /* start of TC */
-}
-
-static void cleanup(void)
-{
- /* end of TC */
-}
-
-static void _sound_volume_changed_cb(sound_type_e type, unsigned int volume, void *user_data)
-{
-}
-
-static void _sound_available_route_changed_cb (sound_route_e route, bool available, void *user_data)
-{
-}
-
-static void _sound_active_device_changed_cb (sound_device_in_e in, sound_device_out_e out, void *user_data)
-{
-}
-
-static void _sound_interrupted_cb (sound_interrupted_code_e code , void *user_data)
-{
-}
-
-static void _sound_manager_muteall_changed_cb (bool muteall, void *user_data)
-{
-}
-
-static void _sound_manager_volume_changed_cb(sound_type_e type, unsigned int volume, void *user_data)
-{
-}
-
-static void _sound_session_watch_cb(sound_session_watch_type_e type, sound_session_watch_state_e state, void *user_data)
-{
-}
-
-static void utc_media_sound_manager_set_volume_changed_cb_p(void)
-{
- char* api_name = "sound_manager_set_volume_changed_cb";
- int ret;
- if ((ret = sound_manager_set_volume_changed_cb(_sound_volume_changed_cb, &ret)) == SOUND_MANAGER_ERROR_NONE)
- {
- sound_manager_unset_volume_changed_cb();
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_set_volume_changed_cb_n(void)
-{
- char* api_name = "sound_manager_set_volume_changed_cb";
- int ret;
- if ((ret = sound_manager_set_volume_changed_cb(NULL, &ret)) != SOUND_MANAGER_ERROR_NONE)
- {
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-
-
-void _session_notify_cb(sound_session_notify_e notify, void *user_data)
-{
-}
-
-
-static void utc_media_sound_manager_set_session_notify_cb_p(void)
-{
- char* api_name = "sound_manager_set_session_notify_cb";
- int ret;
- if ((ret = sound_manager_set_session_notify_cb(_session_notify_cb, NULL)) == SOUND_MANAGER_ERROR_NONE)
- {
- sound_manager_unset_session_notify_cb();
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-
-}
-
-static void utc_media_sound_manager_set_session_notify_cb_n(void)
-{
- char* api_name = "sound_manager_set_session_notify_cb";
- int ret;
- if ((ret = sound_manager_set_session_notify_cb(NULL, NULL)) != SOUND_MANAGER_ERROR_NONE)
- {
- sound_manager_unset_session_notify_cb();
- dts_pass(api_name);
- }
- dts_message(api_name, "Call log: %d", ret);
- dts_fail(api_name);
-}
-/*
-static void utc_media_sound_manager_unset_session_notify_cb_p(void)
-{
- char* api_name = "sound_manager_unset_session_notify_cb";
- int ret = sound_manager_set_session_notify_cb(_session_notify_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- if( (ret = sound_manager_unset_session_notify_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_pass(api_name);
- else
- dts_fail(api_name);
- }
- else
- dts_fail(api_name);
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_unset_session_notify_cb_n(void)
-{
- char* api_name = "sound_manager_unset_session_notify_cb";
- if( (ret = sound_manager_unset_session_notify_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_fail(api_name);
- else
- dts_pass(api_name);
- dts_pass(api_name);
-}
-*/
-
-static void utc_media_sound_manager_set_available_route_changed_cb_p(void)
-{
- char* api_name = "sound_manager_set_available_route_changed_cb";
- int ret = sound_manager_set_available_route_changed_cb(_sound_available_route_changed_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_available_route_changed_cb ();
- }
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_available_route_changed_cb_n(void)
-{
- char* api_name = "sound_manager_set_available_route_changed_cb";
- int ret = sound_manager_set_available_route_changed_cb(NULL, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_available_route_changed_cb ();
- }
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-/*
-static void utc_media_sound_manager_unset_available_route_changed_cb_p(void)
-{
- char* api_name = "sound_manager_unset_available_route_changed_cb";
- int ret = sound_manager_set_available_route_changed_cb(_sound_available_route_changed_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- if( (ret = sound_manager_unset_available_route_changed_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_pass(api_name);
- else
- dts_fail(api_name);
- }
- else
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_unset_available_route_changed_cb_n(void)
-{
- char* api_name = "sound_manager_unset_available_route_changed_cb";
- if( (ret = sound_manager_unset_available_route_changed_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_fail(api_name);
- else
- dts_pass(api_name);
-}
-*/
-
-static void utc_media_sound_manager_set_active_device_changed_cb_p(void)
-{
- char* api_name = "sound_manager_set_active_device_changed_cb";
- int ret = sound_manager_set_active_device_changed_cb(_sound_active_device_changed_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_active_device_changed_cb ();
- }
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_active_device_changed_cb_n(void)
-{
- char* api_name = "sound_manager_set_active_device_changed_cb";
- int ret = sound_manager_set_active_device_changed_cb(NULL, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_active_device_changed_cb ();
- }
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-/*
-static void utc_media_sound_manager_unset_active_device_changed_cb_p(void)
-{
- char* api_name = "sound_manager_unset_active_device_changed_cb";
- int ret = sound_manager_set_active_device_changed_cb(_sound_active_device_changed_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- if( (ret = sound_manager_unset_active_device_changed_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_pass(api_name);
- else
- dts_fail(api_name);
- }
- else
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_unset_active_device_changed_cb_n(void)
-{
- char* api_name = "sound_manager_unset_active_device_changed_cb";
- if( (ret = sound_manager_unset_active_device_changed_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_fail(api_name);
- else
- dts_pass(api_name);
-}
-*/
-
-static void utc_media_sound_manager_set_interrupted_cb_p(void)
-{
- char* api_name = "sound_manager_set_interrupted_cb";
- int ret = sound_manager_set_interrupted_cb(_sound_interrupted_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_interrupted_cb ();
- }
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_interrupted_cb_n(void)
-{
- char* api_name = "sound_manager_set_interrupted_cb";
- int ret = sound_manager_set_interrupted_cb(NULL, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_interrupted_cb ();
- }
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-/*
-static void utc_media_sound_manager_unset_interrupted_cb_p(void)
-{
- char* api_name = "sound_manager_unset_interrupted_cb";
- int ret = sound_manager_set_interrupted_cb(_sound_interrupted_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- if( (ret = sound_manager_unset_interrupted_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_pass(api_name);
- else
- dts_fail(api_name);
- }
- else
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_unset_interrupted_cb_n(void)
-{
- char* api_name = "sound_manager_unset_interrupted_cb";
- if( (ret = sound_manager_unset_interrupted_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_fail(api_name);
- else
- dts_pass(api_name);
-}
-*/
-
-static void utc_media_sound_manager_set_muteall_changed_cb_p(void)
-{
- char* api_name = "sound_manager_set_muteall_changed_cb";
- int ret = sound_manager_set_muteall_changed_cb(_sound_manager_muteall_changed_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_muteall_changed_cb ();
- }
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_muteall_changed_cb_n(void)
-{
- char* api_name = "sound_manager_set_muteall_changed_cb";
- int ret = sound_manager_set_muteall_changed_cb(NULL, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_muteall_changed_cb ();
- }
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-/*
-static void utc_media_sound_manager_unset_muteall_changed_cb_p(void)
-{
- char* api_name = "sound_manager_unset_muteall_changed_cb";
- int ret = sound_manager_set_muteall_changed_cb(_sound_manager_muteall_changed_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- if( (ret = sound_manager_unset_muteall_changed_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_pass(api_name);
- else
- dts_fail(api_name);
- }
- else
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_unset_muteall_changed_cb_n(void)
-{
- char* api_name = "sound_manager_unset_muteall_changed_cb";
- if( (ret = sound_manager_unset_muteall_changed_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_fail(api_name);
- else
- dts_pass(api_name);
-}
-
-static void utc_media_sound_manager_unset_volume_changed_cb_p(void)
-{
- char* api_name = "sound_manager_unset_volume_changed_cb";
- int ret = sound_manager_set_volume_changed_cb(_sound_manager_volume_changed_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- if( (ret = sound_manager_unset_volume_changed_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_pass(api_name);
- else
- dts_fail(api_name);
- }
- else
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_unset_volume_changed_cb_n(void)
-{
- char* api_name = "sound_manager_unset_volume_changed_cb";
- if( (ret = sound_manager_unset_volume_changed_cb ()) != SOUND_MANAGER_ERROR_NONE )
- dts_fail(api_name);
- else
- dts_pass(api_name);
-}
-*/
-
-static void utc_media_sound_manager_set_watch_cb_p(void)
-{
- char* api_name = "sound_manager_set_watch_cb";
- sound_session_watch_type_e type = SOUND_SESSION_WATCH_TYPE_CALL;
- int ret = sound_manager_set_watch_cb(type, _sound_session_watch_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_watch_cb (type);
- }
- dts_check_eq(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_set_watch_cb_n(void)
-{
- char* api_name = "sound_manager_set_watch_cb";
- sound_session_watch_type_e type = SOUND_SESSION_WATCH_TYPE_CALL;
- int ret = sound_manager_set_watch_cb(type, NULL, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- sound_manager_unset_watch_cb (type);
- }
- dts_check_ne(api_name, ret, SOUND_MANAGER_ERROR_NONE);
-}
-
-static void utc_media_sound_manager_unset_watch_cb_p(void)
-{
- char* api_name = "sound_manager_unset_watch_cb";
- sound_session_watch_type_e type = SOUND_SESSION_WATCH_TYPE_CALL;
- int ret = sound_manager_set_watch_cb(type, _sound_session_watch_cb, NULL);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- if( (ret = sound_manager_unset_watch_cb(type)) == SOUND_MANAGER_ERROR_NONE )
- dts_pass(api_name);
- else
- dts_fail(api_name);
- }
- else
- dts_fail(api_name);
-}
-
-static void utc_media_sound_manager_unset_watch_cb_n(void)
-{
- int ret;
- char* api_name = "sound_manager_unset_watch_cb";
- sound_session_watch_type_e type = SOUND_SESSION_WATCH_TYPE_CALL;
- if( (ret = sound_manager_unset_watch_cb(type)) != SOUND_MANAGER_ERROR_NONE )
- dts_pass(api_name);
- else
- dts_fail(api_name);
-}
+++ /dev/null
-all
- ^TEST
-##### Scenarios for TEST #####
-
-# Test scenario
-TEST
- :include:/testcase/tslist
+++ /dev/null
-TET_OUTPUT_CAPTURE=True # capture option for build operation checking
-TET_BUILD_TOOL=make # build with using make command
-TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
-TET_API_COMPLIANT=True # use TET API in Test Case ?
-TET_PASS_TC_NAME=True # report passed TC name in Journal file?
+++ /dev/null
-TET_OUTPUT_CAPTURE=True # capture option
-TET_CLEAN_TOOL= make clean # clean tool
-TET_CLEAN_FILE= Makefile # file for clean
-TET_API_COMPLIANT=True # TET API useage
-TET_PASS_TC_NAME=True # showing name , passed TC
+++ /dev/null
-TET_OUTPUT_CAPTURE=True # capturing execution or not
-TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional
-TET_EXEC_FILE= # ex) exectool : execution file/ Optional
-TET_API_COMPLIANT=True # Test case or Tool usesTET API?
-TET_PASS_TC_NAME=True # showing Passed TC name ?
+++ /dev/null
-/usr/include/*
-/usr/include/*/*
-/usr/lib/pkgconfig/*.pc
-
+++ /dev/null
-/usr/lib/lib*.so*
+++ /dev/null
-capi-media-sound-manager (0.1.0-18) unstable; urgency=low
-
- * add sound_manager_get_session_type API
- * Git: slp-source.sec.samsung.net:framework/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-18
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Thu, 27 Sep 2012 13:56:41 +0900
-
-capi-media-sound-manager (0.1.0-14) unstable; urgency=low
-
- * delete sound_manager_get_current_sound_device,sound policy API
- * Git: slp-source.sec.samsung.net:framework/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-14
-
- -- Seungbae Shin <seungbae.shin@samsung.com> Tue, 04 Sep 2012 17:15:57 +0900
-
-capi-media-sound-manager (0.1.0-13) unstable; urgency=low
-
- * package upload
- * Git: slp-source.sec.samsung.net:framework/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-13
-
- -- Seungbae Shin <seungbae.shin@samsung.com> Tue, 21 Aug 2012 14:08:35 +0900
-
-capi-media-sound-manager (0.1.0-12) unstable; urgency=low
-
- * Add interrupted callback API
- * Git: slp-source.sec.samsung.net:framework/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-12
-
- -- Seungbae Shin <seungbae.shin@samsung.com> Thu, 16 Aug 2012 13:40:24 +0900
-
-capi-media-sound-manager (0.1.0-11) unstable; urgency=low
-
- * Add TC for audioroute
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-11
-
- -- Seungbae Shin <seungbae.shin@samsung.com> Fri, 11 May 2012 16:17:31 +0900
-
-capi-media-sound-manager (0.1.0-10) unstable; urgency=low
-
- * Add uploader
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-10
-
- -- Seungbae Shin <seungbae.shin@samsung.com> Fri, 27 Apr 2012 11:24:21 +0900
-
-capi-media-sound-manager (0.1.0-9) unstable; urgency=low
-
- * CAPI updated for audio route
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-9
-
- -- Seongho Jeong <sh33.jeong@samsung.com> Thu, 29 Mar 2012 19:41:11 +0900
-
-capi-media-sound-manager (0.1.0-8) unstable; urgency=low
-
- * add volume key api
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-8
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Mon, 26 Mar 2012 16:31:05 +0900
-
-capi-media-sound-manager (0.1.0-7) unstable; urgency=low
-
- * add so version
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-7
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Tue, 14 Feb 2012 16:55:35 +0900
-
-capi-media-sound-manager (0.1.0-6) unstable; urgency=low
-
- * Update error none value
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-6
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Mon, 05 Dec 2011 11:04:34 +0900
-
-capi-media-sound-manager (0.1.0-5) unstable; urgency=low
-
- * Update sound_manager_set_volume parameter
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-5
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Mon, 05 Dec 2011 10:10:26 +0900
-
-capi-media-sound-manager (0.1.0-4) unstable; urgency=low
-
- * Update Log formatting
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-4
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Sun, 27 Nov 2011 14:05:10 +0900
-
-capi-media-sound-manager (0.1.0-3) unstable; urgency=low
-
- * Update namespace
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-3
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Wed, 23 Nov 2011 13:01:46 +0900
-
-capi-media-sound-manager (0.1.0-2) unstable; urgency=low
-
- * sound_manager_set_session_notify_cb , callback null check
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-2
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Fri, 07 Oct 2011 10:03:00 +0900
-
-capi-media-sound-manager (0.1.0-1) unstable; urgency=low
-
- * SDK API Baseline
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.1.0-1
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Tue, 27 Sep 2011 17:43:56 +0900
-
-capi-media-sound-manager (0.0.1-4) unstable; urgency=low
-
- * Update TC
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.0.1-4
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Wed, 31 Aug 2011 19:03:34 +0900
-
-capi-media-sound-manager (0.0.1-3) unstable; urgency=low
-
- * Update package dependancy
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.0.1-3
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Mon, 29 Aug 2011 14:41:46 +0900
-
-capi-media-sound-manager (0.0.1-2) unstable; urgency=low
-
- * ERROR name is changed
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.0.1-2
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Mon, 29 Aug 2011 10:30:41 +0900
-
-capi-media-sound-manager (0.0.1-1) unstable; urgency=low
-
- * Initial Upload
- * Git: slp-source.sec.samsung.net:slp/api/sound-manager
- * Tag: capi-media-sound-manager_0.0.1-1
-
- -- Seungkeun Lee <sngn.lee@samsung.com> Thu, 04 Aug 2011 17:32:41 +0900
+++ /dev/null
-
-Source: capi-media-sound-manager
-Section: libs
-Priority: extra
-Maintainer: Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>
-Uploaders: Seungbae Shin <seungbae.shin@samsung.com>
-Build-Depends: debhelper (>= 5), libmm-sound-dev , capi-base-common-dev , dlog-dev, libmm-session-dev
-
-Package: capi-media-sound-manager
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: A Sound Manager library in Tizen Native API
-
-Package: capi-media-sound-manager-dev
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-sound-manager (= ${Source-Version}), capi-base-common-dev
-Description: A Sound Manager library in Tizen Native API (DEV)
-
-Package: capi-media-sound-manager-dbg
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-sound-manager (= ${Source-Version})
-Description: A Sound Manager library in Tizen Native API (DBG)
-
+++ /dev/null
-#!/usr/bin/make -f
-
-CFLAGS = -Wall -g
-
-FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
-MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-CMAKE_ROOT_DIR ?= $(CURDIR)
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
- touch configure-stamp
-
-
-build: build-stamp
-build-stamp: configure-stamp
- dh_testdir
- cd $(CMAKE_BUILD_DIR) && $(MAKE)
- touch $@
-
-clean:
- cd $(CMAKE_ROOT_DIR)
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
- rm -f
- rm -rf $(CMAKE_BUILD_DIR)
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-binary-indep: build install
-
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- dh_installexamples
- dh_install --sourcedir=debian/tmp
- dh_installman
- dh_link
- dh_strip --dbg-package=capi-media-sound-manager-dbg
- dh_fixperms
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __TIZEN_MEDIA_SOUND_MANAGER_DOC_H__
-#define __TIZEN_MEDIA_SOUND_MANAGER_DOC_H__
-
-
-/**
- * @file sound_manager_doc.h
- * @brief This file contains high level documentation of the Sound Manager API.
- */
-
-/**
- * @defgroup CAPI_MEDIA_SOUND_MANAGER_MODULE Sound Manager
- * @brief The @ref CAPI_MEDIA_SOUND_MANAGER_MODULE APIs provides functions to get and set sound parameters like volume and route policy.
- * @ingroup CAPI_MEDIA_FRAMEWORK
- *
- * @section CAPI_MEDIA_SOUND_MANAGER_MODULE_HEADER Required Header
- * \#include <sound_manager.h>
- *
- * @section CAPI_MEDIA_SOUND_MANAGER_OVERVIEW Overview
- * The Sound Manager service provides APIs to manage audio output.
- *
- * The Sound Manager API allows you to:
- * - check/control output volume
- * - change audio route policy
- * - handle volume changed notification
- * - handle audio route policy change notificat
- *
- * Current volume level can be checked with sound_manager_get_volume().
- * To get maximum supported volume level, call sound_manager_get_max_volume().
- * The volume level can be adjusted with sound_manager_set_volume().
- *
- * The Sound Manager has predefined types of sounds, such as ringtone, call, alarm, etc. The type of the currently playing sound may be
- * obtained by calling sound_manager_get_current_sound_type().
- *
- * @subsection CAPI_MEDIA_SOUND_MANAGER_DESCRIPTION_ROUTE_POLICY Route policy
- * The route policy is responsible for selection of sound sources and outputs that should be active. \n
- * Note: The bluetooth headset microphone is used only in the voice call mode.
- * <p>
- * <ul>
- * <li> The default audio route policy is #SOUND_ROUTE_DEFAULT <p></li>
- * <table>
- * <tr>
- * <td><b>Mode</b></td>
- * <td><b>Bluetooth headset</b></td>
- * <td><b>Wired headset</b></td>
- * <td><b>Used device</b></td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>connected</td>
- * <td>plugged</td>
- * <td>Bluetooth headset</td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>connected</td>
- * <td>unplugged</td>
- * <td>Bluetooth headset</td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>disconnected</td>
- * <td>plugged</td>
- * <td>Wired headset</td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>disconnected</td>
- * <td>unplugged</td>
- * <td>Loudspeaker</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>connected</td>
- * <td>plugged</td>
- * <td>Wired headset microphone</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>connected</td>
- * <td>unplugged</td>
- * <td>Microphone</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>disconnected</td>
- * <td>plugged</td>
- * <td>Wired headset microphone</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>disconnected</td>
- * <td>unplugged</td>
- * <td>Built-in microphone</td>
- * </tr>
- * </table>
- *
- * <li> The bluetooth headset will be ignored for the routing policy set to #SOUND_ROUTE_IGNORE_A2DP <p></li>
- * <table>
- * <tr>
- * <td><b>Mode</b></td>
- * <td><b>Bluetooth headset</b></td>
- * <td><b>Wired headset</b></td>
- * <td><b>Used device</b></td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>connected</td>
- * <td>plugged</td>
- * <td>Wired headset</td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>connected</td>
- * <td>unplugged</td>
- * <td>Loudspeaker</td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>disconnected</td>
- * <td>plugged</td>
- * <td>Wired headset</td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>disconnected</td>
- * <td>unplugged</td>
- * <td>Loudspeaker</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>connected</td>
- * <td>plugged</td>
- * <td>Wired headset microphone</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>connected</td>
- * <td>unplugged</td>
- * <td>Microphone</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>disconnected</td>
- * <td>plugged</td>
- * <td>Wired headset microphone</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>disconnected</td>
- * <td>unplugged</td>
- * <td>Built-in microphone</td>
- * </tr>
- * </table>
- *
- * <li> Only the loudspeaker and microphone will be used for the routing policy set to #SOUND_ROUTE_HANDSET_ONLY <p></li>
- * <table>
- * <tr>
- * <td><b>Mode</b></td>
- * <td><b>Bluetooth headset</b></td>
- * <td><b>Wired headset</b></td>
- * <td><b>Used device</b></td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>connected</td>
- * <td>plugged</td>
- * <td>Loudspeaker</td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>connected</td>
- * <td>unplugged</td>
- * <td>Loudspeaker</td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>disconnected</td>
- * <td>plugged</td>
- * <td>Loudspeaker</td>
- * </tr>
- * <tr>
- * <td>PLAYBACK</td>
- * <td>disconnected</td>
- * <td>unplugged</td>
- * <td>Loudspeaker</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>connected</td>
- * <td>plugged</td>
- * <td>Microphone</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>connected</td>
- * <td>unplugged</td>
- * <td>Microphone</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>disconnected</td>
- * <td>plugged</td>
- * <td>Microphone</td>
- * </tr>
- * <tr>
- * <td>CAPTURE</td>
- * <td>disconnected</td>
- * <td>unplugged</td>
- * <td>Microphone</td>
- * </tr>
- * </table>
- * </ul>
- *
- * The sound_manager_set_route_policy() and sound_manager_get_route_policy() functions set and check the route policy, which is limited to the pre-defined policies described.
- *
- * @subsection CAPI_MEDIA_SOUND_MANAGER_LIFE_CYCLE_ASYNCHRONOUS_OPERATIONS Asynchronous operations
- * The Sound Manager API provides only asynchronous operations. \n
- * Thus the result will be passed to the application via the callback mechanism.
- * An appropriate callback can be called in response to changes initiated from outside the application. \n
- * Possible callbacks are listed below:
- * <p>
- * <ul>
- * <li> sound_manager_volume_changed_cb - invoked when volume level is changed.<p></li>
- * <li> sound_manager_route_policy_changed_cb - invoked when route policy is changed.<p></li>
- * </ul>
- *
- * @subsection CAPI_MEDIA_SOUND_MANAGER_MODULE_LIFE_CYCLE_CALLBACK_OPERATIONS Callback(Event) Operations
- * The callback mechanism is used to notify the application about significant sound manager events.
- * <div><table class="doxtable" >
- * <tr>
- * <th><b> REGISTER</b></th>
- * <th><b> UNREGISTER</b></th>
- * <th><b> CALLBACK</b></th>
- * <th><b> DESCRIPTION</b></th>
- * </tr>
- * <tr>
- * <td> sound_manager_set_volume_changed_cb()</td>
- * <td> sound_manager_unset_volume_changed_cb()</td>
- * <td> sound_manager_volume_changed_cb()</td>
- * <td> This callback is called when volume value is changed.</td>
- * </tr>
- * <tr>
- * <td> sound_manager_set_route_policy_changed_cb()</td>
- * <td> sound_manager_unset_route_policy_changed_cb()</td>
- * <td> sound_manager_route_policy_changed_cb()</td>
- * <td> This callback is called when the route policy is changed.</td>
- * </tr>
- * </table></div>
- *
-*/
-
-#endif /* __TIZEN_MEDIA_SOUND_MANAGER_DOC_H__ */
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-
-#ifndef __TIZEN_MEDIA_SOUND_MANAGER_H__
-#define __TIZEN_MEDIA_SOUND_MANAGER_H__
-
-#include <tizen.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define SOUND_MANAGER_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x30
-
-/**
- * @file sound_manager.h
- * @brief This file contains the Sound Manager API
- */
-
-/**
- * @addtogroup CAPI_MEDIA_SOUND_MANAGER_MODULE
- * @{
- */
-
-/**
- * @brief Enumerations of sound type
- */
-typedef enum
-{
- SOUND_TYPE_SYSTEM, /**< Sound type for system */
- SOUND_TYPE_NOTIFICATION, /**< Sound type for notifications */
- SOUND_TYPE_ALARM, /**< Sound type for alarm */
- SOUND_TYPE_RINGTONE, /**< Sound type for ringtones */
- SOUND_TYPE_MEDIA, /**< Sound type for media */
- SOUND_TYPE_CALL, /**< Sound type for call */
- SOUND_TYPE_VOIP, /**< Sound type for voip */
- SOUND_TYPE_SVOICE, /**< Sound type for svoice */
- SOUND_TYPE_FIXED, /**< Sound type for fixed volume */
- SOUND_TYPE_FIXED_AF, /**< Sound type for fixed volume for AF */
- SOUND_TYPE_FIXED_SHUTTER1, /**< Sound type for fixed volume for Shutter1 */
- SOUND_TYPE_FIXED_SHUTTER2, /**< Sound type for fixed volume for Shutter2 */
- SOUND_TYPE_FIXED_CAMCORDING,/**< Sound type for fixed volume for Camcording */
-} sound_type_e;
-
-/**
- * @brief Enumerations of volume key type
- */
-typedef enum
-{
- VOLUME_KEY_TYPE_NONE=-1, /**< Volume key type for current played sound */
- VOLUME_KEY_TYPE_SYSTEM=0, /**< Volume key type for system sound */
- VOLUME_KEY_TYPE_NOTIFICATION, /**< Volume key type for notifications sound*/
- VOLUME_KEY_TYPE_ALARM, /**< Volume key type for alarm sound */
- VOLUME_KEY_TYPE_RINGTONE, /**< Volume key type for ringtones sound */
- VOLUME_KEY_TYPE_MEDIA, /**< Volume key type for media sound */
- VOLUME_KEY_TYPE_CALL, /**< Volume key type for call sound */
- VOLUME_KEY_TYPE_VOIP, /**< Volume key type for voip sound */
- VOLUME_KEY_TYPE_SVOICE, /**< Volume key type for svoice sound */
-} volume_key_type_e;
-
-/**
- * @brief error codes for sound manager
- */
-typedef enum{
- SOUND_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- SOUND_MANAGER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- SOUND_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- SOUND_MANAGER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
- SOUND_MANAGER_ERROR_NO_PLAYING_SOUND = SOUND_MANAGER_ERROR_CLASS | 01, /**< No playing sound */
- SOUND_MANAGER_ERROR_NO_OPERATION = SOUND_MANAGER_ERROR_CLASS | 02, /**< No operation */
- SOUND_MANAGER_ERROR_INTERNAL = SOUND_MANAGER_ERROR_CLASS | 03, /**< Internal error*/
- SOUND_MANAGER_ERROR_POLICY = SOUND_MANAGER_ERROR_CLASS | 04, /**< Policy error*/
- SOUND_MANAGER_ERROR_POLICY_BLOCKED_BY_CALL = SOUND_MANAGER_ERROR_CLASS | 05, /**< Policy blocked by call error*/
- SOUND_MANAGER_ERROR_POLICY_BLOCKED_BY_ALARM = SOUND_MANAGER_ERROR_CLASS | 06, /**< Policy blocked by alarm error*/
- SOUND_MANAGER_ERROR_CAPTURE_ONLY = SOUND_MANAGER_ERROR_CLASS | 07, /**< Capture Only */
-} sound_manager_error_e;
-
-/**
- * @brief Enumerations of session type
- */
-typedef enum{
- SOUND_SESSION_TYPE_SHARE = 0, /**< Share type : shares it's session with other share type application. */
- SOUND_SESSION_TYPE_EXCLUSIVE, /**< Exclusive type : make previous session stop.*/
- SOUND_SESSION_TYPE_ALARM, /**< Alarm type */
- SOUND_SESSION_TYPE_EMERGENCY, /**< Emergency type */
- SOUND_SESSION_TYPE_NOTIFICATION, /**< Notification type */
-} sound_session_type_e;
-
-/**
- * @brief Enumerations of session watch type
- */
-typedef enum{
- SOUND_SESSION_WATCH_TYPE_CALL = 0, /**< Call type */
- SOUND_SESSION_WATCH_TYPE_VIDEO_CALL, /**< Video Call type */
- SOUND_SESSION_WATCH_TYPE_ALARM, /**< Alarm type */
- SOUND_SESSION_WATCH_TYPE_AV_RECORD, /**< Audio/Video Record type */
- SOUND_SESSION_WATCH_TYPE_NUM
-} sound_session_watch_type_e;
-
-/**
- * @brief Enumerations of session watch state
- */
-typedef enum{
- SOUND_SESSION_WATCH_STATE_STOP = 0, /**< Stop */
- SOUND_SESSION_WATCH_STATE_START, /**< Start */
- SOUND_SESSION_WATCH_STATE_NUM
-} sound_session_watch_state_e;
-
-/**
- * @brief Enumerations of session notification
- */
-typedef enum{
- SOUND_SESSION_NOTIFY_STOP = 0, /**< Stop : session of application has interrupted by policy. */
- SOUND_SESSION_NOTIFY_RESUME, /**< Resume : session interrupt of application has ended. */
-} sound_session_notify_e;
-
-/**
- * @brief Enumerations of audio input device type.
- */
-typedef enum{
- SOUND_DEVICE_IN_MIC = 0x01, /**< Device builtin mic. */
- SOUND_DEVICE_IN_WIRED_ACCESSORY = 0x02, /**< Wired input devices */
- SOUND_DEVICE_IN_BT_SCO = 0x04, /**< Bluetooth SCO device */
-} sound_device_in_e;
-
-/**
- * @brief Enumerations of audio output device type.
- */
-typedef enum{
- SOUND_DEVICE_OUT_SPEAKER = 0x01<<8, /**< Device builtin speaker */
- SOUND_DEVICE_OUT_RECEIVER = 0x02<<8, /**< Device builtin receiver */
- SOUND_DEVICE_OUT_WIRED_ACCESSORY = 0x04<<8, /**< Wired output devices such as headphone, headset, and so on. */
- SOUND_DEVICE_OUT_BT_SCO = 0x08<<8, /**< Bluetooth SCO device */
- SOUND_DEVICE_OUT_BT_A2DP = 0x10<<8, /**< Bluetooth A2DP device */
- SOUND_DEVICE_OUT_DOCK = 0x020<<8, /**< DOCK device */
- SOUND_DEVICE_OUT_HDMI = 0x040<<8, /**< HDMI device */
- SOUND_DEVICE_OUT_MIRRORING = 0x080<<8, /**< MIRRORING device */
- SOUND_DEVICE_OUT_WFD = SOUND_DEVICE_OUT_MIRRORING, /**< WFD device : Will be deprecated */
- SOUND_DEVICE_OUT_USB_AUDIO = 0x100<<8, /**< USB Audio device */
- SOUND_DEVICE_OUT_MULTIMEDIA_DOCK = 0x200<<8, /**< Multimedia DOCK device */
-} sound_device_out_e;
-
-/**
- * @brief Enumerations of route type.
- */
-typedef enum{
- SOUND_ROUTE_OUT_SPEAKER = SOUND_DEVICE_OUT_SPEAKER, /**< Routing audio output to builtin device such as internal speaker. */
- SOUND_ROUTE_OUT_RECEIVER = SOUND_DEVICE_OUT_RECEIVER, /**< Routing audio output to builtin device such as internal receiver. */
- SOUND_ROUTE_OUT_WIRED_ACCESSORY = SOUND_DEVICE_OUT_WIRED_ACCESSORY,/**< Routing audio output to wired accessory such as headphone, headset, and so on. */
- SOUND_ROUTE_OUT_BLUETOOTH = SOUND_DEVICE_OUT_BT_A2DP, /**< Routing audio output to bluetooth A2DP. */
- SOUND_ROUTE_OUT_DOCK = SOUND_DEVICE_OUT_DOCK, /**< Routing audio output to DOCK */
- SOUND_ROUTE_OUT_HDMI = SOUND_DEVICE_OUT_HDMI, /**< Routing audio output to HDMI */
- SOUND_ROUTE_OUT_MIRRORING = SOUND_DEVICE_OUT_MIRRORING, /**< Routing audio output to MIRRORING */
- SOUND_ROUTE_OUT_WFD = SOUND_ROUTE_OUT_MIRRORING, /**< Routing audio output to WFD : Will be deprecated */
- SOUND_ROUTE_OUT_USB_AUDIO = SOUND_DEVICE_OUT_USB_AUDIO, /**< Routing audio output to USB Audio */
- SOUND_ROUTE_OUT_MULTIMEDIA_DOCK = SOUND_DEVICE_OUT_MULTIMEDIA_DOCK, /**< Routing audio output to Multimedia DOCK */
- SOUND_ROUTE_IN_MIC = SOUND_DEVICE_IN_MIC, /**< Routing audio input to device builtin mic. */
- SOUND_ROUTE_IN_WIRED_ACCESSORY = SOUND_DEVICE_IN_WIRED_ACCESSORY, /**< Routing audio input to wired accessory. */
- SOUND_ROUTE_IN_MIC_OUT_RECEIVER = SOUND_DEVICE_IN_MIC |SOUND_DEVICE_OUT_RECEIVER, /**< Routing audio input to device builtin mic and routing audio output to builtin receiver*/
- SOUND_ROUTE_IN_MIC_OUT_SPEAKER = SOUND_DEVICE_IN_MIC |SOUND_DEVICE_OUT_SPEAKER , /**< Routing audio input to device builtin mic and routing audio output to builtin speaker */
- SOUND_ROUTE_IN_MIC_OUT_HEADPHONE = SOUND_DEVICE_IN_MIC | SOUND_DEVICE_OUT_WIRED_ACCESSORY,/**< Routing audio input to device builtin mic and routing audio output to headphone */
- SOUND_ROUTE_INOUT_HEADSET = SOUND_DEVICE_IN_WIRED_ACCESSORY | SOUND_DEVICE_OUT_WIRED_ACCESSORY, /**< Routing audio input and output to headset*/
- SOUND_ROUTE_INOUT_BLUETOOTH = SOUND_DEVICE_IN_BT_SCO |SOUND_DEVICE_OUT_BT_SCO /**< Routing audio input and output to bluetooth SCO */
-} sound_route_e;
-
-/**
- * @brief Enumerations of call session type
- */
-typedef enum{
- SOUND_CALL_SESSION_TYPE_CALL = 0, /**< call type */
- SOUND_CALL_SESSION_TYPE_VOIP = 1, /**< voip type */
- SOUND_SESSION_TYPE_CALL = 0,
- SOUND_SESSION_TYPE_VOIP = 1,
- SOUND_SESSION_TYPE_VIDEOCALL = 2,
-} sound_call_session_type_e;
-
-/**
- * @brief Enumerations of communication session type
- */
-typedef enum{
- SOUND_CALL_SESSION_MODE_VOICE = 0, /**< normal talking mode */
- SOUND_CALL_SESSION_MODE_RINGTONE, /**< ringtone mode */
- SOUND_CALL_SESSION_MODE_MEDIA, /**< notification sound in call*/
- SOUND_CALL_SESSION_MODE_VOICE_ANSWER_PLAY, /**< play audio over voice call(for Answer memo) */
- SOUND_CALL_SESSION_MODE_VOICE_ANSWER_REC, /**< record audio over voice call(for Answer memo) */
-} sound_call_session_mode_e;
-
-/**
- * @brief Enumerations of multiple session type
- */
-typedef enum{
- SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION = 0, /**< voice recognition */
- SOUND_MULTI_SESSION_TYPE_RECORD_AUDIO, /**< record audio */
- SOUND_MULTI_SESSION_TYPE_RECORD_VIDEO, /**< record video */
-} sound_multi_session_type_e;
-
-/**
- * @brief Enumerations of multiple session option
- */
-typedef enum{
- SOUND_MULTI_SESSION_OPT_RESUME_OTHERS = 0, /**< resume others paused by it */
- SOUND_MULTI_SESSION_OPT_MIX_WITH_OTHERS, /**< mix with other share type session (share) */
- SOUND_MULTI_SESSION_OPT_PAUSE_OTHERS, /**< pause other share type session (exclusive) */
- SOUND_MULTI_SESSION_OPT_RESET_OTHERS_RESUME_INFO /**< reset resumption information of others paused by it */
-} sound_multi_session_option_e;
-
-/**
- * @brief Enumerations of multiple session mode
- */
-typedef enum{
- SOUND_MULTI_SESSION_MODE_INIT = 5, /**< initial mode */
- SOUND_MULTI_SESSION_MODE_VR_NORMAL, /**< normal mode for voice recognition */
- SOUND_MULTI_SESSION_MODE_VR_DRIVE, /**< drive mode for voice recognition */
- SOUND_MULTI_SESSION_MODE_RECORD_STEREO, /**< stereo audio recording mode for AV recording */
- SOUND_MULTI_SESSION_MODE_RECORD_STEREO_FOR_INTERVIEW, /**< directional stereo audio recording mode for interview */
- SOUND_MULTI_SESSION_MODE_RECORD_STEREO_FOR_CONVERSATION, /**< directional stereo audio recording mode for conversation */
- SOUND_MULTI_SESSION_MODE_RECORD_MONO, /**< mono audio recording mode for voicerecording */
-} sound_multi_session_mode_e;
-
-/**
- * @brief Enumerations of sound interrupted type
- */
-typedef enum
-{
- SOUND_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed*/
- SOUND_INTERRUPTED_BY_MEDIA, /**< Interrupted by non-resumable media application*/
- SOUND_INTERRUPTED_BY_CALL, /**< Interrupted by incoming call*/
- SOUND_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphone*/
- SOUND_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by resource conflict*/
- SOUND_INTERRUPTED_BY_ALARM, /**< Interrupted by alarm*/
- SOUND_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by emergency*/
- SOUND_INTERRUPTED_BY_RESUMABLE_MEDIA, /**< Interrupted by resumable media application*/
- SOUND_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by notification*/
-} sound_interrupted_code_e;
-
-/**
- * @brief Sound call session handle type.
- */
-typedef struct sound_call_session_s *sound_call_session_h;
-
-/**
- * @brief Sound multiple session handle type.
- */
-typedef struct sound_multi_session_s *sound_multi_session_h;
-
-/**
- * @brief Called when the sound session notification has occured.
- * @param[in] notify The sound session notification
- * @param[in] user_data The user data passed from the callback registration function
- * @pre You should register this callback by sound_manager_set_session_notify_cb()
- * @see sound_manager_set_session_notify_cb()
- */
-typedef void (*sound_session_notify_cb) (sound_session_notify_e notify, void *user_data);
-
-/**
- * @brief Called when the playing sound was interrupted.
- * @param[in] code The interrupted code
- * @param[in] user_data The user data passed from the callback registration function
- * @pre You should register this callback by sound_manager_set_interrupted_cb()
- * @see sound_manager_set_interrupted_cb()
- */
-typedef void(* sound_interrupted_cb)(sound_interrupted_code_e code, void *user_data);
-
-/**
- * @brief Called when the interest session state was changed.
- * @param[in] type The type of the interest session
- * @param[in] state The state of the interest session
- * @param[in] user_data The user data passed from the callback registration function
- * @pre You should register this callback by sound_manager_set_watch_session_cb()
- * @see sound_manager_set_watch_session_cb()
- */
-typedef void(* sound_session_watch_cb)(sound_session_watch_type_e type, sound_session_watch_state_e state, void *user_data);
-
-/**
- * @brief Called when the system volume has changed.
- * @param[in] type The sound type of changed volume
- * @param[in] volume The new volume value
- * @param[in] user_data The user data passed from the callback registration function
- * @pre sound_manager_set_volume() will invoke this callback if you register it using sound_manager_set_volume_changed_cb()
- * @see sound_manager_set_volume_changed_cb()
- * @see sound_manager_unset_volume_changed_cb()
- */
-typedef void (*sound_manager_volume_changed_cb)(sound_type_e type, unsigned int volume, void *user_data);
-
-/**
- * @brief Called when the turn off all sounds state has changed.
- * @param[in] user_data The user data passed from the callback registration function
- * @param[in] muteall The new muteall value
- * @pre sound_manager_set_muteall() will invoke this callback if you register it using sound_manager_set_muteall_changed_cb()
- * @see sound_manager_set_muteall_changed_cb()
- * @see sound_manager_unset_muteall_changed_cb()
- */
-typedef void (*sound_manager_muteall_changed_cb)(bool muteall, void *user_data);
-
-/**
- * @brief Gets the maximum volume level supported for a particular sound type
- * @param[in] type The sound type
- * @param[out] max The maximum volume level
- * @return 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_set_volume()
- */
-int sound_manager_get_max_volume(sound_type_e type, int *max);
-
-/**
- * @brief Sets the volume level specified for a particular sound type
- * @param[in] type The sound type
- * @param[out] volume The volume level to be set
- * @return 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_max_volume()
- * @see sound_manager_get_volume()
- */
-int sound_manager_set_volume(sound_type_e type, int volume);
-
-/**
- * @brief Gets the volume level specified for a particular sound type
- * @param[in] type The sound type
- * @param[out] volume The current volume level
- * @return 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_max_volume()
- * @see sound_manager_set_volume()
- */
-int sound_manager_get_volume(sound_type_e type, int *volume);
-
-/**
- * @brief Gets the current playing sound type
- * @param[out] type The current sound type
- * @return 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_PLAYING_SOUND No playing sound
- * @see player_set_sound_type()
- * @see audio_out_create()
- * @see wav_player_start()
- */
-int sound_manager_get_current_sound_type(sound_type_e *type);
-
-/**
- * @brief Sets the volume balance value. The balance value controls Left/right channel volume.
- * @param[in] The balance value to be set. The balance range is [-1,1].
- * @return 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_balance()
- */
-int sound_manager_set_balance(float balance);
-
-/**
- * @brief Gets the volume balance value. The balance value controls Left/right channel volume.
- * @param[out] The current balance value. The balance range is [-1,1].
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see ound_manager_set_balance)
- */
-int sound_manager_get_balance(float *balance);
-
-/**
- * @brief Sets the muteall value. The muteall value controls all sounds turn on/off.
- * @param[in] The muteall value to be set. False means all sounds turn on , true means all sounds turn off
- * @return 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_set_muteall()
- */
-int sound_manager_set_muteall(bool onoff);
-
-/**
- * @brief Gets the muteall value. The muteall value controls all sounds turn on/off .
- * @param[out] The current muteall value.False means all sounds turn on , ture means all sounds turn off
- * @return 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_muteall)
- */
-int sound_manager_get_muteall(bool *onoff);
-
-/**
- * @brief Registers a callback function to be invoked when the volume level is changed.
- * @param[in] callback Callback function to indicate change in volume
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_manager_volume_changed_cb() will be invoked
- * @see sound_manager_unset_volume_changed_cb()
- * @see sound_manager_volume_changed_cb()
- */
-int sound_manager_set_volume_changed_cb(sound_manager_volume_changed_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the volume change callback
- * @see sound_manager_set_volume_changed_cb()
- */
-void sound_manager_unset_volume_changed_cb(void);
-
-/**
- * @brief Registers a callback function to be invoked when the all sounds turn on/off is changed.
- * @param[in] callback Callback function to indicate change in all sounds turn on/off
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_manager_muteall_changed_cb() will be invoked
- * @see sound_manager_unset_muteall_changed_cb()
- * @see sound_manager_muteall_changed_cb()
- */
-int sound_manager_set_muteall_changed_cb(sound_manager_muteall_changed_cb callback, void* user_data);
-
-/**
- * @brief Unregisters the state of all sounds turn on/off change callback
- * @see sound_manager_set_muteall_changed_cb()
- */
-void sound_manager_unset_muteall_changed_cb(void);
-
-/**
- * @brief Gets the A2DP activation information.
- * @remarks If @a connected is @c true, @a bt_name must be released with free() by you. If @a connected is @c false, @a bt_name is set to NULL.
- * @param[out] connected The Bluetooth A2DP connection status (@c true = connected, @c false = disconnected)
- * @param[out] bt_name The Bluetooth A2DP connected device name
- * @return 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_INVALID_OPERATION Invalid operation
- */
-int sound_manager_get_a2dp_status(bool *connected, char **bt_name);
-
-/**
- * @brief Sets the application's sound session type
- * @param[in] type The session type to set
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int sound_manager_set_session_type(sound_session_type_e type);
-
-/**
- * @brief Gets the application's sound session type
- * @param[in] type The session type
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int sound_manager_get_session_type(sound_session_type_e *type);
-
-/**
- * @brief Registers a callback function to be invoked when the sound session notification is occured.
- * @param[in] callback The session notify callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_session_notify_cb() will be invoked
- * @see sound_manager_unset_session_notify_cb()
- * @see sound_session_notify_cb()
- */
-int sound_manager_set_session_notify_cb(sound_session_notify_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function which is called when the session notification is occured
- * @see sound_manager_set_session_notify_cb()
- */
-void sound_manager_unset_session_notify_cb(void);
-
-/**
- * @brief Registers a callback function to be invoked when the playing sound was interrupted.
- * @param[in] callback The interrupted callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_interrupted_cb() will be invoked
- * @see sound_manager_unset_interrupted_cb()
- * @see sound_interrupted_cb()
- */
-int sound_manager_set_interrupted_cb(sound_interrupted_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function which is called when the playing sound was interrupted
- * @see sound_manager_set_interrupted_cb()
- */
-void sound_manager_unset_interrupted_cb(void);
-
-/**
- * @brief Registers a callback function to be invoked when the watched session was activated.
- * @param[in] type The session type to be watched
- * @param[in] callback The watch callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 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_INVALID_OPERATION Invalid operation
- * @post sound_session_watch_cb() will be invoked
- * @see sound_manager_unset_watch_cb()
- * @see sound_session_watch_cb()
- */
-int sound_manager_set_watch_cb(sound_session_watch_type_e type, sound_session_watch_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function which is called when the watched session was activated
- * @param[in] type The watched session type to be removed
- * @return 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_INVALID_OPERATION Invalid operation
- * @see sound_manager_set_watch_cb()
- */
-int sound_manager_unset_watch_cb(sound_session_watch_type_e type);
-
-/**
- * @brief Sets the volume key type
- * @param[in] type The volume key type to set
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int sound_manager_set_volume_key_type(volume_key_type_e type);
-
-/**
- * @brief Gets called iteratively to notify you of available route.
- * @param[in] route The available route
- * @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @pre sound_manager_foreach_available_route() will invoke this callback.
- * @see sound_manager_foreach_available_route()
- */
-typedef bool(* sound_available_route_cb)(sound_route_e route, void *user_data);
-
-/**
- * @brief Called when the available audio route is changed.
- * @param[in] route The audio route
- * @param[in] available The status of given route
- * @param[in] user_data The user data passed from the foreach function
- * @pre sound_manager_foreach_available_route() will invoke this callback.
- * @see sound_manager_foreach_available_route()
- */
-typedef void(* sound_available_route_changed_cb)(sound_route_e route, bool available, void *user_data);
-
-/**
- * @brief Called when the audio route is changed.
- * @param[in] route The audio route
- * @param[in] user_data The user data passed from the callback registration function
- * @pre You should register this callback by sound_manager_set_active_device_changed_cb()
- * @see sound_manager_set_active_device_changed_cb()
- */
-typedef void(* sound_active_device_changed_cb)(sound_device_in_e in, sound_device_out_e out, void *user_data);
-
-/**
- * @brief Retrieves all available audio routes by invoking a specific callback for each valid route.
- * @param[in] callback The session notify callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_available_route_cb() will be invoked
- * @see sound_available_route_cb()
- */
-int sound_manager_foreach_available_route (sound_available_route_cb callback, void *user_data);
-
-/**
- * @brief Changes the audio routes.
- * @param[in] route The route to set
- * @return 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_active_device()
- */
-int sound_manager_set_active_route (sound_route_e route);
-
-/**
- * @brief Changes the audio routes.
- * @param[in] void
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- */
-int sound_manager_set_active_route_auto (void);
-
-/**
- * @brief Changes the audio route.
- * @param[out] in The current sound input device
- * @param[out] in The current sound output device
- * @return 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_set_active_route()
- */
-int sound_manager_get_active_device (sound_device_in_e *in, sound_device_out_e *out);
-
-/**
- * @brief Check if given audio route is available or not.
- * @param[in] route The route to set
- * @return 0 on success, otherwise a negative error value.
- * @return @c true if the specified route is supported, \n else @c false
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-bool sound_manager_is_route_available (sound_route_e route);
-
-/**
- * @brief Registers a callback function to be invoked when the available status is changed.
- * @param[in] callback The available status changed callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_available_route_changed_cb() will be invoked
- * @see sound_manager_unset_available_route_changed_cb()
- * @see sound_available_route_changed_cb()
- */
-int sound_manager_set_available_route_changed_cb (sound_available_route_changed_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function.
- * @see sound_manager_set_available_route_changed_cb()
- */
-void sound_manager_unset_available_route_changed_cb (void);
-
-/**
- * @brief Registers a callback function to be invoked when the audio device is changed.
- * @param[in] callback The session notify callback function
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @post sound_active_device_changed_cb() will be invoked
- * @see sound_manager_unset_active_device_changed_cb()
- * @see sound_active_device_changed_cb()
- */
-int sound_manager_set_active_device_changed_cb (sound_active_device_changed_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function which is called when the route notification is occured.
- * @see sound_manager_set_active_device_changed_cb()
- */
-void sound_manager_unset_active_device_changed_cb (void);
-
-/**
- * @brief Creates a call session handle.
- * @remarks @a session must be released sound_manager_call_session_destroy() by you.
- * @param[out] session A new handle to call session
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_OUT_OF_MEMORY Out of memory
- * @see sound_manager_call_session_destroy()
- */
-int sound_manager_call_session_create(sound_call_session_type_e type, sound_call_session_h *session);
-
-/**
- * @brief Sets the call session mode.
- *
- * @param[in] session The handle to call session
- * @param[in] mode The call session mode
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_call_session_get_mode()
- */
-int sound_manager_call_session_set_mode(sound_call_session_h session, sound_call_session_mode_e mode);
-
-/**
- * @brief Gets the call session mode.
- *
- * @param[in] session The handle to call session
- * @param[out] mode The call session mode
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_call_session_set_mode()
- */
-int sound_manager_call_session_get_mode(sound_call_session_h session, sound_call_session_mode_e *mode);
-
-/**
- * @brief Destroys the call session handle.
- *
- * @param[in] session The handle to call session to be destroyed
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_call_session_create()
- */
-int sound_manager_call_session_destroy(sound_call_session_h session);
-
-/**
- * @brief Creates a multiple session handle.
- * @remarks @a session must be released sound_manager_multi_session_destroy() by you.
- * @param[out] session A new handle to multiple session
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_OUT_OF_MEMORY Out of memory
- * @see sound_manager_multi_session_destroy()
- */
-int sound_manager_multi_session_create(sound_multi_session_type_e type, sound_multi_session_h *session);
-
-/**
- * @brief Queries whether if the multiple session mode is available
- *
- * @param[in] session The handle to multiple session
- * @param[in] mode The multiple session mode
- * @param[out] available The result of this API (true or false)
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_multiple_session_set_mode()
- */
-int sound_manager_multi_session_mode_is_available(sound_multi_session_h session, sound_multi_session_mode_e mode, bool *available);
-
-/**
- * @brief Sets the multiple session mode.
- *
- * @param[in] session The handle to multiple session
- * @param[in] mode The multiple session mode
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_multi_session_get_mode()
- * @see sound_manager_multi_session_mode_is_available()
- */
-int sound_manager_multi_session_set_mode(sound_multi_session_h session, sound_multi_session_mode_e mode);
-
-/**
- * @brief Gets the multiple session mode.
- *
- * @param[in] session The handle to multiple session
- * @param[out] mode The multiple session mode
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_multiple_session_set_mode()
- */
-int sound_manager_multi_session_get_mode(sound_multi_session_h session, sound_multi_session_mode_e *mode);
-
-/**
- * @brief Sets the multiple session option.
- *
- * @param[in] session The handle to multiple session
- * @param[in] type The multiple session option type
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal
- * @retval #SOUND_MANAGER_ERROR_POLICY Policy
- * @retval #SOUND_MANAGER_ERROR_POLICY_BLOCKED_BY_CALL Policy blocked by call
- * @retval #SOUND_MANAGER_ERROR_POLICY_BLOCKED_BY_ALARM Policy blocked by alarm
- * @see sound_manager_multi_session_get_option()
- */
-int sound_manager_multi_session_set_option(sound_multi_session_h session, sound_multi_session_option_e type);
-
-/**
- * @brief Gets the multiple session option.
- *
- * @param[in] session The handle to multiple session
- * @param[out] option The multiple session option type
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_multiple_session_set_option()
- */
-int sound_manager_multi_session_get_option(sound_multi_session_h session, sound_multi_session_option_e *option);
-
-/**
- * @brief Destroys the multiple session handle.
- *
- * @param[in] session The handle to multiple session to be destroyed
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @see sound_manager_multi_session_create()
- */
-int sound_manager_multi_session_destroy(sound_multi_session_h session);
-
-/**
- * @brief set microphone mute during call
- *
- * @param[in] sound type. Supported sound types are SOUND_TYPE_CALL, SOUND_TYPE_VOIP
- * @param[in] TRUE to mute, FALSE to unmute
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int sound_manager_set_call_mute(sound_type_e type, int mute);
-
-/**
- * @brief get mute status of the microphone during call
- *
- * @param[in] sound type. Supported sound types are SOUND_TYPE_CALL, SOUND_TYPE_VOIP
- * @param[out] mute
- * @retval #SOUND_MANAGER_ERROR_NONE Successful
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int sound_manager_get_call_mute(sound_type_e type, int *mute);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_MEDIA_SOUND_MANAGER_H__ */
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-#define LOG_TAG "TIZEN_N_SOUND_MANAGER"
-
-#include <sound_manager.h>
-#include <sound_manager_private.h>
-
-#include <mm_sound.h>
-#include <mm_sound_private.h>
-#include <stdio.h>
-#include <limits.h>
-#include <string.h>
-#include <malloc.h>
-#include <unistd.h>
-#include <dlog.h>
-#include <mm_session.h>
-#include <mm_session_private.h>
-
-#define MAX_VOLUME_TYPE 7
-
-typedef struct {
- void *user_data;
- sound_manager_volume_changed_cb user_cb;
-}_changed_volume_info_s;
-
-typedef struct {
- void *user_data;
- sound_manager_muteall_changed_cb user_cb;
-}_changed_muteall_info_s;
-
-
-typedef struct {
- int is_registered;
- void *user_data;
- sound_session_notify_cb user_cb;
- void *interrupted_user_data;
- sound_interrupted_cb interrupted_cb;
-}_session_notify_info_s;
-
-typedef struct {
- void *user_data[SOUND_SESSION_WATCH_TYPE_NUM];
- sound_session_watch_cb user_cb[SOUND_SESSION_WATCH_TYPE_NUM];
-}_session_watch_info_s;
-
-typedef struct {
- void *user_data;
- sound_available_route_changed_cb user_cb;
-}_changed_available_route_info_s;
-
-typedef struct {
- void *user_data;
- sound_active_device_changed_cb user_cb;
-}_changed_active_device_info_s;
-
-static _changed_muteall_info_s g_muteall_changed_cb_table;
-static _session_notify_info_s g_session_notify_cb_table = {0, NULL, NULL, NULL, NULL};
-static _session_watch_info_s g_session_watch_cb_table;
-static sound_session_type_e g_cached_session = -1;
-
-#define SOUND_SESSION_TYPE_DEFAULT SOUND_SESSION_TYPE_SHARE
-#define SOUND_MULT_SESSION_TYPE_DEFAULT SOUND_SESSION_TYPE_SHARE
-
-static void __muteall_changed_cb(void *user_data)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- bool new_muteall = false;
- ret = sound_manager_get_muteall(&new_muteall);
- if (ret == SOUND_MANAGER_ERROR_NONE) {
- if(g_muteall_changed_cb_table.user_cb)
- (g_muteall_changed_cb_table.user_cb)(new_muteall, g_muteall_changed_cb_table.user_data);
- } else {
- LOGE("sound_manager_get_muteall() error code(0x%08x)", ret);
- }
-}
-
-static void __session_notify_cb(session_msg_t msg, session_event_t event, void *user_data){
- if(g_session_notify_cb_table.user_cb){
- g_session_notify_cb_table.user_cb(msg, g_session_notify_cb_table.user_data);
- }
- if( g_session_notify_cb_table.interrupted_cb ){
- sound_interrupted_code_e e = SOUND_INTERRUPTED_COMPLETED;
- if( msg == MM_SESSION_MSG_RESUME )
- e = SOUND_INTERRUPTED_COMPLETED;
- else{
- switch(event){
- case MM_SESSION_EVENT_MEDIA :
- e = SOUND_INTERRUPTED_BY_MEDIA;
- break;
- case MM_SESSION_EVENT_RESUMABLE_MEDIA :
- e = SOUND_INTERRUPTED_BY_RESUMABLE_MEDIA;
- break;
- case MM_SESSION_EVENT_CALL :
- e = SOUND_INTERRUPTED_BY_CALL;
- break;
- case MM_SESSION_EVENT_ALARM :
- e = SOUND_INTERRUPTED_BY_ALARM;
- break;
- case MM_SESSION_EVENT_EARJACK_UNPLUG:
- e = SOUND_INTERRUPTED_BY_EARJACK_UNPLUG;
- break;
- case MM_SESSION_EVENT_RESOURCE_CONFLICT:
- e = SOUND_INTERRUPTED_BY_RESOURCE_CONFLICT;
- break;
- case MM_SESSION_EVENT_EMERGENCY:
- e = SOUND_INTERRUPTED_BY_EMERGENCY;
- break;
- case MM_SESSION_EVENT_NOTIFICATION :
- e = SOUND_INTERRUPTED_BY_NOTIFICATION;
- break;
- default :
- e = SOUND_INTERRUPTED_BY_MEDIA;
- break;
- }
- }
- g_session_notify_cb_table.interrupted_cb(e, g_session_notify_cb_table.interrupted_user_data);
- }
-}
-
-static void __session_watch_cb(session_watch_event_t event, session_watch_state_t state, void *user_param){
- int index = 0;
-
- index = (int)event;
- if (index < 0) {
- LOGE("[%s] invalid event type(%d)", (int)event);
- return;
- }
-
- if( g_session_watch_cb_table.user_cb[index] ) {
- sound_session_watch_type_e watch_type;
- sound_session_watch_state_e watch_state;
- switch(event) {
- case MM_SESSION_WATCH_EVENT_CALL :
- watch_type = SOUND_SESSION_WATCH_TYPE_CALL;
- break;
- case MM_SESSION_WATCH_EVENT_VIDEO_CALL :
- watch_type = SOUND_SESSION_WATCH_TYPE_VIDEO_CALL;
- break;
- case MM_SESSION_WATCH_EVENT_ALARM :
- watch_type = SOUND_SESSION_WATCH_TYPE_ALARM;
- break;
- case MM_SESSION_WATCH_EVENT_MMCAMCORDER_EXCLUSIVE :
- watch_type = SOUND_SESSION_WATCH_TYPE_AV_RECORD;
- break;
- default :
- LOGE("[%s] invalid watch_event(%d)",__func__, event);
- return;
- }
- switch(state) {
- case MM_SESSION_WATCH_STATE_STOP :
- watch_state = SOUND_SESSION_WATCH_STATE_STOP;
- break;
- case MM_SESSION_WATCH_STATE_PLAYING :
- watch_state = SOUND_SESSION_WATCH_STATE_START;
- break;
- default :
- LOGE("[%s] invalid watch_state(%d)",__func__, state);
- return;
- }
- g_session_watch_cb_table.user_cb[index](watch_type, watch_state, g_session_watch_cb_table.user_data[index]);
- }
-}
-
-int sound_manager_get_max_volume(sound_type_e type, int *max)
-{
- int volume;
- if(max == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- if(type > MAX_VOLUME_TYPE || type < 0)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret = mm_sound_volume_get_step(type, &volume);
-
- if(ret == 0)
- *max = volume -1; // actual volume step can be max step - 1
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_volume(sound_type_e type, int volume)
-{
- if(type > MAX_VOLUME_TYPE || type < 0)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- if(volume < 0)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- int ret = mm_sound_volume_set_value(type, volume);
- LOGI("returns : type=%d, volume=%d, ret=0x%x", type, volume, ret);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_volume(sound_type_e type, int *volume)
-{
- unsigned int uvolume;
- if(type > MAX_VOLUME_TYPE || type < 0)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- if(volume == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret = mm_sound_volume_get_value(type, &uvolume);
-
- if(ret == 0)
- *volume = uvolume;
-
-#if 0 /* FIXME: To many logs for enabing this... */
- LOGI("returns : type=%d, volume=%d, ret=0x%x", type, *volume, ret);
-#endif
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_current_sound_type(sound_type_e *type)
-{
- if(type == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret;
- ret = mm_sound_volume_get_current_playing_type((volume_type_t *)type);
-
- LOGI("returns : type=%d, ret=0x%x", *type, ret);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_balance(float balance)
-{
- if(balance < -1.0 || balance > 1.0)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- int ret = mm_sound_volume_set_balance(balance);
-
- LOGI("returns : balance=%f, ret=0x%x", balance, ret);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_balance(float *balance)
-{
- float ubalance;
- if(balance == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- int ret = mm_sound_volume_get_balance(&ubalance);
-
- if (ret == 0)
- *balance = ubalance;
-
- LOGI("returns : balance=%f, ret=0x%x", *balance, ret);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_muteall(bool onoff)
-{
- int muteall;
- if(true == onoff)
- muteall = 1;
- else
- muteall = 0;
-
- int ret = mm_sound_set_muteall(muteall);
- LOGI("returns : onoff=%d, ret=0x%x", onoff, ret);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-
-int sound_manager_set_call_mute(sound_type_e type, int mute)
-{
- int ret;
-
- ret = mm_sound_set_call_mute(type, mute);
- LOGI("returns : type=%d, mute=%d, ret=0x%x", type, mute, ret);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_call_mute(sound_type_e type, int *mute)
-{
- int ret;
-
- ret = mm_sound_get_call_mute(type, mute);
- LOGI("returns : type=%d, mute=%d, ret=0x%x", type, *mute, ret);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_muteall(bool *onoff)
-{
- int umuteall;
- if(onoff == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- int ret = mm_sound_get_muteall(&umuteall);
-
- if (ret == 0){
- if(0 == umuteall)
- *onoff = false;
- else
- *onoff = true;
- }
- LOGI("returns : onoff=%d, ret=0x%x", *onoff, ret);
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_muteall_changed_cb(sound_manager_muteall_changed_cb callback, void* user_data)
-{
- if(callback == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- g_muteall_changed_cb_table.user_cb = callback;
- g_muteall_changed_cb_table.user_data = user_data;
- mm_sound_muteall_add_callback(__muteall_changed_cb);
- return 0;
-}
-
-void sound_manager_unset_muteall_changed_cb(void)
-{
- mm_sound_muteall_remove_callback(__muteall_changed_cb);
- g_muteall_changed_cb_table.user_cb = NULL;
- g_muteall_changed_cb_table.user_data = NULL;
-}
-
-int sound_manager_set_volume_changed_cb(sound_manager_volume_changed_cb callback, void* user_data)
-{
- int ret;
- ret = mm_sound_add_volume_changed_callback((mm_sound_volume_changed_cb)callback, user_data);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-void sound_manager_unset_volume_changed_cb(void)
-{
- mm_sound_remove_volume_changed_callback();
-}
-
-int sound_manager_get_a2dp_status(bool *connected , char** bt_name){
- int ret = mm_sound_route_get_a2dp_status(connected , bt_name);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_session_type(sound_session_type_e type){
- int ret = 0;
- int session = 0;
-
- LOGI(">> enter : type=%d", type);
-
- if(type < 0 || type > SOUND_SESSION_TYPE_NOTIFICATION)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- /* if call session is activated, can't set session */
- ret = mm_session_get_current_type(&session);
- if( ret == 0 && session >= MM_SESSION_TYPE_CALL ) {
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_OPERATION);
- }
-
- if(g_session_notify_cb_table.is_registered){
- ret = mm_session_finish();
- if (ret != MM_ERROR_NONE) {
- return __convert_sound_manager_error_code(__func__, ret);
- }
- g_session_notify_cb_table.is_registered = 0;
- }
-
- ret = mm_session_init_ex(type , __session_notify_cb, NULL);
- if(ret == 0){
- g_session_notify_cb_table.is_registered = 1;
- }
- LOGI("<< leave : type=%d, ret=0x%x", type, ret);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_session_type(sound_session_type_e *type){
- if( type == NULL )
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret = 0;
- int session;
- ret = mm_session_get_current_type(&session);
- if( ret !=0 )
- session = SOUND_SESSION_TYPE_DEFAULT;
- if( session > SOUND_SESSION_TYPE_NOTIFICATION ){ // call session or voip session or voice recognition
- if( g_cached_session != -1 )
- session = g_cached_session; // saved session
- else //will be never reach here. just prevent code
- session = SOUND_SESSION_TYPE_DEFAULT;
- }
-
- *type = session;
-
- LOGI("returns : type=%d, ret=0x%x", *type, ret);
-
- return 0;
-}
-
-int sound_manager_set_session_notify_cb(sound_session_notify_cb callback , void *user_data){
- int ret =0 ;
- if(callback == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
-
- if(g_session_notify_cb_table.is_registered ==0){
- ret = mm_session_init_ex(SOUND_SESSION_TYPE_DEFAULT /*default*/ , __session_notify_cb, NULL);
- if(ret != 0)
- return __convert_sound_manager_error_code(__func__, ret);
- g_session_notify_cb_table.is_registered = 1;
- }
-
- g_session_notify_cb_table.user_cb = callback;
- g_session_notify_cb_table.user_data = user_data;
- return SOUND_MANAGER_ERROR_NONE;
-}
-
-void sound_manager_unset_session_notify_cb(void){
- g_session_notify_cb_table.user_cb = NULL;
- g_session_notify_cb_table.user_data = NULL;
-}
-
-int sound_manager_set_interrupted_cb(sound_interrupted_cb callback, void *user_data){
- int ret =0 ;
- if(callback == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- if(g_session_notify_cb_table.is_registered ==0){
- ret = mm_session_init_ex(SOUND_SESSION_TYPE_DEFAULT /*default*/ , __session_notify_cb, NULL);
- if(ret != 0)
- return __convert_sound_manager_error_code(__func__, ret);
- g_session_notify_cb_table.is_registered = 1;
- }
-
- g_session_notify_cb_table.interrupted_cb= callback;
- g_session_notify_cb_table.interrupted_user_data = user_data;
- return SOUND_MANAGER_ERROR_NONE;
-}
-
-void sound_manager_unset_interrupted_cb(void){
- g_session_notify_cb_table.interrupted_cb= NULL;
- g_session_notify_cb_table.interrupted_user_data = NULL;
-}
-
-int sound_manager_set_watch_cb(sound_session_watch_type_e type, sound_session_watch_cb callback, void *user_data) {
- int ret = 0 ;
- int i = 0;
-
- if(callback == NULL) {
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- }
-
- if((int)type < 0 || (int)type >= SOUND_SESSION_WATCH_TYPE_NUM) {
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- }
-
- if (g_session_watch_cb_table.user_cb[(int)type]) {
- /* just refresh callback pointer */
- g_session_watch_cb_table.user_cb[(int)type] = callback;
- g_session_watch_cb_table.user_data[(int)type] = user_data;
- LOGI("[%s] refresh watch callback(0x%x), user_data(0x%x)",__func__, callback, user_data);
- return SOUND_MANAGER_ERROR_NONE;
- }
-
- for (i = SOUND_SESSION_WATCH_STATE_STOP; i < SOUND_SESSION_WATCH_STATE_NUM; i++) {
- ret = mm_session_add_watch_callback(type, i, __session_watch_cb, NULL);
- if(ret != 0) {
- return __convert_sound_manager_error_code(__func__, ret);
- }
- }
-
- g_session_watch_cb_table.user_cb[(int)type] = callback;
- g_session_watch_cb_table.user_data[(int)type] = user_data;
- LOGI("[%s] register watch callback(0x%x), user_data(0x%x)",__func__, callback, user_data);
-
- return SOUND_MANAGER_ERROR_NONE;
-}
-
-int sound_manager_unset_watch_cb(sound_session_watch_type_e type) {
- int ret = 0;
- int i = 0;
-
- if((int)type < 0 || (int)type >= SOUND_SESSION_WATCH_TYPE_NUM) {
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- }
-
- if (!g_session_watch_cb_table.user_cb[(int)type]) {
- LOGE("[%s] could not find the registered watch callback of the type(%d)",__func__, type);
- return SOUND_MANAGER_ERROR_INVALID_OPERATION;
- }
-
- for (i = SOUND_SESSION_WATCH_STATE_STOP; i < SOUND_SESSION_WATCH_STATE_NUM; i++) {
- ret = mm_session_remove_watch_callback(type, i);
- if(ret != 0) {
- return __convert_sound_manager_error_code(__func__, ret);
- }
- }
-
- LOGI("[%s] remove watch callback(0x%x), user_data(0x%x)",__func__, g_session_watch_cb_table.user_cb[(int)type], g_session_watch_cb_table.user_data[(int)type]);
- g_session_watch_cb_table.user_cb[(int)type] = NULL;
- g_session_watch_cb_table.user_data[(int)type] = NULL;
-
- return SOUND_MANAGER_ERROR_NONE;
-}
-
-int sound_manager_set_volume_key_type(volume_key_type_e type){
- if(type < VOLUME_KEY_TYPE_NONE || type > VOLUME_KEY_TYPE_SVOICE)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret;
- if(type == VOLUME_KEY_TYPE_NONE)
- ret = mm_sound_volume_primary_type_clear();
- else
- ret = mm_sound_volume_primary_type_set(type);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_foreach_available_route (sound_available_route_cb callback, void *user_data)
-{
- int ret;
- ret = mm_sound_foreach_available_route_cb((mm_sound_available_route_cb)callback, user_data);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_active_route (sound_route_e route)
-{
- int ret;
- ret = mm_sound_set_active_route(route);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_set_active_route_auto (void)
-{
- int ret;
- ret = mm_sound_set_active_route_auto();
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_active_device (sound_device_in_e *in, sound_device_out_e *out)
-{
- int ret;
- ret = mm_sound_get_active_device((mm_sound_device_in *)in, (mm_sound_device_out *)out);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-bool sound_manager_is_route_available (sound_route_e route)
-{
- bool is_available;
- mm_sound_is_route_available(route, &is_available);
-
- return is_available;
-}
-
-int sound_manager_set_available_route_changed_cb (sound_available_route_changed_cb callback, void *user_data)
-{
- int ret;
- ret = mm_sound_add_available_route_changed_callback((mm_sound_available_route_changed_cb)callback, user_data);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-void sound_manager_unset_available_route_changed_cb (void)
-{
- mm_sound_remove_available_route_changed_callback();
-}
-
-int sound_manager_set_active_device_changed_cb (sound_active_device_changed_cb callback, void *user_data)
-{
- int ret;
- ret = mm_sound_add_active_device_changed_callback("capi-client", (mm_sound_active_device_changed_cb)callback, user_data);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-void sound_manager_unset_active_device_changed_cb (void)
-{
- mm_sound_remove_active_device_changed_callback("capi-client");
-}
-
-int sound_manager_call_session_create(sound_call_session_type_e type, sound_call_session_h *session)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
- sound_call_session_h handle = NULL;
-
- LOGI(">> enter : type=%d, session=%p", type, session);
-
- /* Check input parameters */
- if(type < SOUND_SESSION_TYPE_CALL || type > SOUND_SESSION_TYPE_VIDEOCALL || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- /* Allocate handle */
- handle = malloc(sizeof(struct sound_call_session_s));
- if(!handle) {
- ret = SOUND_MANAGER_ERROR_OUT_OF_MEMORY;
- goto ERROR;
- }
- memset(handle, 0, sizeof(struct sound_call_session_s));
-
- /* Finish previous session if exists */
- if(g_session_notify_cb_table.is_registered){
- sound_manager_get_session_type((sound_session_type_e*)&handle->previous_session);
- g_cached_session = handle->previous_session;
-
- ret = mm_session_finish();
- if (ret != MM_ERROR_NONE) {
- goto ERROR;
- }
- g_session_notify_cb_table.is_registered = 0;
-
- }else{
- g_cached_session = SOUND_SESSION_TYPE_DEFAULT;
- handle->previous_session = SOUND_SESSION_TYPE_DEFAULT;
- }
-
- /* Initialize session */
- switch(type) {
- case SOUND_SESSION_TYPE_CALL:
- ret = mm_session_init_ex(MM_SESSION_TYPE_CALL, __session_notify_cb, NULL);
- break;
- case SOUND_SESSION_TYPE_VOIP:
- ret = mm_session_init_ex(MM_SESSION_TYPE_VOIP,__session_notify_cb, NULL);
- break;
- case SOUND_SESSION_TYPE_VIDEOCALL:
- ret = mm_session_init_ex(MM_SESSION_TYPE_VIDEOCALL,__session_notify_cb, NULL);
- break;
- }
- if(ret != MM_ERROR_NONE)
- goto ERROR;
-
- g_session_notify_cb_table.is_registered = 1;
- *session = handle;
-
- LOGI("<< leave : type=%d, session=%p, ret=0x%x", type, session, ret);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- if(handle)
- free(handle);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_call_session_set_mode(sound_call_session_h session, sound_call_session_mode_e mode)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- LOGI(">> enter : session=%p, mode=%d", session, mode);
-
- if(mode < SOUND_CALL_SESSION_MODE_VOICE || mode > SOUND_CALL_SESSION_MODE_VOICE_ANSWER_REC || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- ret = mm_session_set_subsession ((mm_subsession_t)mode, MM_SUBSESSION_OPTION_NONE);
-
- if(ret != MM_ERROR_NONE)
- goto ERROR;
-
- LOGI("<< leave : session=%p, mode=%d, ret=0x%x", session, mode, ret);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_call_session_get_mode(sound_call_session_h session, sound_call_session_mode_e *mode)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- if(mode == NULL || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- ret = mm_session_get_subsession ((mm_subsession_t *)mode);
-
- if(ret != MM_ERROR_NONE)
- goto ERROR;
-
- LOGI("returns : session=%p, mode=%d, ret=0x%x", session, *mode, ret);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_call_session_destroy(sound_call_session_h session)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- LOGI(">> enter : session=%p", session);
-
- if(session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- if(g_session_notify_cb_table.is_registered){
- ret = mm_session_finish();
- if(ret != MM_ERROR_NONE)
- goto ERROR;
- g_session_notify_cb_table.is_registered = 0;
- }
-
- /* Restore previous session */
- ret = mm_session_init_ex(session->previous_session , __session_notify_cb, NULL);
- if(ret == 0){
- g_session_notify_cb_table.is_registered = 1;
- }
-
- if(session) {
- free(session);
- session = NULL;
- }
-
- LOGI("<< leave : session=%p, ret=0x%x", session, ret);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_multi_session_create(sound_multi_session_type_e type, sound_multi_session_h *session)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
- sound_multi_session_h handle = NULL;
-
- LOGI(">> enter : type=%d, session=%p", type, session);
-
- /* Check input parameters */
- if(type < SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION || type > SOUND_MULTI_SESSION_TYPE_RECORD_VIDEO || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- /* Allocate handle */
- handle = malloc(sizeof(struct sound_multi_session_s));
- if(!handle) {
- ret = SOUND_MANAGER_ERROR_OUT_OF_MEMORY;
- goto ERROR;
- }
- memset(handle, 0, sizeof(struct sound_multi_session_s));
-
- /* Finish previous session if exists */
- if(g_session_notify_cb_table.is_registered){
- sound_manager_get_session_type((sound_session_type_e*)&handle->previous_session);
- g_cached_session = handle->previous_session;
-
- ret = mm_session_finish();
- if (ret != MM_ERROR_NONE) {
- goto ERROR;
- }
- g_session_notify_cb_table.is_registered = 0;
-
- }else{
- g_cached_session = SOUND_MULT_SESSION_TYPE_DEFAULT;
- handle->previous_session = SOUND_MULT_SESSION_TYPE_DEFAULT;
- }
-
- /* Initialize session */
- switch(type) {
- case SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION:
- ret = mm_session_init_ex(MM_SESSION_TYPE_VOICE_RECOGNITION, __session_notify_cb, NULL);
- break;
- case SOUND_MULTI_SESSION_TYPE_RECORD_AUDIO:
- ret = mm_session_init_ex(MM_SESSION_TYPE_RECORD_AUDIO, __session_notify_cb, NULL);
- break;
- case SOUND_MULTI_SESSION_TYPE_RECORD_VIDEO:
- ret = mm_session_init_ex(MM_SESSION_TYPE_RECORD_VIDEO, __session_notify_cb, NULL);
- break;
- }
- if(ret != MM_ERROR_NONE)
- goto ERROR;
-
- g_session_notify_cb_table.is_registered = 1;
-
- handle->type = type;
- *session = handle;
-
- LOGI("<< leave : type=%d, session=%p", type, session);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- if(handle) {
- free(handle);
- }
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_multi_session_mode_is_available(sound_multi_session_h session, sound_multi_session_mode_e mode, bool *available)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- if(available == NULL || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- switch(mode) {
- case SOUND_MULTI_SESSION_MODE_INIT:
- *available = true;
- break;
- case SOUND_MULTI_SESSION_MODE_VR_NORMAL:
- case SOUND_MULTI_SESSION_MODE_VR_DRIVE:
- if (session->type == SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION) {
- *available = true;
- } else {
- *available = false;
- }
- break;
- case SOUND_MULTI_SESSION_MODE_RECORD_STEREO:
- if (session->type == SOUND_MULTI_SESSION_TYPE_RECORD_AUDIO ||
- session->type == SOUND_MULTI_SESSION_TYPE_RECORD_VIDEO) {
- *available = true;
- } else {
- *available = false;
- }
- break;
- case SOUND_MULTI_SESSION_MODE_RECORD_STEREO_FOR_INTERVIEW:
- case SOUND_MULTI_SESSION_MODE_RECORD_STEREO_FOR_CONVERSATION:
- if (session->type == SOUND_MULTI_SESSION_TYPE_RECORD_AUDIO) {
- *available = true;
- } else {
- *available = false;
- }
- break;
- default:
- break;
- }
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_multi_session_set_mode(sound_multi_session_h session, sound_multi_session_mode_e mode)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- LOGI(">> enter : session=%p, mode=%d", session, mode);
-
- if(session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- switch(mode) {
- case SOUND_MULTI_SESSION_MODE_INIT:
- ret = mm_session_set_subsession((mm_subsession_t)mode, (mm_subsession_option_t)session->type_option);
- if(ret != MM_ERROR_NONE) {
- goto ERROR;
- }
- break;
- case SOUND_MULTI_SESSION_MODE_VR_NORMAL:
- case SOUND_MULTI_SESSION_MODE_VR_DRIVE:
- if (session->type == SOUND_MULTI_SESSION_TYPE_VOICE_RECOGNITION) {
- ret = mm_session_set_subsession((mm_subsession_t)mode, (mm_subsession_option_t)session->type_option);
- if(ret != MM_ERROR_NONE) {
- goto ERROR;
- }
- } else {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
- break;
- case SOUND_MULTI_SESSION_MODE_RECORD_MONO:
- case SOUND_MULTI_SESSION_MODE_RECORD_STEREO:
- if (session->type == SOUND_MULTI_SESSION_TYPE_RECORD_AUDIO ||
- session->type == SOUND_MULTI_SESSION_TYPE_RECORD_VIDEO) {
- ret = mm_session_set_subsession((mm_subsession_t)mode, (mm_subsession_option_t)session->type_option);
- if(ret != MM_ERROR_NONE) {
- goto ERROR;
- }
- } else {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
- break;
- case SOUND_MULTI_SESSION_MODE_RECORD_STEREO_FOR_INTERVIEW:
- case SOUND_MULTI_SESSION_MODE_RECORD_STEREO_FOR_CONVERSATION:
- if (session->type == SOUND_MULTI_SESSION_TYPE_RECORD_AUDIO) {
- ret = mm_session_set_subsession((mm_subsession_t)mode, (mm_subsession_option_t)session->type_option);
- if(ret != MM_ERROR_NONE) {
- goto ERROR;
- }
- } else {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
- break;
- default:
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- LOGI("<< leave : session=%p, mode=%d", session, mode);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_multi_session_get_mode(sound_multi_session_h session, sound_multi_session_mode_e *mode)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- if(mode == NULL || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- ret = mm_session_get_subsession((mm_subsession_t *)mode);
-
- if(ret != MM_ERROR_NONE) {
- goto ERROR;
- }
- LOGI("return : session=%p, mode=%d", session, *mode);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_multi_session_set_option(sound_multi_session_h session, sound_multi_session_option_e type)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- LOGI("return : session=%p, type=%d", session, type);
-
- if(type < SOUND_MULTI_SESSION_OPT_RESUME_OTHERS || type > SOUND_MULTI_SESSION_OPT_RESET_OTHERS_RESUME_INFO || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
- if (type == SOUND_MULTI_SESSION_OPT_RESET_OTHERS_RESUME_INFO) {
- ret = mm_session_reset_resumption_info();
- } else {
- ret = mm_session_set_subevent((mm_session_sub_t)type);
- }
- if(ret != MM_ERROR_NONE) {
- goto ERROR;
- }
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_multi_session_get_option(sound_multi_session_h session, sound_multi_session_option_e *option)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- if(option == NULL || session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- ret = mm_session_get_subevent((mm_session_sub_t *)option);
-
- if(ret != MM_ERROR_NONE) {
- goto ERROR;
- }
-
- LOGI("return : session=%p, type=%d", session, *option);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_multi_session_destroy(sound_multi_session_h session)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- LOGI(">> enter : session=%p", session);
-
- if(session == NULL) {
- ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
-
- if(g_session_notify_cb_table.is_registered){
- ret = mm_session_finish();
- if(ret != MM_ERROR_NONE) {
- goto ERROR;
- }
- g_session_notify_cb_table.is_registered = 0;
- }
-
- /* Restore previous session */
- if (session->previous_session) {
- ret = mm_session_init_ex(session->previous_session , __session_notify_cb, NULL);
- if(ret == 0){
- g_session_notify_cb_table.is_registered = 1;
- }
- }
-
- if(session) {
- free(session);
- session = NULL;
- }
-
- LOGI("<< leave : session=%p", session);
-
- return SOUND_MANAGER_ERROR_NONE;
-
-ERROR:
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-__attribute__ ((destructor))
-void __sound_manager_finalize(void)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
-
- if(g_session_notify_cb_table.is_registered){
- LOGI("<ENTER>");
- ret = mm_session_finish();
- if (ret != MM_ERROR_NONE) {
- LOGE("[%s] failed to mm_session_finish(), ret(0x%x)", __func__, ret);
- }
- g_session_notify_cb_table.is_registered = 0;
- LOGI("<LEAVE>");
- }
-}
-
-__attribute__ ((constructor))
-void __sound_manager_initialize(void)
-{
-
-}
+++ /dev/null
-SET(fw_test "${fw_name}-test")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED mm-sound glib-2.0 gthread-2.0 capi-media-player)
-FOREACH(flag ${${fw_test}_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
- MESSAGE(${flag})
-ENDFOREACH()
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
-
-#ADD_EXECUTABLE("system-sensor" system-sensor.c)
-#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS})
-
-aux_source_directory(. sources)
-FOREACH(src ${sources})
- GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
- MESSAGE("${src_name}")
- ADD_EXECUTABLE(${src_name} ${src})
- TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
-ENDFOREACH()
+++ /dev/null
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-
-#include <stdio.h>
-#include <sound_manager.h>
-#include <glib.h>
-#include <mm_sound.h>
-#include <unistd.h>
-#include <string.h>
-#include <player.h>
-#include <stdlib.h>
-
-static GMainLoop *g_mainloop = NULL;
-static GThread *event_thread;
-#define MAX_VOLUME_TYPE 5
-
-gpointer GmainThread(gpointer data){
- g_mainloop = g_main_loop_new (NULL, 0);
- g_main_loop_run (g_mainloop);
-
- return NULL;
-}
-
-void _sound_manager_volume_changed_cb(sound_type_e type, unsigned int volume, void* user_data)
-{
- printf("changed!! type=%d, volume = %d\n", type, volume);
-}
-
-int set_volume_test()
-{
- printf("set volume test\n");
- int i;
- sound_manager_set_volume_changed_cb(_sound_manager_volume_changed_cb ,NULL);
- for( i = SOUND_TYPE_SYSTEM ; i <=MAX_VOLUME_TYPE; i++){
- int max_value;
- int j;
- sound_manager_get_max_volume(i, &max_value);
- printf(" sound type = %d , max volume = %d\n", i, max_value);
- for( j = 0; j <= max_value+1 ; j++){
- int ret;
- int getvalue;
- ret = sound_manager_set_volume(i, j);
- if( j <= max_value && ret == 0 ){
- sound_manager_get_volume(i, &getvalue);
- if( j == getvalue )
- printf("PASS\n");
- else
- printf("FAIL!set=%d, get=%d\n", j, getvalue);
- } else if( j > max_value && ret == 0 )
- printf("FAIL! max_value over!!\n");
-
- }
- }
- //sound_manager_unset_volume_changed_cb();
- printf("end set volume test!!!\n");
- sleep(10);
- return 0;
-}
-
-void _sound_manager_route_policy_changed_cb(sound_route_policy_e route , void* user_data)
-{
- printf("new route policy %d\n", route);
-}
-
-int set_policy_test()
-{
- printf("-----------set policy test--------------\n");
- int ret;
- //int i;
- //sound_route_policy_e value;
- sound_manager_set_route_policy_changed_cb(_sound_manager_route_policy_changed_cb,NULL);
- /*
- for( i = SOUND_ROUTE_DEFAULT ; i <= SOUND_ROUTE_HANDSET_ONLY ; i++){
- ret = sound_manager_set_route_policy(i);
- ret = sound_manager_get_route_policy(&value);
- if( i == value )
- printf("PASS\n");
- else
- printf("FAIL\n");
- }
- */
- ret = sound_manager_set_route_policy(SOUND_ROUTE_DEFAULT);
- ret = sound_manager_set_route_policy(SOUND_ROUTE_DEFAULT);
- ret = sound_manager_set_route_policy(SOUND_ROUTE_DEFAULT);
- ret = sound_manager_set_route_policy(SOUND_ROUTE_DEFAULT);
-
-
- return 0;
-}
-
-
-static void mm_volume_changed_cb(void *user_data)
-{
- int v = (int)user_data;
- unsigned int value = 0;
- int ret = mm_sound_volume_get_value(v, &value);
- printf("mm_volume_changed_cb type = %d ,volume = %d , ret = %x\n", v, value, ret );
-}
-
-
-int mm_bug_test()
-{
- int ret = 0;
- mm_sound_volume_add_callback(0 , mm_volume_changed_cb , (void*)0);
- mm_sound_volume_add_callback(1 , mm_volume_changed_cb ,(void*) 1);
- mm_sound_volume_add_callback(2 , mm_volume_changed_cb , (void*)2);
- mm_sound_volume_add_callback(5 , mm_volume_changed_cb , (void*)5);
-
- int i;
-
- for( i = 0 ; i < 10 ; i++)
- {
- ret = mm_sound_volume_set_value(0, i);
- printf("type = 0 , volume = %d set , ret = %x\n", i, ret);
- ret = mm_sound_volume_set_value(1, i);
- printf("type = 1 , volume = %d set , ret = %x\n", i, ret);
- ret = mm_sound_volume_set_value(2, i);
- printf("type = 2 , volume = %d set , ret = %x\n", i, ret);
- ret = mm_sound_volume_set_value(5, i);
- printf("type = 5 , volume = %d set , ret = %x\n", i, ret);
- sleep(1);
- }
-
- //mm_sound_volume_remove_callback(0);
- //mm_sound_volume_remove_callback(1);
- //mm_sound_volume_remove_callback(2);
- //mm_sound_volume_remove_callback(5);
-
-
- ret = mm_sound_volume_set_value(5, 4);
-
- mm_sound_route_set_system_policy(SOUND_ROUTE_DEFAULT);
- mm_sound_route_set_system_policy(SOUND_ROUTE_DEFAULT);
- mm_sound_route_set_system_policy(SOUND_ROUTE_DEFAULT);
- return 0;
-}
-
-void mm_test(){
-
- char path[255];
- int id;
- int i;
- getcwd(path, 255);
- strcat(path, "/test2.wav");
- for( i =0 ; i < 10 ; i++){
- mm_sound_play_sound(path, SOUND_TYPE_MEDIA, NULL ,NULL, &id);
- mm_sound_stop_sound(id);
- }
-}
-
-void session_notify_cb(sound_session_notify_e notify, void *user_data)
-{
- printf("notify %d\n", notify);
-
-
-}
-
-
-void session_test(){
- printf("session_test\n");
- int ret = 0;
- player_h player;
-
- ret = sound_manager_set_session_type(SOUND_SESSION_TYPE_EXCLUSIVE);
- sound_manager_set_session_notify_cb(session_notify_cb,NULL);
-
-
-
- ret = player_create(&player);
- printf("player_create ret =%x\n", ret);
- ret = player_set_uri(player, "title_theme.mp3");
- printf("player_set_uri ret =%x\n", ret);
- ret =player_prepare(player);
- printf("player_prepare ret =%x\n", ret);
- ret = player_start(player);
- printf("player_start ret =%x\n", ret);
-
- while(1){
- player_state_e state;
- player_get_state(player, &state);
- printf("state %d\n", state);
- //if( state == 4)
- //player_start(player);
- sleep(1);
- //wav_player_start("test.wav", SOUND_TYPE_MEDIA,NULL, NULL,NULL);
- }
-
-
-}
-
-
-void a2dp_test(){
- bool isconnected;
- char * name;
- sound_manager_get_a2dp_status(&isconnected, &name);
- if( isconnected ){
- printf("name = %s\n", name);
- free(name);
- }else{
- printf("disconnected\n");
- }
- sound_device_e device;
- sound_manager_get_current_sound_device(&device);
- printf("device =%d\n", device);
-
-}
-
-int main()
-{
- if( !g_thread_supported() )
- {
- g_thread_init(NULL);
- }
-
- GError *gerr = NULL;
- event_thread = g_thread_create(GmainThread, NULL, 1, &gerr);
-
-
-
- //set_volume_test();
- //set_policy_test();
- //mm_bug_test();
- //wav_play_test();
- //tone_play_test();
- //wav_play_test();
- session_test();
- //a2dp_test();
- return 0;
-}