/**
* @file radio.h
* @brief This file contains the radio API.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
/**
/**
* @brief Radio type handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef struct radio_s *radio_h;
/**
* @brief Enumeration of radio state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration of error codes for the radio.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
RADIO_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
RADIO_ERROR_INVALID_STATE = TIZEN_ERROR_RADIO | 0x01 , /**< Invalid state */
RADIO_ERROR_SOUND_POLICY = TIZEN_ERROR_RADIO | 0x02 , /**< Sound policy error */
+ RADIO_ERROR_NO_ANTENNA = TIZEN_ERROR_RADIO | 0x03 , /**< No Antenna error (Since 2.4) */
RADIO_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
RADIO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
} radio_error_e;
/**
* @brief Enumeration of radio interrupted type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Called when the scan information is updated.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] frequency The tuned radio frequency [87500 ~ 108000] (kHz)
* @param[in] user_data The user data passed from the callback registration function
* @pre It will be invoked by radio_scan_start().
/**
* @brief Called when the radio scan is stopped.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] user_data The user data passed from the callback registration function
* @pre It will be invoked when the scan is stopped by radio_scan_stop().
* @see radio_scan_stop()
/**
* @brief Called when the radio scan is completed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] user_data The user data passed from the callback registration function
* @pre It will be invoked when the scan is completed by registering this callback using radio_set_scan_completed_cb().
* @see radio_scan_start()
/**
* @brief Called when the radio seek is completed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] frequency The current frequency [87500 ~ 108000] (kHz)
* @param[in] user_data The user data passed from the callback registration function
* @pre It will be invoked when the radio seek is completed by registering this callback using radio_seek_up() or radio_seek_down().
/**
* @brief Called when the radio is interrupted.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] error_code The interrupted error code
* @param[in] user_data The user data passed from the callback registration function
* @see radio_set_interrupted_cb()
/**
* @brief Creates a radio handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a radio using radio_destroy().
* @param[out] radio A new handle to radio
* @retval #RADIO_ERROR_NONE Successful
/**
* @brief Destroys the radio handle and releases all its resources.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks To completely shutdown the radio operation, call this function with a valid radio handle.
*
* @param[in] radio The handle to radio to be destroyed
/**
* @brief Gets the radio's current state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[out] state The current state of the radio
* @return @c 0 on success,
/**
* @brief Starts playing the radio.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @return @c 0 on success,
* otherwise a negative error value
* @retval #RADIO_ERROR_INVALID_STATE Invalid radio state
* @retval #RADIO_ERROR_SOUND_POLICY Sound policy error
* @retval #RADIO_ERROR_NOT_SUPPORTED Not supported
+ * @retval #RADIO_ERROR_NO_ANTENNA No Antenna error
* @pre The radio state must be set to #RADIO_STATE_READY by calling radio_create().
* @post The radio state will be #RADIO_STATE_PLAYING.
* @see radio_stop()
/**
* @brief Stops playing the radio.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @return @c 0 on success,
* otherwise a negative error value
/**
* @brief Seeks up the effective frequency of the radio, asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[in] callback The callback function to register
* @param[in] user_data The user data to be passed to the callback function
/**
* @brief Seeks down the effective frequency of the radio, asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[in] callback The callback function to register
* @param[in] user_data The user data to be passed to the callback function
/**
* @brief Sets the radio frequency.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[in] frequency The frequency to set [87500 ~ 108000] (kHz)
* @return @c 0 on success,
/**
* @brief Gets the current frequency of the radio.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[out] frequency The current frequency [87500 ~ 108000] (kHz)
* @return @c 0 on success,
/**
* @brief Gets the current signal strength of the radio.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[out] strength The current signal strength [-128 ~ 128] (dBm)
* @return @c 0 on success,
/**
* @brief Starts scanning radio signals, asynchronously
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[in] callback The callback function to register
* @param[in] user_data The user data to be passed to the callback function
/**
* @brief Stops scanning radio signals, asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[in] callback The callback function to register
* @param[in] user_data The user data to be passed to the callback function
/**
* @brief Sets the radio's mute status.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @details If the mute status is @c true, no sounds will be played. If @c false, sounds will be played. Until this function is called, by default the radio is not muted.
* @param[in] radio The handle to radio
* @param[in] muted The new mute status: (@c true = mute, @c false = not muted)
/**
* @brief Gets the radio's mute status.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @details If the mute status is @c true, no sounds are played. If @c false, sounds are played.
* @param[in] radio The handle to radio
* @param[out] muted The current mute status: (@c true = mute, @c false = not muted)
/**
* @brief Registers a callback function to be invoked when the scan finishes.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[in] callback The callback function to register
* @param[in] user_data The user data to be passed to the callback function
/**
* @brief Unregisters the callback function.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @return @c 0 on success,
* otherwise a negative error value
/**
* @brief Registers a callback function to be invoked when the radio is interrupted.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @param[in] callback The callback function to register
* @param[in] user_data The user data to be passed to the callback function
/**
* @brief Unregisters the callback function.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] radio The handle to radio
* @return @c 0 on success,
* otherwise a negative error value
int radio_unset_interrupted_cb(radio_h radio);
/**
+ * @brief Gets the min, max frequency of the region.
+ * @since_tizen 2.4
+ * @param[in] radio The handle to radio
+ * @param[out] min_freq The min frequency [87500 ~ 108000] (kHz)
+ * @param[out] max_freq The max frequency [87500 ~ 108000] (kHz)
+ * @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
+ */
+int radio_get_frequency_range(radio_h radio, int *min_freq, int *max_freq);
+
+/**
+ * @brief Gets channel spacing.
+ * @since_tizen 2.4
+ * @param[in] radio The handle to radio
+ * @param[out] channel_spacing The channel spacing value
+ * @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
+ */
+int radio_get_channel_spacing(radio_h radio, int *channel_spacing);
+
+
+/**
* @}
*/
msg = "RADIO_ERROR_INVALID_STATE";
break;
case MM_ERROR_COMMON_INVALID_ARGUMENT:
+ case MM_ERROR_INVALID_ARGUMENT:
ret = RADIO_ERROR_INVALID_PARAMETER;
msg = "RADIO_ERROR_INVALID_PARAMETER";
break;
ret = RADIO_ERROR_NOT_SUPPORTED;
msg = "RADIO_ERROR_NOT_SUPPORTED";
break;
+ case MM_ERROR_RADIO_NO_ANTENNA:
+ ret = RADIO_ERROR_NO_ANTENNA;
+ msg = "RADIO_ERROR_NO_ANTENNA";
+ break;
case MM_ERROR_RADIO_DEVICE_NOT_OPENED:
default :
ret= RADIO_ERROR_PERMISSION_DENIED;
RADIO_SUPPORT_CHECK(__radio_check_system_info_feature_supported());
return __unset_callback(_RADIO_EVENT_TYPE_INTERRUPT,radio);
}
+
+
+int radio_get_frequency_range(radio_h radio, int *min_freq, int *max_freq)
+{
+ LOGI("[%s] Enter", __func__);
+ RADIO_SUPPORT_CHECK(__radio_check_system_info_feature_supported());
+ RADIO_INSTANCE_CHECK(radio);
+ RADIO_NULL_ARG_CHECK(min_freq);
+ RADIO_NULL_ARG_CHECK(max_freq);
+ radio_s * handle = (radio_s *) radio;
+
+ unsigned int min = 0;
+ unsigned int max = 0;
+
+ int ret = mm_radio_get_region_frequency_range(handle->mm_handle, &min, &max);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ *min_freq = min;
+ *max_freq = max;
+ return RADIO_ERROR_NONE;
+ }
+}
+
+int radio_get_channel_spacing(radio_h radio, int *channel_spacing)
+{
+ LOGI("[%s] Enter", __func__);
+ RADIO_SUPPORT_CHECK(__radio_check_system_info_feature_supported());
+ RADIO_INSTANCE_CHECK(radio);
+
+ radio_s * handle = (radio_s *) radio;
+
+ int ret = mm_radio_get_channel_spacing(handle->mm_handle, channel_spacing);
+
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return RADIO_ERROR_NONE;
+ }
+}
+
+
+