Remove MMRADIO_FOCUS_CB_ enum 39/124039/3
authorGilbok Lee <gilbok.lee@samsung.com>
Mon, 10 Apr 2017 04:01:50 +0000 (13:01 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Mon, 10 Apr 2017 04:15:58 +0000 (13:15 +0900)
Use bool type for classify focus_cb, due to unuse MMRADIO_FOCUS_CB_SKIP_POSTMSG enum
Brief Description (should be single line)

[Version] 0.2.24
[Profile] Mobile, Wearable
[Issue Type] Fix bugs

Change-Id: I9d799a3b9af12c188a3ff06bfefa2ee6c2b354d9

packaging/libmm-radio.spec
src/include/mm_radio_sound_focus.h
src/mm_radio_priv_emulator.c
src/mm_radio_priv_hal.c
src/mm_radio_sound_focus.c

index 3cf206edc395db3dc54afd0f4e5d957453ae90e1..d51df592a7d3a3341211522266f5a435c1bdcc0d 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-radio
 Summary:    Multimedia Framework Radio Library
-Version:    0.2.23
+Version:    0.2.24
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 64a69d86bf5e5e11fab64ef01774d90ea6e0b49e..31f008db4a7e0ff366b090b7066e6103f75b44ab 100644 (file)
 #include <mm_sound_focus.h>
 #include <mm_message.h>
 
-enum {
-       MMRADIO_FOCUS_CB_NONE,
-       MMRADIO_FOCUS_CB_POSTMSG,
-       MMRADIO_FOCUS_CB_SKIP_POSTMSG
-};
 typedef struct {
        int focus_id;
        int watch_id;
@@ -40,7 +35,7 @@ typedef struct {
        unsigned int device_subs_id;
        int handle;
        int pid;
-       int by_focus_cb;
+       bool by_focus_cb;
        int event_src;
        int snd_session_flags;
        int session_type;
index 9debc9ae3353c19115e208fe014aabce001273bb..92192146e0665070b3d601048f933adc74b220e0 100644 (file)
@@ -1245,26 +1245,15 @@ static bool __mmradio_set_state(mm_radio_t * radio, int new_state)
 
 #ifdef TIZEN_FEATURE_SOUND_FOCUS
        /* post message to application */
-       switch (radio->sound_focus.by_focus_cb) {
-       case MMRADIO_FOCUS_CB_NONE:
-               {
-                       msg_type = MM_MESSAGE_STATE_CHANGED;
-                       MMRADIO_POST_MSG(radio, msg_type, &msg);
-               }
-               break;
-
-       case MMRADIO_FOCUS_CB_POSTMSG:
-               {
-                       msg_type = MM_MESSAGE_STATE_INTERRUPTED;
-                       msg.union_type = MM_MSG_UNION_CODE;
-                       msg.code = radio->sound_focus.event_src;
-                       MMRADIO_POST_MSG(radio, msg_type, &msg);
-               }
-               break;
-
-       case MMRADIO_FOCUS_CB_SKIP_POSTMSG:
-       default:
-               break;
+       if (radio->sound_focus.by_focus_cb) {
+               msg_type = MM_MESSAGE_STATE_INTERRUPTED;
+               msg.union_type = MM_MSG_UNION_CODE;
+               msg.code = radio->sound_focus.event_src;
+               MMRADIO_POST_MSG(radio, msg_type, &msg);
+               radio->sound_focus.by_focus_cb = false;
+       } else {
+               msg_type = MM_MESSAGE_STATE_CHANGED;
+               MMRADIO_POST_MSG(radio, msg_type, &msg);
        }
 #else
        msg_type = MM_MESSAGE_STATE_CHANGED;
@@ -1304,12 +1293,14 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
        switch (focus_state) {
        case FOCUS_IS_RELEASED:{
                        radio->sound_focus.cur_focus_type &= ~focus_type;
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+                       radio->sound_focus.by_focus_cb = true;
 
                        result = _mmradio_stop(radio);
                        if (result)
                                MMRADIO_LOG_ERROR("failed to stop radio\n");
 
+                       radio->sound_focus.by_focus_cb = false;
+
                        MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
                }
                break;
@@ -1324,8 +1315,6 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
                        if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
                                MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
 
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
-
                        MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
                }
                break;
@@ -1356,12 +1345,14 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
        switch (focus_state) {
        case FOCUS_IS_ACQUIRED: {
                        radio->sound_focus.cur_focus_type &= ~focus_type;
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+                       radio->sound_focus.by_focus_cb = true;
 
                        result = _mmradio_stop(radio);
                        if (result)
                                MMRADIO_LOG_ERROR("failed to stop radio\n");
 
+                       radio->sound_focus.by_focus_cb = false;
+
                        MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
                }
                break;
@@ -1376,8 +1367,6 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
                        if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
                                MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
 
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
-
                        MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
                }
                break;
index 0ccd8841bc64cd2f51ff9fa8adb53ebb304aec9f..f13b6320f9f7150ed6033921f96f23b7eb19f933 100644 (file)
@@ -1301,26 +1301,14 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state)
 
 #ifdef TIZEN_FEATURE_SOUND_FOCUS
        /* post message to application */
-       switch (radio->sound_focus.by_focus_cb) {
-       case MMRADIO_FOCUS_CB_NONE:
-               {
-                       msg_type = MM_MESSAGE_STATE_CHANGED;
-                       MMRADIO_POST_MSG(radio, msg_type, &msg);
-               }
-               break;
-
-       case MMRADIO_FOCUS_CB_POSTMSG:
-               {
-                       msg_type = MM_MESSAGE_STATE_INTERRUPTED;
-                       msg.union_type = MM_MSG_UNION_CODE;
-                       msg.code = radio->sound_focus.event_src;
-                       MMRADIO_POST_MSG(radio, msg_type, &msg);
-               }
-               break;
-
-       case MMRADIO_FOCUS_CB_SKIP_POSTMSG:
-       default:
-               break;
+       if (radio->sound_focus.by_focus_cb) {
+               msg_type = MM_MESSAGE_STATE_INTERRUPTED;
+               msg.union_type = MM_MSG_UNION_CODE;
+               msg.code = radio->sound_focus.event_src;
+               MMRADIO_POST_MSG(radio, msg_type, &msg);
+       } else {
+               msg_type = MM_MESSAGE_STATE_CHANGED;
+               MMRADIO_POST_MSG(radio, msg_type, &msg);
        }
 #else
        msg_type = MM_MESSAGE_STATE_CHANGED;
@@ -1362,13 +1350,13 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
        switch (focus_state) {
        case FOCUS_IS_RELEASED:{
                        radio->sound_focus.cur_focus_type &= ~focus_type;
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+                       radio->sound_focus.by_focus_cb = true;
 
                        result = _mmradio_stop(radio);
                        if (result)
                                MMRADIO_LOG_ERROR("failed to stop radio");
 
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
+                       radio->sound_focus.by_focus_cb = false;
 
                        MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
                }
@@ -1384,8 +1372,6 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
                        if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
                                MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
 
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
-
                        MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
                }
                break;
@@ -1417,12 +1403,13 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
        switch (focus_state) {
        case FOCUS_IS_ACQUIRED: {
                        radio->sound_focus.cur_focus_type &= ~focus_type;
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+                       radio->sound_focus.by_focus_cb = true;
 
                        result = _mmradio_stop(radio);
                        if (result)
                                MMRADIO_LOG_ERROR("failed to stop radio");
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
+
+                       radio->sound_focus.by_focus_cb = false;
 
                        MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
                }
@@ -1438,8 +1425,6 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
                        if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
                                MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
 
-                       radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
-
                        MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
                }
                break;
index 766a91374403cac502b1ff97a2c7e5e3d3f111ce..0eff66e266fe593b80746c145989010268220a09 100644 (file)
@@ -48,13 +48,14 @@ static void _mmradio_device_connected_cb(MMSoundDevice_t device, bool is_connect
                case MM_SOUND_DEVICE_TYPE_USB_AUDIO:
                        if (!is_connected) {
                                MMRADIO_LOG_ERROR("sound device unplugged");
-                               radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+                               radio->sound_focus.by_focus_cb = true;
                                radio->sound_focus.event_src = MM_MSG_CODE_INTERRUPTED_BY_EARJACK_UNPLUG;
 
                                result = _mmradio_stop(radio);
                                if (result != MM_ERROR_NONE)
                                        MMRADIO_LOG_ERROR("failed to stop radio");
-                               radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
+
+                               radio->sound_focus.by_focus_cb = false;
                        }
                        break;
                default: