#ifndef __TIZEN_MEDIA_SOUND_MANAGER_H__
#define __TIZEN_MEDIA_SOUND_MANAGER_H__
-#ifndef DEPRECATED
-#define DEPRECATED __attribute__((deprecated))
-#endif
-
#include <tizen.h>
#ifdef __cplusplus
SOUND_TYPE_VOICE, /**< Sound type for voice */
} 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 DEPRECATED; // will be deprecated
-
/**
* @}
*/
SOUND_SESSION_TYPE_NOTIFICATION, /**< Notification type */
SOUND_SESSION_TYPE_EMERGENCY, /**< Emergency type */
SOUND_SESSION_TYPE_VOIP, /**< VOIP type */
- SOUND_SESSION_TYPE_SHARE = SOUND_SESSION_TYPE_MEDIA, /**< will be deprecated */
- SOUND_SESSION_TYPE_EXCLUSIVE = SOUND_SESSION_TYPE_MEDIA, /**< will be deprecated */
+ SOUND_SESSION_TYPE_CALL, /**< @internal Call type */
} sound_session_type_e;
/**
SOUND_SESSION_VOIP_MODE_VOICE_WITH_BLUETOOTH, /**< voip mode for during call with bluetooth */
} sound_session_voip_mode_e;
+/**
+ * @internal
+ * @brief Enumeration for call session mode.
+ * @since_tizen 2.3
+ */
+typedef enum
+{
+ SOUND_SESSION_CALL_MODE_RINGTONE = 0, /**< call mode for ringtone */
+ SOUND_SESSION_CALL_MODE_VOICE_WITH_BUILTIN_RECEIVER, /**< call mode for during call with built-in receiver */
+ SOUND_SESSION_CALL_MODE_VOICE_WITH_BUILTIN_SPEAKER, /**< call mode for during call with built-in speaker */
+ SOUND_SESSION_CALL_MODE_VOICE_WITH_AUDIO_JACK, /**< call mode for during call with audio jack */
+ SOUND_SESSION_CALL_MODE_VOICE_WITH_BLUETOOTH, /**< call mode for during call with bluetooth */
+} sound_session_call_mode_e;
+
/**
* @brief Enumeration for sound session interrupted type.
* @since_tizen 2.3
*/
typedef void(* sound_session_interrupted_cb)(sound_session_interrupted_code_e code, void *user_data);
-
-
-/**
- * @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 DEPRECATED; // will be deprecated
-
-/**
- * @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 DEPRECATED; // will be deprecated
-
-/**
- * @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) DEPRECATED; // will be deprecated
-
-/**
- * @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) DEPRECATED; // will be deprecated
-
/**
* @}
*/
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 void(* sound_device_information_changed_cb)(sound_device_h device, sound_device_changed_info_e changed_info, void *user_data);
-
-
-/**
- * @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 DEPRECATED;// will be deprecated
-
-/**
- * @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 DEPRECATED;// will be deprecated
-
-/**
- * @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 DEPRECATED;// will be deprecated
-
/**
* @}
*/
-
/**
* @addtogroup CAPI_MEDIA_SOUND_MANAGER_VOLUME_MODULE
* @{
*/
int sound_manager_unset_volume_changed_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) DEPRECATED;// will be deprecated
-
/**
* @}
*/
*/
int sound_manager_get_voip_session_mode(sound_session_voip_mode_e *mode);
+/**
+ * @internal
+ * @brief Sets the mode of the call sound session.
+ * @since_tizen 2.3
+ * @param[in] mode The call 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_CALL) before calling this function.
+ * @see sound_manager_set_session_type()
+ * @see sound_manager_get_session_type()
+ * @see sound_manager_get_call_session_mode()
+*/
+int sound_manager_set_call_session_mode(sound_session_call_mode_e mode);
+
+/**
+ * @internal
+ * @brief Gets the mode of the call sound session.
+ * @since_tizen 2.3
+ * @param[out] mode The call 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_call) before calling this function.
+ * @see sound_manager_set_session_type()
+ * @see sound_manager_get_session_type()
+ * @see sound_manager_set_call_session_mode()
+*/
+int sound_manager_get_call_session_mode(sound_session_call_mode_e *mode);
+
/**
* @brief Registers a callback function to be invoked when the sound session being played was interrupted.
* @since_tizen 2.3
*/
int sound_manager_unset_session_interrupted_cb(void);
-/**
- * @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) DEPRECATED;// will be deprecated
-
-/**
- * @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) DEPRECATED;// will be deprecated;
-
-/**
- * @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) DEPRECATED;// will be deprecated;
-
-/**
- * @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) DEPRECATED;// will be deprecated;
-
/**
* @}
*/
*/
int sound_manager_unset_device_information_changed_cb (void);
-
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
-/**
- * @brief Unregisters the callback function.
- * @see sound_manager_set_available_route_changed_cb()
- */
-void sound_manager_unset_available_route_changed_cb (void) DEPRECATED;// will be deprecated
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
-
-/**
- * @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) DEPRECATED;// will be deprecated
-
/**
* @}
*/
#define SOUND_SESSION_TYPE_DEFAULT SOUND_SESSION_TYPE_MEDIA
+typedef enum
+{
+ _SESSION_MODE_RINGTONE = 0, /**< session mode(voip/call) for ringtone */
+ _SESSION_MODE_VOICE_WITH_BUILTIN_RECEIVER, /**< session mode(voip/call) for during call with built-in receiver */
+ _SESSION_MODE_VOICE_WITH_BUILTIN_SPEAKER, /**< session mode(voip/call) for during call with built-in speaker */
+ _SESSION_MODE_VOICE_WITH_AUDIO_JACK, /**< session mode(voip/call) for during call with audio jack */
+ _SESSION_MODE_VOICE_WITH_BLUETOOTH, /**< session mode(voip/call) for during call with bluetooth */
+} _session_mode_e;
+
typedef struct {
int is_registered;
void *user_data;
void __session_interrupt_cb(session_msg_t msg, session_event_t event, void *user_data);
+int __set_session_mode(_session_mode_e mode);
+
+int __get_session_mode(_session_mode_e *mode);
+
#ifdef __cplusplus
}
#endif
%postun -p /sbin/ldconfig
+
%files
%manifest %{name}.manifest
%{_libdir}/libcapi-media-sound-manager.so.*
_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;
+_session_mode_e g_cached_session_mode = -1;
int sound_manager_get_max_volume(sound_type_e type, int *max)
{
LOGI(">> enter : type=%d", type);
- if(type < SOUND_SESSION_TYPE_MEDIA || type > SOUND_SESSION_TYPE_VOIP)
+ if(type < SOUND_SESSION_TYPE_MEDIA || type > SOUND_SESSION_TYPE_CALL)
return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
switch(type) {
case SOUND_SESSION_TYPE_VOIP:
new_session = MM_SESSION_TYPE_VOIP;
break;
+ case SOUND_SESSION_TYPE_CALL:
+ new_session = MM_SESSION_TYPE_CALL;
+ break;
}
/* valid session check */
return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
}
}
- if (cur_session == MM_SESSION_TYPE_CALL ||
- cur_session == MM_SESSION_TYPE_VIDEOCALL ||
+ if (cur_session == MM_SESSION_TYPE_VIDEOCALL ||
cur_session >= MM_SESSION_TYPE_VOICE_RECOGNITION) {
return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
}
return __convert_sound_manager_error_code(__func__, ret);
}
g_session_interrupt_cb_table.is_registered = 0;
- g_cached_voip_mode = -1;
+ g_cached_session_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) {
+ if (new_session == MM_SESSION_TYPE_VOIP || new_session == MM_SESSION_TYPE_CALL) {
/* 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;
+ g_cached_session_mode = _SESSION_MODE_RINGTONE;
}
LOGI("<< leave : type=%d, ret=0x%x", type, ret);
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 ((cur_session > MM_SESSION_TYPE_EMERGENCY) &&
+ (cur_session != MM_SESSION_TYPE_VOIP) &&
+ (cur_session != MM_SESSION_TYPE_CALL)) {
if( g_cached_session != -1 )
cur_session = g_cached_session;
else //will be never reach here. just prevent code
case MM_SESSION_TYPE_VOIP:
*type = SOUND_SESSION_TYPE_VOIP;
break;
+ case MM_SESSION_TYPE_CALL:
+ *type = SOUND_SESSION_TYPE_CALL;
+ break;
default:
*type = cur_session;
break;
} 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;
- }
- }
+ ret = __set_session_mode ((_session_mode_e)mode);
LOGI("<< leave : session=%p, mode=%d, ret=0x%x", session, mode, ret);
int ret = MM_ERROR_NONE;
int session = 0;
int session_options = 0;
- int subsession = 0;
+ _session_mode_e _mode = 0;
if(mode == NULL) {
return __convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
} else if (session != MM_SESSION_TYPE_VOIP ) {
return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
}
+ ret = __get_session_mode(&_mode);
+ if (ret == MM_ERROR_NONE)
+ *mode = (sound_session_voip_mode_e)_mode;
- ret = mm_session_get_subsession ((mm_subsession_t *)&subsession);
- if(ret != MM_ERROR_NONE) {
+ LOGI("returns : session=%p, mode=%d, ret=0x%x", session, *mode, ret);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_set_call_session_mode(sound_session_call_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_CALL ) {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
}
- 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;
- }
- }
+ if(mode < SOUND_SESSION_CALL_MODE_RINGTONE || mode > SOUND_SESSION_CALL_MODE_VOICE_WITH_BLUETOOTH) {
+ ret = MM_ERROR_INVALID_ARGUMENT;
+ return __convert_sound_manager_error_code(__func__, ret);
}
- break;
- case MM_SUBSESSION_TYPE_RINGTONE:
- *mode = SOUND_SESSION_VOIP_MODE_RINGTONE;
- break;
- default:
- break;
+ ret = __set_session_mode ((_session_mode_e)mode);
+
+ LOGI("<< leave : session=%p, mode=%d, ret=0x%x", session, mode, ret);
+
+ return __convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_call_session_mode(sound_session_call_mode_e *mode)
+{
+ int ret = MM_ERROR_NONE;
+ int session = 0;
+ int session_options = 0;
+ _session_mode_e _mode = 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_CALL ) {
+ return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+ ret = __get_session_mode(&_mode);
+ if (ret == MM_ERROR_NONE)
+ *mode = (sound_session_call_mode_e)_mode;
+
LOGI("returns : session=%p, mode=%d, ret=0x%x", session, *mode, ret);
return __convert_sound_manager_error_code(__func__, ret);
return __convert_sound_manager_error_code(__func__, ret);
}
-/* below APIs are already deprecated Tizen 2.3, leave it temporarily */
-int sound_manager_get_a2dp_status(bool *connected , char** bt_name)
-{
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-int sound_manager_set_session_notify_cb(sound_session_notify_cb callback , void *user_data)
-{
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-void sound_manager_unset_session_notify_cb(void)
-{
- return;
-}
-
-int sound_manager_set_interrupted_cb(sound_interrupted_cb callback, void *user_data){
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-void sound_manager_unset_interrupted_cb(void){
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-int sound_manager_set_volume_key_type(volume_key_type_e type){
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-int sound_manager_foreach_available_route (sound_available_route_cb callback, void *user_data)
-{
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-int sound_manager_set_active_route (sound_route_e route)
-{
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-int sound_manager_get_active_device (sound_device_in_e *in, sound_device_out_e *out)
-{
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-bool sound_manager_is_route_available (sound_route_e route)
-{
- return false;
-}
-
-int sound_manager_set_available_route_changed_cb (sound_available_route_changed_cb callback, void *user_data)
-{
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-void sound_manager_unset_available_route_changed_cb (void)
-{
- return;
-}
-
-int sound_manager_set_active_device_changed_cb (sound_active_device_changed_cb callback, void *user_data)
-{
- return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
-}
-
-void sound_manager_unset_active_device_changed_cb (void)
-{
- return;
-}
-
__attribute__ ((destructor))
void __sound_manager_finalize(void)
{
#include <dlog.h>
extern _session_interrupt_info_s g_session_interrupt_cb_table;
+extern _session_mode_e g_cached_session_mode;
int __convert_sound_manager_error_code(const char *func, int code) {
int ret = SOUND_MANAGER_ERROR_NONE;
g_session_interrupt_cb_table.user_cb(e, g_session_interrupt_cb_table.user_data);
}
}
+
+int __set_session_mode(_session_mode_e mode)
+{
+ int ret = MM_ERROR_NONE;
+ mm_sound_route route = MM_SOUND_ROUTE_IN_MIC_OUT_SPEAKER;
+ bool need_to_check_device = false;
+ bool do_subsession = true;
+
+ switch (mode) {
+ case _SESSION_MODE_RINGTONE:
+ if (g_cached_session_mode != mode) {
+ /* sub-session */
+ ret = mm_session_set_subsession (MM_SUBSESSION_TYPE_RINGTONE, MM_SUBSESSION_OPTION_NONE);
+ if (ret != MM_ERROR_NONE) {
+ goto ERROR_CASE;
+ }
+ }
+ g_cached_session_mode = mode;
+ do_subsession = false;
+ break;
+ case _SESSION_MODE_VOICE_WITH_BUILTIN_RECEIVER:
+ route = MM_SOUND_ROUTE_IN_MIC_OUT_RECEIVER;
+ break;
+ case _SESSION_MODE_VOICE_WITH_BUILTIN_SPEAKER:
+ route = MM_SOUND_ROUTE_IN_MIC_OUT_SPEAKER;
+ break;
+ case _SESSION_MODE_VOICE_WITH_AUDIO_JACK:
+ route = MM_SOUND_ROUTE_IN_MIC_OUT_HEADPHONE;
+ need_to_check_device = true;
+ break;
+ case _SESSION_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) {
+ goto ERROR_CASE;
+ } 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)
+ goto ERROR_CASE;
+
+ switch (mode) {
+ case _SESSION_MODE_VOICE_WITH_AUDIO_JACK:
+ if (type == MM_SOUND_DEVICE_TYPE_AUDIOJACK) {
+ mm_sound_device_io_direction_e io_direction;
+ ret = mm_sound_get_device_io_direction(device, &io_direction);
+ if (ret != MM_ERROR_NONE)
+ goto ERROR_CASE;
+ if (io_direction == MM_SOUND_DEVICE_IO_DIRECTION_BOTH)
+ route = MM_SOUND_ROUTE_INOUT_HEADSET;
+ do_subsession = true;
+ }
+ break;
+ case _SESSION_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)
+ goto ERROR_CASE;
+ if (io_direction == MM_SOUND_DEVICE_IO_DIRECTION_BOTH)
+ do_subsession = true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ /* sub-session */
+ if (do_subsession && (g_cached_session_mode != mode)) {
+ ret = mm_session_set_subsession (MM_SUBSESSION_TYPE_VOICE, MM_SUBSESSION_OPTION_NONE);
+ if (ret != MM_ERROR_NONE) {
+ goto ERROR_CASE;
+ }
+ /* route */
+ ret = mm_sound_set_active_route(route);
+ if (ret != MM_ERROR_NONE) {
+ goto ERROR_CASE;
+ }
+ g_cached_session_mode = mode;
+ } else {
+ if (!do_subsession && mode != _SESSION_MODE_RINGTONE) {
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+ }
+ERROR_CASE:
+ return ret;
+}
+
+int __get_session_mode(_session_mode_e *mode)
+{
+ int ret = MM_ERROR_NONE;
+ int subsession = 0;
+ ret = mm_session_get_subsession ((mm_subsession_t *)&subsession);
+ if(ret != MM_ERROR_NONE) {
+ goto ERROR_CASE;
+ }
+ 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) {
+ goto ERROR_CASE;
+ } 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)
+ goto ERROR_CASE;
+ switch (type) {
+ case MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER:
+ *mode = _SESSION_MODE_VOICE_WITH_BUILTIN_SPEAKER;
+ need_to_out = true;
+ break;
+ case MM_SOUND_DEVICE_TYPE_BUILTIN_RECEIVER:
+ *mode = _SESSION_MODE_VOICE_WITH_BUILTIN_RECEIVER;
+ need_to_out = true;
+ break;
+ case MM_SOUND_DEVICE_TYPE_AUDIOJACK:
+ *mode = _SESSION_MODE_VOICE_WITH_AUDIO_JACK;
+ need_to_out = true;
+ break;
+ case MM_SOUND_DEVICE_TYPE_BLUETOOTH:
+ *mode = _SESSION_MODE_VOICE_WITH_BLUETOOTH;
+ need_to_out = true;
+ break;
+ default:
+ break;
+ }
+ if (need_to_out)
+ break;
+ }
+ }
+ }
+ break;
+ case MM_SUBSESSION_TYPE_RINGTONE:
+ *mode = _SESSION_MODE_RINGTONE;
+ break;
+ default:
+ break;
+ }
+ERROR_CASE:
+ return ret;
+}
CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION,
CURRENT_STATUS_SET_VOIP_SESSION_MODE,
CURRENT_STATUS_GET_VOIP_SESSION_MODE,
+ CURRENT_STATUS_SET_CALL_SESSION_MODE,
+ CURRENT_STATUS_GET_CALL_SESSION_MODE,
CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB,
CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB,
CURRENT_STATUS_SET_DEVICE_MASK,
{
g_menu_state = CURRENT_STATUS_GET_VOIP_SESSION_MODE;
}
+ else if (strncmp(cmd, "sl", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_SET_CALL_SESSION_MODE;
+ }
+ else if (strncmp(cmd, "gc", 2) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_GET_CALL_SESSION_MODE;
+ }
else if (strncmp(cmd, "sc", 2) == 0 )
{
g_menu_state = CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB;
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("sl. Set Call Session Mode \t");
+ g_print("gc. Get Call Session Mode \n");
g_print("sc. Set Session Interruped CB \t");
g_print("us. Unset Session Interrupted CB \n");
g_print("-----------------------------------------------------------------------------------------\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");
- }
+ g_print("*** input session type(0:MEDIA, 1:ALARM, 2:NOTIFICATION, 3:EMERGENCY, 4:VOIP, 5:CALL)\n");
+ }
else if (g_menu_state == CURRENT_STATUS_GET_SESSION_TYPE)
{
g_print("*** press enter to get session type\n");
{
g_print("*** press enter to get voip session mode\n");
}
+ else if (g_menu_state == CURRENT_STATUS_SET_CALL_SESSION_MODE)
+ {
+ g_print("*** input call 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_CALL_SESSION_MODE)
+ {
+ g_print("*** press enter to get call session mode\n");
+ }
else if (g_menu_state == CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB)
{
g_print("*** press enter to set session interrupted cb\n");
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)
+ if (SOUND_SESSION_TYPE_MEDIA > session_type_n || session_type_n > SOUND_SESSION_TYPE_CALL)
{
g_print("not supported session type(%d)\n", session_type_n);
return 0;
case 4:
*type = SOUND_SESSION_TYPE_VOIP;
break;
- default:
+ case 5:
+ *type = SOUND_SESSION_TYPE_CALL;
break;
}
}
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);
+ g_print("current session type is : %d (0:MEDIA, 1:ALARM, 2:NOTIFICATION, 3:EMERGENCY, 4:VOIP, 5:CALL)\n", type);
reset_menu_state();
}
reset_menu_state();
}
break;
+ case CURRENT_STATUS_SET_CALL_SESSION_MODE:
+ {
+ int ret = SOUND_MANAGER_ERROR_NONE;
+ sound_session_call_mode_e mode;
+ mode = (sound_session_call_mode_e)atoi(cmd);
+ ret = sound_manager_set_call_session_mode(mode);
+ if (ret) {
+ g_print("failed to set call session mode(%d), ret[0x%x]\n", mode, ret);
+ } else {
+ g_print("success to set call session mode\n");
+ }
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_GET_CALL_SESSION_MODE:
+ {
+ int ret = SOUND_MANAGER_ERROR_NONE;
+ sound_session_call_mode_e mode;
+ ret = sound_manager_get_call_session_mode(&mode);
+ if(ret)
+ g_print("fail to get call session mode, ret[0x%x]\n", ret);
+ else
+ g_print("success to get call 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)