summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbok Lee <gilbok.lee@samsung.com>2017-04-27 17:57:32 +0900
committerGilbok Lee <gilbok.lee@samsung.com>2017-04-28 19:15:13 +0900
commit82239203347f19d3a772faff4f6f2e1fd56550c7 (patch)
tree708d37300e0720422d606bb75f4e7616fc6c68d1
parent42e03880d935d628608776e138915c23cbe6f780 (diff)
downloadlibmm-radio-82239203347f19d3a772faff4f6f2e1fd56550c7.tar.gz
libmm-radio-82239203347f19d3a772faff4f6f2e1fd56550c7.tar.bz2
libmm-radio-82239203347f19d3a772faff4f6f2e1fd56550c7.zip
unnecessary resource_manager_release in _mmradio_stop function. [Version] 0.2.26 [Profile] Mobile, Wearable [Issue Type] Fix bugs Change-Id: I3d6de3493b409a2c8912819df6977bcbea1cd3bb
-rwxr-xr-xpackaging/libmm-radio.spec2
-rw-r--r--src/include/mm_radio_resource.h1
-rw-r--r--src/mm_radio_priv_emulator.c4
-rw-r--r--src/mm_radio_priv_hal.c73
-rw-r--r--src/mm_radio_resource.c83
5 files changed, 104 insertions, 59 deletions
diff --git a/packaging/libmm-radio.spec b/packaging/libmm-radio.spec
index b2a5727..dc9a83b 100755
--- a/packaging/libmm-radio.spec
+++ b/packaging/libmm-radio.spec
@@ -1,6 +1,6 @@
Name: libmm-radio
Summary: Multimedia Framework Radio Library
-Version: 0.2.25
+Version: 0.2.26
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/src/include/mm_radio_resource.h b/src/include/mm_radio_resource.h
index 85006ba..534757f 100644
--- a/src/include/mm_radio_resource.h
+++ b/src/include/mm_radio_resource.h
@@ -73,6 +73,7 @@ int mmradio_resource_manager_prepare(mm_radio_resource_manager *resource_manager
int mmradio_resource_manager_unprepare(mm_radio_resource_manager *resource_manager);
int mmradio_resource_manager_acquire(mm_radio_resource_manager *resource_manager);
int mmradio_resource_manager_release(mm_radio_resource_manager *resource_manager);
+int mmradio_resource_manager_get_state(mm_radio_resource_manager *resource_manager, mm_radio_resource_state_e *state);
#ifdef __cplusplus
}
diff --git a/src/mm_radio_priv_emulator.c b/src/mm_radio_priv_emulator.c
index b2ceed4..7fa2ae2 100644
--- a/src/mm_radio_priv_emulator.c
+++ b/src/mm_radio_priv_emulator.c
@@ -1240,6 +1240,7 @@ static bool __mmradio_set_state(mm_radio_t * radio, int new_state)
radio->current_state = new_state;
/* fill message param */
+ msg.union_type = MM_MSG_UNION_STATE;
msg.state.previous = radio->old_state;
msg.state.current = radio->current_state;
@@ -1247,8 +1248,7 @@ static bool __mmradio_set_state(mm_radio_t * radio, int new_state)
/* post message to application */
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;
+ msg.state.code = radio->sound_focus.event_src;
MMRADIO_POST_MSG(radio, msg_type, &msg);
radio->sound_focus.by_focus_cb = false;
} else {
diff --git a/src/mm_radio_priv_hal.c b/src/mm_radio_priv_hal.c
index f4a92e9..5fc7d30 100644
--- a/src/mm_radio_priv_hal.c
+++ b/src/mm_radio_priv_hal.c
@@ -270,12 +270,6 @@ int _mmradio_realize(mm_radio_t *radio)
ret = _mmradio_apply_region(radio, region, update);
- ret = mmradio_resource_manager_prepare(&radio->resource_manager, MM_RADIO_RESOURCE_TYPE_RADIO);
- if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("resource manager prepare fail");
- return MM_ERROR_RADIO_INTERNAL;
- }
-
#ifdef TIZEN_FEATURE_SOUND_VSTREAM
ret = sound_manager_create_stream_information_internal(SOUND_STREAM_TYPE_RADIO, NULL, radio, &radio->stream_info);
if (ret != MM_ERROR_NONE) {
@@ -345,9 +339,6 @@ int _mmradio_unrealize(mm_radio_t *radio)
sound_manager_destroy_virtual_stream(radio->vstream);
sound_manager_destroy_stream_information(radio->stream_info);
#endif
- mmradio_resource_manager_unprepare(&radio->resource_manager);
- if (ret != MM_ERROR_NONE)
- MMRADIO_LOG_ERROR("resource manager unprepare fail");
pthread_mutex_destroy(&radio->seek_cancel_mutex);
@@ -565,9 +556,15 @@ int _mmradio_start(mm_radio_t *radio)
#endif
if (!radio->is_ready) {
+ ret = mmradio_resource_manager_prepare(&radio->resource_manager, MM_RADIO_RESOURCE_TYPE_RADIO);
+ if (ret != MM_ERROR_NONE) {
+ MMRADIO_LOG_ERROR("resource manager prepare fail");
+ return MM_ERROR_RADIO_INTERNAL;
+ }
ret = mmradio_resource_manager_acquire(&radio->resource_manager);
if (ret != MM_ERROR_NONE) {
MMRADIO_LOG_ERROR("failed to acquire resource manager");
+ mmradio_resource_manager_unprepare(&radio->resource_manager);
return ret;
}
ret = radio_hal_prepare(radio->hal_inf);
@@ -644,6 +641,7 @@ error2:
int _mmradio_stop(mm_radio_t *radio)
{
int ret = MM_ERROR_NONE;
+ mm_radio_resource_state_e resource_state = MM_RADIO_RESOURCE_STATE_NONE;
MMRADIO_LOG_FENTER();
@@ -688,10 +686,23 @@ int _mmradio_stop(mm_radio_t *radio)
radio->is_ready = FALSE;
- ret = mmradio_resource_manager_release(&radio->resource_manager);
- if (ret != MM_ERROR_NONE) {
- MMRADIO_LOG_ERROR("failed to release resource");
- return ret;
+ if (!radio->resource_manager.by_rm_cb && /* is being released */
+ mmradio_resource_manager_get_state(&radio->resource_manager, &resource_state) == MM_ERROR_NONE) {
+ if (resource_state == MM_RADIO_RESOURCE_STATE_ACQUIRED) {
+ ret = mmradio_resource_manager_release(&radio->resource_manager);
+ if (ret != MM_ERROR_NONE) {
+ MMRADIO_LOG_ERROR("failed to release resource, ret(0x%x)", ret);
+ return ret;
+ }
+ }
+ }
+
+ if (mmradio_resource_manager_get_state(&radio->resource_manager, &resource_state) == MM_ERROR_NONE) {
+ if (resource_state == MM_RADIO_RESOURCE_STATE_PREPARED) {
+ ret = mmradio_resource_manager_unprepare(&radio->resource_manager);
+ if (ret != MM_ERROR_NONE)
+ MMRADIO_LOG_ERROR("resource manager unprepare fail");
+ }
}
#ifdef TIZEN_FEATURE_SOUND_FOCUS
@@ -811,9 +822,15 @@ int _mmradio_start_scan(mm_radio_t *radio)
radio->stop_scan = false;
if (!radio->is_ready) {
+ ret = mmradio_resource_manager_prepare(&radio->resource_manager, MM_RADIO_RESOURCE_TYPE_RADIO);
+ if (ret != MM_ERROR_NONE) {
+ MMRADIO_LOG_ERROR("resource manager prepare fail");
+ return MM_ERROR_RADIO_INTERNAL;
+ }
ret = mmradio_resource_manager_acquire(&radio->resource_manager);
if (ret != MM_ERROR_NONE) {
MMRADIO_LOG_ERROR("failed to acquire resource manager");
+ mmradio_resource_manager_unprepare(&radio->resource_manager);
return ret;
}
@@ -913,6 +930,7 @@ void __mmradio_scan_thread(mm_radio_t *radio)
{
int ret = MM_ERROR_NONE;
int prev_freq = 0;
+ mm_radio_resource_state_e resource_state = MM_RADIO_RESOURCE_STATE_NONE;
MMRADIO_LOG_FENTER();
MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio);
@@ -1029,9 +1047,22 @@ FINISHED_ERR:
radio->is_ready = FALSE;
- ret = mmradio_resource_manager_release(&radio->resource_manager);
- if (ret != MM_ERROR_NONE)
- MMRADIO_LOG_ERROR("failed to release resource");
+ if (!radio->resource_manager.by_rm_cb && /* is being released */
+ mmradio_resource_manager_get_state(&radio->resource_manager, &resource_state) == MM_ERROR_NONE) {
+ if (resource_state == MM_RADIO_RESOURCE_STATE_ACQUIRED) {
+ ret = mmradio_resource_manager_release(&radio->resource_manager);
+ if (ret != MM_ERROR_NONE)
+ MMRADIO_LOG_ERROR("failed to release resource, ret(0x%x)", ret);
+ }
+ }
+
+ if (mmradio_resource_manager_get_state(&radio->resource_manager, &resource_state) == MM_ERROR_NONE) {
+ if (resource_state == MM_RADIO_RESOURCE_STATE_PREPARED) {
+ ret = mmradio_resource_manager_unprepare(&radio->resource_manager);
+ if (ret != MM_ERROR_NONE)
+ MMRADIO_LOG_ERROR("resource manager unprepare fail");
+ }
+ }
MMRADIO_SET_STATE(radio, MM_RADIO_STATE_READY);
}
@@ -1344,6 +1375,7 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state)
radio->current_state = new_state;
/* fill message param */
+ msg.union_type = MM_MSG_UNION_STATE;
msg.state.previous = radio->old_state;
msg.state.current = radio->current_state;
@@ -1351,13 +1383,11 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state)
/* post message to application */
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;
+ msg.state.code = radio->sound_focus.event_src;
MMRADIO_POST_MSG(radio, msg_type, &msg);
} else if (radio->resource_manager.by_rm_cb) {
msg_type = MM_MESSAGE_STATE_INTERRUPTED;
- msg.union_type = MM_MSG_UNION_CODE;
- msg.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
+ msg.state.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
MMRADIO_POST_MSG(radio, msg_type, &msg);
} else {
msg_type = MM_MESSAGE_STATE_CHANGED;
@@ -1366,8 +1396,7 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state)
#else
if (radio->resource_manager.by_rm_cb) {
msg_type = MM_MESSAGE_STATE_INTERRUPTED;
- msg.union_type = MM_MSG_UNION_CODE;
- msg.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
+ msg.state.code = MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT;
MMRADIO_POST_MSG(radio, msg_type, &msg);
} else {
msg_type = MM_MESSAGE_STATE_CHANGED;
diff --git a/src/mm_radio_resource.c b/src/mm_radio_resource.c
index 0e53030..d474716 100644
--- a/src/mm_radio_resource.c
+++ b/src/mm_radio_resource.c
@@ -91,18 +91,18 @@ static void __mmradio_resource_state_callback(mrp_res_context_t *context, mrp_re
}
radio = (mm_radio_t *)user_data;
if (err != MRP_RES_ERROR_NONE) {
- MMRADIO_LOG_ERROR(" - error message received from Murphy, for the radio(%p), err(0x%x)\n", radio, err);
+ MMRADIO_LOG_ERROR(" - error message received from Murphy, for the radio(%p), err(0x%x)", radio, err);
return;
}
switch (context->state) {
case MRP_RES_CONNECTED:
- MMRADIO_LOG_DEBUG(" - connected to Murphy\n");
+ MMRADIO_LOG_DEBUG(" - connected to Murphy");
if ((rset = mrp_res_list_resources(context)) != NULL) {
mrp_res_string_array_t *resource_names;
resource_names = mrp_res_list_resource_names(rset);
if (!resource_names) {
- MMRADIO_LOG_ERROR(" - no resources available\n");
+ MMRADIO_LOG_ERROR(" - no resources available");
return;
}
for (i = 0; i < resource_names->num_strings; i++) {
@@ -115,7 +115,7 @@ static void __mmradio_resource_state_callback(mrp_res_context_t *context, mrp_re
radio->resource_manager.is_connected = true;
break;
case MRP_RES_DISCONNECTED:
- MMRADIO_LOG_DEBUG(" - disconnected from Murphy\n");
+ MMRADIO_LOG_DEBUG(" - disconnected from Murphy");
if (radio->resource_manager.rset) {
mrp_res_delete_resource_set(radio->resource_manager.rset);
radio->resource_manager.rset = NULL;
@@ -145,14 +145,14 @@ static void __mmradio_rset_state_callback(mrp_res_context_t *cx, const mrp_res_r
return;
}
- MMRADIO_LOG_DEBUG(" - resource set state of radio(%p) is changed to [%s]\n",
+ MMRADIO_LOG_DEBUG(" - resource set state of radio(%p) is changed to [%s]",
radio, _mmrdio_resource_state_to_str(rs->state));
for (i = 0; i < MM_RADIO_RESOURCE_MAX; i++) {
res = mrp_res_get_resource_by_name(rs, mm_radio_resource_str[i]);
if (res == NULL)
- MMRADIO_LOG_WARNING(" -- %s not present in resource set\n", mm_radio_resource_str[i]);
+ MMRADIO_LOG_WARNING(" -- %s not present in resource set", mm_radio_resource_str[i]);
else
- MMRADIO_LOG_DEBUG(" -- resource name [%s] -> [%s]'\n", res->name,
+ MMRADIO_LOG_DEBUG(" -- resource name [%s] -> [%s]", res->name,
_mmrdio_resource_state_to_str(res->state));
}
@@ -197,7 +197,7 @@ static void __mmradio_mrp_resource_release_cb(mrp_res_context_t *cx, const mrp_r
MMRADIO_LOG_FENTER();
if (user_data == NULL) {
- MMRADIO_LOG_ERROR("- user_data is null\n");
+ MMRADIO_LOG_ERROR("- user_data is null");
return;
}
@@ -208,14 +208,14 @@ static void __mmradio_mrp_resource_release_cb(mrp_res_context_t *cx, const mrp_r
return;
}
- MMRADIO_LOG_DEBUG(" - resource set state of radio(%p) is changed to [%s]\n", radio,
+ MMRADIO_LOG_DEBUG(" - resource set state of radio(%p) is changed to [%s]", radio,
_mmrdio_resource_state_to_str(rs->state));
for (i = 0; i < MM_RADIO_RESOURCE_MAX; i++) {
res = mrp_res_get_resource_by_name(rs, mm_radio_resource_str[i]);
if (res == NULL) {
- MMRADIO_LOG_WARNING(" -- %s not present in resource set\n", mm_radio_resource_str[i]);
+ MMRADIO_LOG_WARNING(" -- %s not present in resource set", mm_radio_resource_str[i]);
} else {
- MMRADIO_LOG_DEBUG(" -- resource name [%s] -> [%s]'\n", res->name,
+ MMRADIO_LOG_DEBUG(" -- resource name [%s] -> [%s]", res->name,
_mmrdio_resource_state_to_str(res->state));
if (res->state == MRP_RES_RESOURCE_ABOUT_TO_LOOSE)
resource_released = TRUE;
@@ -233,8 +233,6 @@ static void __mmradio_mrp_resource_release_cb(mrp_res_context_t *cx, const mrp_r
MMRADIO_LOG_ERROR("failed to stop radio");
MMRADIO_CMD_UNLOCK(radio);
- radio->resource_manager.by_rm_cb = false;
-
} else {
MMRADIO_LOG_WARNING("could not find videobin");
}
@@ -248,7 +246,7 @@ static void __mmradio_mrp_resource_release_cb(mrp_res_context_t *cx, const mrp_r
static int _mmradio_create_rset(mm_radio_resource_manager *resource_manager)
{
if (resource_manager->rset) {
- MMRADIO_LOG_ERROR(" - resource set was already created\n");
+ MMRADIO_LOG_ERROR(" - resource set was already created");
return MM_ERROR_RESOURCE_INVALID_STATE;
}
@@ -256,12 +254,12 @@ static int _mmradio_create_rset(mm_radio_resource_manager *resource_manager)
MRP_APP_CLASS_FOR_RADIO, __mmradio_rset_state_callback,
(void*)resource_manager->user_data);
if (resource_manager->rset == NULL) {
- MMRADIO_LOG_ERROR(" - could not create resource set\n");
+ MMRADIO_LOG_ERROR(" - could not create resource set");
return MM_ERROR_RESOURCE_INTERNAL;
}
if (!mrp_res_set_autorelease(TRUE, resource_manager->rset))
- MMRADIO_LOG_WARNING(" - could not set autorelease flag!\n");
+ MMRADIO_LOG_WARNING(" - could not set autorelease flag!");
return MM_ERROR_NONE;
}
@@ -274,11 +272,11 @@ static int _mmradio_include_resource(mm_radio_resource_manager *resource_manager
MRP_RESOURCE_TYPE_MANDATORY,
MRP_RESOURCE_TYPE_EXCLUSIVE);
if (resource == NULL) {
- MMRADIO_LOG_ERROR(" - could not include resource[%s]\n", resource_name);
+ MMRADIO_LOG_ERROR(" - could not include resource[%s]", resource_name);
return MM_ERROR_RESOURCE_INTERNAL;
}
- MMRADIO_LOG_DEBUG(" - include resource[%s]\n", resource_name);
+ MMRADIO_LOG_DEBUG(" - include resource[%s]", resource_name);
return MM_ERROR_NONE;
}
@@ -292,11 +290,11 @@ static int _mmradio_set_resource_release_cb(mm_radio_resource_manager *resource_
if (resource_manager->rset) {
mrp_ret = mrp_res_set_release_callback(resource_manager->rset, __mmradio_mrp_resource_release_cb, resource_manager->user_data);
if (!mrp_ret) {
- MMRADIO_LOG_ERROR(" - could not set release callback\n");
+ MMRADIO_LOG_ERROR(" - could not set release callback");
ret = MM_ERROR_RESOURCE_INTERNAL;
}
} else {
- MMRADIO_LOG_ERROR(" - resource set is null\n");
+ MMRADIO_LOG_ERROR(" - resource set is null");
ret = MM_ERROR_RESOURCE_INVALID_STATE;
}
MMRADIO_LOG_FLEAVE();
@@ -328,14 +326,14 @@ int mmradio_resource_manager_init(mm_radio_resource_manager *resource_manager, v
if (resource_manager->mloop) {
resource_manager->context = mrp_res_create(resource_manager->mloop, __mmradio_resource_state_callback, user_data);
if (resource_manager->context == NULL) {
- MMRADIO_LOG_ERROR(" - could not get context for resource manager\n");
+ MMRADIO_LOG_ERROR(" - could not get context for resource manager");
mrp_mainloop_destroy(resource_manager->mloop);
resource_manager->mloop = NULL;
return MM_ERROR_RESOURCE_INTERNAL;
}
resource_manager->user_data = user_data;
} else {
- MMRADIO_LOG_ERROR("- could not get mainloop for resource manager\n");
+ MMRADIO_LOG_ERROR("- could not get mainloop for resource manager");
return MM_ERROR_RESOURCE_INTERNAL;
}
@@ -387,7 +385,7 @@ int mmradio_resource_manager_unprepare(mm_radio_resource_manager *resource_manag
MMRADIO_CHECK_CONNECTION_RESOURCE_MANAGER(resource_manager);
if (resource_manager->rset == NULL) {
- MMRADIO_LOG_ERROR("- could not unprepare for resource_manager, mmradio_resource_manager_unprepare() first\n");
+ MMRADIO_LOG_ERROR("- could not unprepare for resource_manager, mmradio_resource_manager_prepare() first");
ret = MM_ERROR_RESOURCE_INVALID_STATE;
} else {
MMRADIO_RESOURCE_LOCK(resource_manager);
@@ -417,25 +415,25 @@ int mmradio_resource_manager_acquire(mm_radio_resource_manager *resource_manager
} else {
ret = _mmradio_set_resource_release_cb(resource_manager);
if (ret) {
- MMRADIO_LOG_ERROR("- could not set resource release cb, ret(0x%x)\n", ret);
+ MMRADIO_LOG_ERROR("- could not set resource release cb, ret(0x%x)", ret);
ret = MM_ERROR_RESOURCE_INTERNAL;
} else {
MMRADIO_RESOURCE_LOCK(resource_manager);
ret = mrp_res_acquire_resource_set(resource_manager->rset);
if (ret) {
- MMRADIO_LOG_ERROR("- could not acquire resource, ret(%d)\n", ret);
+ MMRADIO_LOG_ERROR("- could not acquire resource, ret(%d)", ret);
ret = MM_ERROR_RESOURCE_INTERNAL;
} else {
gint64 end_time = g_get_monotonic_time() + MMRADIO_RESOURCE_TIMEOUT * G_TIME_SPAN_SECOND;
- MMRADIO_LOG_DEBUG("- acquire resource waiting..%p till %lld\n", resource_manager, end_time);
+ MMRADIO_LOG_DEBUG("- acquire resource waiting..%p till %lld", resource_manager, end_time);
if (!MMRADIO_RESOURCE_WAIT_UNTIL(resource_manager, end_time)) {
- MMRADIO_LOG_ERROR("- could not acquire resource\n");
+ MMRADIO_LOG_ERROR("- could not acquire resource");
ret = MM_ERROR_RESOURCE_INTERNAL;
} else {
- MMRADIO_LOG_DEBUG("- resources are acquired\n");
+ MMRADIO_LOG_DEBUG("- resources are acquired");
}
}
@@ -457,26 +455,26 @@ int mmradio_resource_manager_release(mm_radio_resource_manager *resource_manager
MMRADIO_CHECK_CONNECTION_RESOURCE_MANAGER(resource_manager);
if (resource_manager->rset == NULL) {
- MMRADIO_LOG_ERROR("- could not release resource, resource set is null\n");
+ MMRADIO_LOG_ERROR("- could not release resource, resource set is null");
ret = MM_ERROR_RESOURCE_INVALID_STATE;
} else {
if (resource_manager->rset->state != MRP_RES_RESOURCE_ACQUIRED) {
- MMRADIO_LOG_ERROR("- could not release resource, resource set state is [%s]\n",
+ MMRADIO_LOG_ERROR("- could not release resource, resource set state is [%s]",
_mmrdio_resource_state_to_str(resource_manager->rset->state));
ret = MM_ERROR_RESOURCE_INVALID_STATE;
} else {
MMRADIO_RESOURCE_LOCK(resource_manager);
ret = mrp_res_release_resource_set(resource_manager->rset);
if (ret) {
- MMRADIO_LOG_ERROR("- could not release resource, ret(%d)\n", ret);
+ MMRADIO_LOG_ERROR("- could not release resource, ret(%d)", ret);
ret = MM_ERROR_RESOURCE_INTERNAL;
} else {
gint64 end_time = g_get_monotonic_time() + MMRADIO_RESOURCE_TIMEOUT * G_TIME_SPAN_SECOND;
- MMRADIO_LOG_DEBUG("- release resource waiting..%p till %lld\n", resource_manager, end_time);
+ MMRADIO_LOG_DEBUG("- release resource waiting..%p till %lld", resource_manager, end_time);
if (!MMRADIO_RESOURCE_WAIT_UNTIL(resource_manager, end_time))
- MMRADIO_LOG_WARNING("- could not release resource in time\n");
+ MMRADIO_LOG_WARNING("- could not release resource in time");
else
MMRADIO_LOG_DEBUG("- resources are released\n");
}
@@ -498,7 +496,7 @@ int mmradio_resource_manager_deinit(mm_radio_resource_manager *resource_manager)
if (resource_manager->rset) {
if (resource_manager->rset->state == MRP_RES_RESOURCE_ACQUIRED) {
if (mrp_res_release_resource_set(resource_manager->rset))
- MMRADIO_LOG_ERROR("- could not release resource\n");
+ MMRADIO_LOG_ERROR("- could not release resource");
}
mrp_res_delete_resource_set(resource_manager->rset);
resource_manager->rset = NULL;
@@ -523,3 +521,20 @@ int mmradio_resource_manager_deinit(mm_radio_resource_manager *resource_manager)
return MM_ERROR_NONE;
}
+
+
+int mmradio_resource_manager_get_state(mm_radio_resource_manager *resource_manager, mm_radio_resource_state_e *state)
+{
+
+ MMRADIO_LOG_FENTER();
+ MMRADIO_CHECK_RESOURCE_MANAGER_INSTANCE(resource_manager);
+ MMRADIO_CHECK_ARG(state);
+
+ MMRADIO_LOG_DEBUG("resource_state is %d", resource_manager->state);
+
+ *state = resource_manager->state;
+
+ MMRADIO_LOG_FLEAVE();
+
+ return MM_ERROR_NONE;
+}