#include <mm_session_private.h>
#include <audio-session-manager.h>
#include <mm_sound_focus.h>
+#include <mm_message.h>
enum {
- MMRADIO_ASM_CB_NONE,
- MMRADIO_ASM_CB_POSTMSG,
- MMRADIO_ASM_CB_SKIP_POSTMSG
+ MMRADIO_FOCUS_CB_NONE,
+ MMRADIO_FOCUS_CB_POSTMSG,
+ MMRADIO_FOCUS_CB_SKIP_POSTMSG
};
typedef struct {
int handle;
int pid;
- int by_asm_cb;
+ int by_focus_cb;
int event_src;
- int asm_session_flags;
+ int snd_session_flags;
mm_sound_focus_type_e cur_focus_type;
} MMRadioAudioFocus;
int mmradio_audio_focus_deregister(MMRadioAudioFocus* sm);
int mmradio_acquire_audio_focus(MMRadioAudioFocus* sm);
int mmradio_release_audio_focus(MMRadioAudioFocus* sm);
-void mmradio_get_audio_focus_reason(mm_sound_focus_state_e focus_state, const char *reason_for_change, ASM_event_sources_t *event_source, int *postMsg);
+void mmradio_get_audio_focus_reason(mm_sound_focus_state_e focus_state, const char *reason_for_change, enum MMMessageInterruptedCode *event_source, int *postMsg);
#endif /* MM_RADIO_AUDIO_FOCUS_H_ */
if ( errorcode == MM_ERROR_NONE )
{
debug_warning("Read Session Information success. session_type : %d flags: %d \n", session_type, session_flags);
- sm->asm_session_flags = session_flags;
+ sm->snd_session_flags = session_flags;
session_type = MM_SESSION_TYPE_MEDIA;
}
else
#define AUDIO_FOCUS_REASON_MAX 128
-void mmradio_get_audio_focus_reason(mm_sound_focus_state_e focus_state, const char *reason_for_change, ASM_event_sources_t *event_source, int *postMsg)
+void mmradio_get_audio_focus_reason(mm_sound_focus_state_e focus_state, const char *reason_for_change, enum MMMessageInterruptedCode *event_source, int *postMsg)
{
MMRADIO_LOG_FENTER();
MMRADIO_LOG_ERROR("mmradio_get_audio_focus_reason focus_state : %d reason_for_change :%s\n", focus_state, reason_for_change);
)
{
if(focus_state == FOCUS_IS_RELEASED)
- *event_source = ASM_EVENT_SOURCE_CALL_START;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_CALL_START;
else if(focus_state == FOCUS_IS_ACQUIRED)
- *event_source = ASM_EVENT_SOURCE_CALL_END;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_CALL_END;
*postMsg = true;
}
else if(0 == strncmp(reason_for_change, "alarm", AUDIO_FOCUS_REASON_MAX))
{
if(focus_state == FOCUS_IS_RELEASED)
- *event_source = ASM_EVENT_SOURCE_ALARM_START;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_ALARM_START;
else if(focus_state == FOCUS_IS_ACQUIRED)
- *event_source = ASM_EVENT_SOURCE_ALARM_END;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_ALARM_END;
*postMsg = true;
}
else if(0 == strncmp(reason_for_change, "notification", AUDIO_FOCUS_REASON_MAX))
{
if(focus_state == FOCUS_IS_RELEASED)
- *event_source = ASM_EVENT_SOURCE_NOTIFY_START;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_START;
else if(focus_state == FOCUS_IS_ACQUIRED)
- *event_source = ASM_EVENT_SOURCE_NOTIFY_END;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_END;
*postMsg = true;
}
else if(0 == strncmp(reason_for_change, "emergency", AUDIO_FOCUS_REASON_MAX))
{
if(focus_state == FOCUS_IS_RELEASED)
- *event_source = ASM_EVENT_SOURCE_EMERGENCY_START;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_START;
else if(focus_state == FOCUS_IS_ACQUIRED)
- *event_source = ASM_EVENT_SOURCE_EMERGENCY_END;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_END;
*postMsg = false;
}
else if(0 == strncmp(reason_for_change, "media", AUDIO_FOCUS_REASON_MAX))
{
- *event_source = ASM_EVENT_SOURCE_MEDIA;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_MEDIA;
*postMsg = false;
}
else
{
- *event_source = ASM_EVENT_SOURCE_MEDIA;
+ *event_source = MM_MSG_CODE_INTERRUPTED_BY_MEDIA;
*postMsg = false;
}
MMRADIO_LOG_FLEAVE();
msg.state.current = radio->current_state;
/* post message to application */
- switch( radio->sm.by_asm_cb )
+ switch( radio->sm.by_focus_cb )
{
- case MMRADIO_ASM_CB_NONE:
+ case MMRADIO_FOCUS_CB_NONE:
{
msg_type = MM_MESSAGE_STATE_CHANGED;
MMRADIO_POST_MSG( radio, msg_type, &msg );
}
break;
- case MMRADIO_ASM_CB_POSTMSG:
+ case MMRADIO_FOCUS_CB_POSTMSG:
{
msg_type = MM_MESSAGE_STATE_INTERRUPTED;
msg.union_type = MM_MSG_UNION_CODE;
}
break;
- case MMRADIO_ASM_CB_SKIP_POSTMSG:
+ case MMRADIO_FOCUS_CB_SKIP_POSTMSG:
default:
break;
}
const char *additional_info, void *user_data)
{
mm_radio_t *radio = (mm_radio_t *) user_data;
- ASM_event_sources_t event_source;
+ enum MMMessageInterruptedCode event_source;
int result = MM_ERROR_NONE;
int postMsg = false;
switch (focus_state) {
case FOCUS_IS_RELEASED: {
radio->sm.cur_focus_type &= ~focus_type;
- radio->sm.by_asm_cb = MMRADIO_ASM_CB_POSTMSG;
+ radio->sm.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
result = _mmradio_stop(radio);
if (result) {
if ((postMsg) && (FOCUS_FOR_BOTH == radio->sm.cur_focus_type))
MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
- radio->sm.by_asm_cb = MMRADIO_ASM_CB_NONE;
+ radio->sm.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d\n", radio->sm.cur_focus_type);
}
if (!is_connected)
{
MMRADIO_LOG_ERROR("sound device unplugged");
- radio->sm.by_asm_cb = MMRADIO_ASM_CB_POSTMSG;
- radio->sm.event_src = ASM_EVENT_SOURCE_EARJACK_UNPLUG;
+ radio->sm.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+ radio->sm.event_src = MM_MSG_CODE_INTERRUPTED_BY_EARJACK_UNPLUG;
result = _mmradio_stop(radio);
if (result != MM_ERROR_NONE)