* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum {
- RADIO_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed */
- RADIO_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application */
- RADIO_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call */
- RADIO_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones */
+ RADIO_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed (Deprecated since 3.0)*/
+ RADIO_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application (Deprecated since 3.0)*/
+ RADIO_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call (Deprecated since 3.0)*/
+ RADIO_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones (Deprecated since 3.0)*/
RADIO_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict */
- RADIO_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm */
- RADIO_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency */
- RADIO_INTERRUPTED_BY_RESUMABLE_MEDIA, /**< Interrupted by a resumable media application */
- RADIO_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification */
+ RADIO_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm (Deprecated since 3.0)*/
+ RADIO_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency (Deprecated since 3.0)*/
+ RADIO_INTERRUPTED_BY_RESUMABLE_MEDIA, /**< Interrupted by a resumable media application (Deprecated since 3.0)*/
+ RADIO_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification (Deprecated since 3.0)*/
} radio_interrupted_code_e;
/**
*/
int radio_get_channel_spacing(radio_h radio, int *channel_spacing);
+/**
+ * @brief Sets the radio's volume.
+ * @details Setting this volume adjusts the radio's instance volume, not the system volume.
+ * The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0.
+ * To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
+ * Finally, it does not support to set other value into each channel currently.
+ * @since_tizen 3.0
+ * @param[in] radio The handle to radio
+ * @param[in] volume The volume to set [0.0 ~ 1.0](1.0 = 100%)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #RADIO_ERROR_NONE Successful
+ * @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RADIO_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RADIO_ERROR_NOT_SUPPORTED Not supported
+ * @see radio_get_volume()
+ */
+int radio_set_volume(radio_h radio, float volume);
+
+/**
+ * @brief Gets the radio's current volume.
+ * @details The range of @a volume is from @c 0 to @c 1.0, inclusive (1.0 = 100%).
+ * This function gets the radio volume, not the system volume.
+ * To get the system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
+ * @since_tizen 3.0
+ * @param[in] radio The handle to radio
+ * @param[out] volume The current volume [0.0 ~ 1.0](1.0 = 100%)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #RADIO_ERROR_NONE Successful
+ * @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RADIO_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RADIO_ERROR_NOT_SUPPORTED Not supported
+ * @see radio_set_volume()
+ */
+int radio_get_volume(radio_h radio, float *volume);
/**
* @}
Name: capi-media-radio
Summary: A Radio library in Tizen Native API
-Version: 0.1.3
+Version: 0.1.6
Release: 1
Group: API/C API
License: Apache-2.0
else
return RADIO_ERROR_NONE;
}
+
+int radio_set_volume(radio_h radio, float volume)
+{
+ LOGI("[%s] Enter", __func__);
+ RADIO_SUPPORT_CHECK(__radio_check_system_info_feature_supported());
+ RADIO_INSTANCE_CHECK(radio);
+ if (volume < 0.0 || volume > 1.0) {
+ LOGE("[%s] RADIO_ERROR_INVALID_PARAMETER(0x%08x) : Out of range (0.0 ~ 1.0)", __FUNCTION__, RADIO_ERROR_INVALID_PARAMETER);
+ return RADIO_ERROR_INVALID_PARAMETER;
+ }
+ float vol = volume;
+ radio_s *handle = (radio_s *)radio;
+ int ret = mm_radio_set_volume(handle->mm_handle, vol);
+ if (ret != MM_ERROR_NONE)
+ return __convert_error_code(ret, (char *)__FUNCTION__);
+ else
+ return RADIO_ERROR_NONE;
+}
+
+int radio_get_volume(radio_h radio, float *volume)
+{
+ LOGI("[%s] Enter", __func__);
+ RADIO_SUPPORT_CHECK(__radio_check_system_info_feature_supported());
+ RADIO_INSTANCE_CHECK(radio);
+ RADIO_NULL_ARG_CHECK(volume);
+ radio_s *handle = (radio_s *)radio;
+
+ float vol;
+ int ret = mm_radio_get_volume(handle->mm_handle, &vol);
+ if (ret != MM_ERROR_NONE) {
+ return __convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
+ *volume = vol;
+ return RADIO_ERROR_NONE;
+ }
+}
+
CURRENT_STATUS_MAINMENU,
CURRENT_STATUS_CALL_API,
CURRENT_STATUS_SET_FREQ,
- CURRENT_STATUS_SET_MUTE
+ CURRENT_STATUS_SET_MUTE,
+ CURRENT_STATUS_SET_VOL,
};
int g_menu_state = CURRENT_STATUS_MAINMENU;
int g_num_of_tests = 0;
static radio_h g_my_radio = 0;
-
-
-
+GMainLoop *loop = NULL;
static void display_sub_basic()
{
g_print("\n");
g_print("=============================================================\n");
- g_print(" FMRadio testing menu\n");
+ g_print(" FMRadio testing menu\n");
g_print("-------------------------------------------------------------\n");
g_print(" 1. init test\n");
g_print(" 2. listening gorelra\n");
g_print("[4] radio_start\t\t");
g_print("[5] radio_stop\n");
g_print("[6] radio_seek_up\t");
- g_print("[7] radio_seek_dow\n");
+ g_print("[7] radio_seek_down\n");
g_print("[8] radio_set_frequency\t");
g_print("[9] radio_get_frequency\n");
g_print("[10] radio_scan_start\t");
g_print("[17] radio_unset_interrupted_cb\n");
g_print("[18] radio_get_frequency_range\t\t");
g_print("[19] radio_get_channel_spacing\n");
- g_print("[20] radio_signal_strength\t\t");
+ g_print("[20] radio_signal_strength\n");
+ g_print("[21] radio_set_volume\t");
+ g_print("[22] radio_get_volume\t");
g_print("[0] quit\n");
g_print("---------------------------------------------------------------------------\n");
g_print("choose one : ");
g_print("input freq : ");
} else if (g_menu_state == CURRENT_STATUS_SET_MUTE) {
g_print("select one(0:UNMUTE/1:MUTE) : ");
+ } else if (g_menu_state == CURRENT_STATUS_SET_VOL) {
+ g_print("input volume (0.0 ~ 1.0) : ");
} else {
g_print("*** unknown status.\n");
/* exit(0); */
RADIO_TEST__(radio_set_interrupted_cb(g_my_radio, &__radio_set_interrupted_cb, NULL);)
} else if (strncmp(cmd, "17", len) == 0) {
RADIO_TEST__(radio_unset_interrupted_cb(g_my_radio);)
- } else if (strncmp(cmd, "15", len) == 0) {
+ } else if (strncmp(cmd, "18", len) == 0) {
int min = 0;
int max = 0;
RADIO_TEST__(radio_get_frequency_range(g_my_radio, &min, &max);)
int signal_strength = 0;
RADIO_TEST__(radio_get_signal_strength(g_my_radio, &signal_strength);)
g_print("signal strength is : %d \n", signal_strength);
+ } else if (strncmp(cmd, "21", len) == 0) {
+ g_menu_state = CURRENT_STATUS_SET_VOL;
+ } else if (strncmp(cmd, "22", len) == 0) {
+ float vol = 0.0;
+ RADIO_TEST__(radio_get_volume(g_my_radio, &vol);)
+ g_print("volume : %f\n", vol);
} else {
g_print("UNKNOW COMMAND\n");
}
g_menu_state = CURRENT_STATUS_CALL_API;
break;
}
+ case CURRENT_STATUS_SET_VOL: {
+ float vol = atof(cmd);
+ RADIO_TEST__(radio_set_volume(g_my_radio, vol);)
+ g_menu_state = CURRENT_STATUS_CALL_API;
+ break;
+ }
default:
- break;
+ break;
}
g_timeout_add(100, timeout_menu_display, 0);
}
int main(int argc, char *argv[])
{
GIOChannel *stdin_channel;
- GMainLoop *loop = g_main_loop_new(NULL, 0);
+ loop = g_main_loop_new(NULL, 0);
stdin_channel = g_io_channel_unix_new(0);
g_io_channel_set_flags(stdin_channel, G_IO_FLAG_NONBLOCK, NULL);
g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc) input, NULL);