[Radio] Initial release for radio HAL 49/73949/4 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable accepted/tizen_3.0_common accepted/tizen_3.0_ivi accepted/tizen_3.0_mobile accepted/tizen_3.0_tv accepted/tizen_3.0_wearable accepted/tizen_4.0_unified accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable tizen_3.0.m2 tizen_3.0_tv tizen_4.0 tizen_4.0_tv accepted/tizen/3.0.m2/mobile/20170104.125433 accepted/tizen/3.0.m2/tv/20170104.125642 accepted/tizen/3.0.m2/wearable/20170104.125905 accepted/tizen/3.0/common/20161114.105827 accepted/tizen/3.0/ivi/20161011.055428 accepted/tizen/3.0/mobile/20161015.033657 accepted/tizen/3.0/tv/20161016.005501 accepted/tizen/3.0/wearable/20161015.083718 accepted/tizen/4.0/unified/20170816.013407 accepted/tizen/4.0/unified/20170829.020054 accepted/tizen/common/20160805.130149 accepted/tizen/ivi/20160808.081149 accepted/tizen/mobile/20160808.080807 accepted/tizen/tv/20160808.080959 accepted/tizen/unified/20170309.033313 accepted/tizen/wearable/20160808.081100 submit/tizen/20160805.054353 submit/tizen_3.0.m2/20170104.093750 submit/tizen_3.0_common/20161104.104000 submit/tizen_3.0_ivi/20161010.000005 submit/tizen_3.0_mobile/20161015.000004 submit/tizen_3.0_tv/20161015.000004 submit/tizen_3.0_wearable/20161015.000004 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170828.100004 submit/tizen_4.0/20170828.110004 submit/tizen_unified/20170308.100408 tizen_4.0.IoT.p1_release tizen_4.0.IoT.p2_release tizen_4.0.m1_release tizen_4.0.m2_release
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 5 Jul 2016 06:15:09 +0000 (15:15 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Tue, 19 Jul 2016 07:22:22 +0000 (16:22 +0900)
Change-Id: I06f3bfcbeee7f67fb1b673eab9992db65a44288e
Signed-off-by: Gilbok Lee <gilbok.lee@samsung.com>
radio/tizen-radio.h

index bdb04e6..c2bbadb 100644 (file)
  *
  */
 
+#ifndef __TIZEN_RADIO_HAL_H__
+#define __TIZEN_RADIO_HAL_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file tizen-radio.h
+ * @brief This file contains the Tizen radio HAL API, related structures and enumerations.
+ * @since_tizen 3.0
+ */
+
+/**
+ * @addtogroup TIZEN_RADIO_HAL_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for the radio error.
+ * @since_tizen 3.0
+ */
+typedef enum radio_error {
+       RADIO_ERROR_NONE,
+       RADIO_ERROR_INVALID_PARAMETER,
+       RADIO_ERROR_INVALID_STATE,
+       RADIO_ERROR_INVALID_OPERATION,
+       RADIO_ERROR_PERMISSION_DENIED,
+       RADIO_ERROR_NOT_SUPPORTED,
+       RADIO_ERROR_OUT_OF_MEMORY,
+       RADIO_ERROR_DEVICE_NOT_PREPARED,
+       RADIO_ERROR_DEVICE_NOT_OPENED,
+       RADIO_ERROR_DEVICE_NOT_FOUND,
+       RADIO_ERROR_DEVICE_NOT_SUPPORTED,
+       RADIO_ERROR_INTERNAL,
+       RADIO_ERROR_UNKNOWN
+} radio_error_t;
+
+/**
+ * @brief Enumeration for the radio seek direction.
+ * @since_tizen 3.0
+ */
+typedef enum radio_seek_direction_type {
+       RADIO_SEEK_DIRECTION_UP,        /**< Seek upward */
+       RADIO_SEEK_DIRECTION_DOWN       /**< Seek downward */
+} radio_seek_direction_type_t;
+
+typedef struct radio_interface {
+       /* create & destroy */
+       radio_error_t (*init)(void **radio_hanle);
+       radio_error_t (*deinit)(void *radio_handle);
+       radio_error_t (*prepare)(void *radio_handle);
+       radio_error_t (*unprepare)(void *radio_handle);
+       radio_error_t (*open)(void *radio_handle);
+       radio_error_t (*close)(void *radio_handle);
+       radio_error_t (*start)(void *radio_handle);
+       radio_error_t (*stop)(void *radio_handle);
+       radio_error_t (*seek)(void *radio_handle, radio_seek_direction_type_t direction);
+       radio_error_t (*get_frequency)(void *radio_handle, uint32_t *frequency);
+       radio_error_t (*set_frequency)(void *radio_handle, uint32_t frequency);
+       radio_error_t (*mute)(void *radio_handle);
+       radio_error_t (*unmute)(void *radio_handle);
+       radio_error_t (*get_signal_strength)(void *radio_handle, uint32_t *strength);
+} radio_interface_t;
+
+/**
+ * @brief Initializes new handle of radio HAL.
+ * @since_tizen 3.0
+ * @param[out] radio_handle A newly returned handle to the radio HAL
+ * @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_OUT_OF_MEMORY Out of memory
+ * @see radio_deinit()
+ */
+radio_error_t radio_init(void **radio_handle);
+
+/**
+ * @brief Deinitializes handle of camera HAL.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RADIO_ERROR_NONE Successful
+ * @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see radio_init()
+ */
+radio_error_t radio_deinit(void *radio_handle);
+
+/**
+ * @brief Prepare the device of radio.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @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_DEVICE_NOT_OPENED The radio device is not opened
+ * @see radio_unprepare()
+ */
+radio_error_t radio_prepare(void *radio_handle);
+
+/**
+ * @brief Unprepare the device of radio.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RADIO_ERROR_NONE Successful
+ * @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see radio_prepare()
+ */
+radio_error_t radio_unprepare(void *radio_handle);
+
+/**
+ * @brief Opens the device of radio.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @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_DEVICE_NOT_FOUND Failed to find radio device
+ * @retval #RADIO_ERROR_DEVICE_NOT_OPENED The radio device is not opened
+ * @retval #RADIO_ERROR_PERMISSION_DENIED The access to the resources can not be granted.
+ * @retval #RADIO_ERROR_DEVICE_NOT_PREPARED Not prepared the radio device
+ * @see radio_close()
+ */
+radio_error_t radio_open(void *radio_handle);
+
+/**
+ * @brief Closes the device of radio.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RADIO_ERROR_NONE Successful
+ * @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see radio_open()
+ */
+radio_error_t radio_close(void *radio_handle);
+
+/**
+ * @brief Starts the device of radio.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RADIO_ERROR_NONE Successful
+ * @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see radio_stop()
+ */
+radio_error_t radio_start(void *radio_handle);
+
+/**
+ * @brief Stops the device of radio.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RADIO_ERROR_NONE Successful
+ * @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see radio_start()
+ */
+radio_error_t radio_stop(void *radio_handle);
+
+/**
+ * @brief Seeks (up or down) the effective frequency of the radio.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @param[in] direction The seek direction type (up or down)
+ * @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_DEVICE_NOT_OPENED The radio device is not opened
+ * @retval #RADIO_ERROR_INVALID_OPERATION Invalid operation
+ */
+radio_error_t radio_seek(void *radio_handle, radio_seek_direction_type_t direction);
+
+/**
+ * @brief Gets the radio frequency.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @param[out] frequency The current frequency (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_DEVICE_NOT_OPENED The radio device is not opened
+ * @retval #RADIO_ERROR_INVALID_OPERATION Invalid operation
+ */
+radio_error_t radio_get_frequency(void *radio_handle, uint32_t *frequency);
+
+/**
+ * @brief Sets the radio frequency.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @param[in] frequency The frequency to set (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_DEVICE_NOT_OPENED The radio device is not opened
+ * @retval #RADIO_ERROR_INVALID_OPERATION Invalid operation
+ */
+radio_error_t radio_set_frequency(void *radio_handle, uint32_t frequency);
+
+/**
+ * @brief Sets the radio's mute
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @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
+ */
+radio_error_t radio_mute(void *radio_handle);
+
+/**
+ * @brief Unsets the radio's mute
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @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
+ */
+radio_error_t radio_unmute(void *radio_handle);
+
+/**
+ * @brief Gets the current signal strength of the radio
+ * @since_tizen 3.0
+ * @param[in] radio_handle The handle to the radio HAL
+ * @param[out] strength The current signal strength (dBm)
+ * @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
+ */
+radio_error_t radio_get_signal_strength(void *radio_handle, uint32_t *strength);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_RADIO_HAL_H__ */
+