[libmm-radio] remove asm dependency 29/49429/3 accepted/tizen/mobile/20151103.075039 accepted/tizen/tv/20151103.075111 accepted/tizen/wearable/20151103.075135 submit/tizen/20151103.061406
authorHyunjin Park <hyunjin45.park@samsung.com>
Tue, 13 Oct 2015 07:11:09 +0000 (16:11 +0900)
committerHyunjin Park <hyunjin45.park@samsung.com>
Thu, 22 Oct 2015 08:35:40 +0000 (17:35 +0900)
Signed-off-by: Hyunjin Park <hyunjin45.park@samsung.com>
Change-Id: I9d405ea3d486a0f5be24087da95e40dd92eab672

src/include/mm_radio_audio_focus.h
src/mm_radio_audio_focus.c
src/mm_radio_priv.c

index b8fec93..a3e0281 100755 (executable)
 #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;
 
@@ -48,6 +49,6 @@ int mmradio_audio_focus_register(MMRadioAudioFocus* sm, mm_sound_focus_changed_c
 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_ */
index aa16385..fba1c75 100755 (executable)
@@ -49,7 +49,7 @@ int mmradio_audio_focus_register(MMRadioAudioFocus* sm, mm_sound_focus_changed_c
        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
@@ -151,7 +151,7 @@ int mmradio_release_audio_focus(MMRadioAudioFocus* sm)
 
 #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);
@@ -163,43 +163,43 @@ void mmradio_get_audio_focus_reason(mm_sound_focus_state_e focus_state, const ch
                )
        {
                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();
index f5ed857..7596e3f 100755 (executable)
@@ -1396,16 +1396,16 @@ __mmradio_set_state(mm_radio_t* radio, int new_state)
        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;
@@ -1414,7 +1414,7 @@ __mmradio_set_state(mm_radio_t* radio, int new_state)
                }
                break;
 
-               case MMRADIO_ASM_CB_SKIP_POSTMSG:
+               case MMRADIO_FOCUS_CB_SKIP_POSTMSG:
                default:
                break;
        }
@@ -1441,7 +1441,7 @@ __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
                              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;
 
@@ -1454,7 +1454,7 @@ __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
        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) {
@@ -1474,7 +1474,7 @@ __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
                                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);
                        }
@@ -1514,8 +1514,8 @@ __mmradio_device_connected_cb(MMSoundDevice_t device, bool is_connected, void *u
                        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)