summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGilbok Lee <gilbok.lee@samsung.com>2018-07-16 16:54:12 +0900
committerGilbok Lee <gilbok.lee@samsung.com>2018-08-14 15:18:35 +0900
commitd06767768203168895ae22481b4090121924feb3 (patch)
tree575845ae9f991a3087232787075537f9343c3d0f /include
parent9a6c00f33f08e36fe2d2c060abefd4931261d222 (diff)
downloadmm-hal-interface-d06767768203168895ae22481b4090121924feb3.tar.gz
mm-hal-interface-d06767768203168895ae22481b4090121924feb3.tar.bz2
mm-hal-interface-d06767768203168895ae22481b4090121924feb3.zip
[radio/haltest] Update tizen radio and add radio hal test
1. Modify tizen radio (Remove/Add error type and modify description) 2. Make radio hal test [Version] 0.0.12 [Profile] Common [Issue Type] Add features Change-Id: I04d3e2873a1d5ee14290a1d68cb8fc05008d896e
Diffstat (limited to 'include')
-rw-r--r--include/radio/radio_hal_interface.h61
-rw-r--r--include/radio/tizen-radio.h93
2 files changed, 129 insertions, 25 deletions
diff --git a/include/radio/radio_hal_interface.h b/include/radio/radio_hal_interface.h
new file mode 100644
index 0000000..cb4a1d0
--- /dev/null
+++ b/include/radio/radio_hal_interface.h
@@ -0,0 +1,61 @@
+/*
+ * radio_hal_interface.h
+ *
+ * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "tizen-radio.h"
+
+typedef enum _seek_direction_type {
+ SEEK_DIRECTION_UP, /**< Seek upward */
+ SEEK_DIRECTION_DOWN /**< Seek downward */
+} seek_direction_type_t;
+
+typedef struct _radio_hal_interface {
+ void *dl_handle;
+ void *rh_handle;
+ radio_interface_t intf;
+} radio_hal_interface;
+
+int radio_hal_interface_init(radio_hal_interface **handle);
+int radio_hal_interface_deinit(radio_hal_interface *handle);
+int radio_hal_open(radio_hal_interface *handle);
+int radio_hal_prepare(radio_hal_interface *handle);
+int radio_hal_unprepare(radio_hal_interface *handle);
+int radio_hal_close(radio_hal_interface *handle);
+int radio_hal_start(radio_hal_interface *handle);
+int radio_hal_stop(radio_hal_interface *handle);
+int radio_hal_seek(radio_hal_interface *handle, seek_direction_type_t direction);
+int radio_hal_get_frequency(radio_hal_interface *handle, uint32_t *frequency);
+int radio_hal_set_frequency(radio_hal_interface *handle, uint32_t frequency);
+int radio_hal_get_signal_strength(radio_hal_interface *handle, int32_t *strength);
+int radio_hal_mute(radio_hal_interface *handle);
+int radio_hal_unmute(radio_hal_interface *handle);
+int radio_hal_set_volume(radio_hal_interface *handle, float volume);
+int radio_hal_get_volume(radio_hal_interface *handle, float *volume);
+int radio_hal_set_media_volume(radio_hal_interface *handle, uint32_t level);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/include/radio/tizen-radio.h b/include/radio/tizen-radio.h
index 8f6ce17..bae4851 100644
--- a/include/radio/tizen-radio.h
+++ b/include/radio/tizen-radio.h
@@ -44,7 +44,6 @@ extern "C" {
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,
@@ -52,9 +51,9 @@ typedef enum radio_error {
RADIO_ERROR_DEVICE_NOT_PREPARED,
RADIO_ERROR_DEVICE_NOT_OPENED,
RADIO_ERROR_DEVICE_NOT_FOUND,
- RADIO_ERROR_DEVICE_NOT_SUPPORTED,
RADIO_ERROR_NO_ANTENNA,
RADIO_ERROR_INTERNAL,
+ RADIO_ERROR_NOT_IMPLEMENTED,
RADIO_ERROR_UNKNOWN
} radio_error_t;
@@ -82,25 +81,29 @@ typedef struct radio_interface {
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_error_t (*get_signal_strength)(void *radio_handle, int32_t *strength);
+ radio_error_t (*get_volume)(void *radio_handle, float *volume);
+ radio_error_t (*set_volume)(void *radio_handle, float volume);
+ radio_error_t (*set_media_volume)(void *radio_handle, uint32_t level);
} 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
+ * @param[out] radio_handle A newly returned the radio HAL handle
* @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
+ * @retval #RADIO_ERROR_INVALID_OPERATION Invalid operation
* @see radio_deinit()
*/
radio_error_t radio_init(void **radio_handle);
/**
- * @brief Deinitializes handle of camera HAL.
+ * @brief Deinitializes handle of radio HAL.
* @since_tizen 3.0
- * @param[in] radio_handle The handle to the radio HAL
+ * @param[in] radio_handle The radio HAL handle
* @return @c 0 on success, otherwise a negative error value
* @retval #RADIO_ERROR_NONE Successful
* @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
@@ -111,11 +114,11 @@ 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
+ * @param[in] radio_handle The radio HAL handle
* @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
* @see radio_unprepare()
*/
radio_error_t radio_prepare(void *radio_handle);
@@ -123,10 +126,11 @@ 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
+ * @param[in] radio_handle The radio HAL handle
* @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
* @see radio_prepare()
*/
radio_error_t radio_unprepare(void *radio_handle);
@@ -134,12 +138,12 @@ 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
+ * @param[in] radio_handle The radio HAL handle
* @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_INVALID_OPERATION Invalid operation
* @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()
@@ -149,10 +153,12 @@ 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
+ * @param[in] radio_handle The radio HAL handle
* @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
* @see radio_open()
*/
radio_error_t radio_close(void *radio_handle);
@@ -160,10 +166,11 @@ 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
+ * @param[in] radio_handle The radio HAL handle
* @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_stop()
*/
radio_error_t radio_start(void *radio_handle);
@@ -171,10 +178,11 @@ 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
+ * @param[in] radio_handle The radio HAL handle
* @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_start()
*/
radio_error_t radio_stop(void *radio_handle);
@@ -182,7 +190,7 @@ 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] radio_handle The radio HAL handle
* @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
@@ -195,12 +203,11 @@ radio_error_t radio_seek(void *radio_handle, radio_seek_direction_type_t directi
/**
* @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)
+ * @param[in] radio_handle The radio HAL handle
+ * @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);
@@ -208,12 +215,11 @@ 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)
+ * @param[in] radio_handle The radio HAL handle
+ * @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);
@@ -221,7 +227,7 @@ 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
+ * @param[in] radio_handle The radio HAL handle
* @return @c 0 on success, otherwise a negative error value
* @retval #RADIO_ERROR_NONE Successful
* @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
@@ -232,7 +238,7 @@ 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
+ * @param[in] radio_handle The radio HAL handle
* @return @c 0 on success, otherwise a negative error value
* @retval #RADIO_ERROR_NONE Successful
* @retval #RADIO_ERROR_INVALID_PARAMETER Invalid parameter
@@ -243,14 +249,51 @@ 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[in] radio_handle The radio HAL handle
* @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);
+radio_error_t radio_get_signal_strength(void *radio_handle, int32_t *strength);
+
+/**
+ * @brief Gets the radio's current volume.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The radio HAL handle
+ * @param[out] volume The current radio volume (0.0 ~ 1.0)
+ * @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_volume(void *radio_handle, float *volume);
+
+/**
+ * @brief Sets the current radio's volume.
+ * @since_tizen 3.0
+ * @param[in] radio_handle The radio HAL handle
+ * @param[in] volume The radio volume to set (0.0 ~ 1.0)
+ * @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_set_volume(void *radio_handle, float volume);
+
+/**
+ * @brief Sets the current media volume level(system media volume).
+ * @since_tizen 3.0
+ * @param[in] radio_handle The radio HAL handle
+ * @param[in] level The media volume level to set
+ * @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_set_media_volume(void *radio_handle, uint32_t level);
+
/**
* @}