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_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;
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
/**
* @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);
/**
* @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);
/**
* @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()
/**
* @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);
/**
* @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);
/**
* @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);
/**
* @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
/**
* @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);
/**
* @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);
/**
* @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
/**
* @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
/**
* @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);
+
/**
* @}
--- /dev/null
+/*
+ * radio_hal_interface.c
+ *
+ * Copyright (c) 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 /* __cplusplus */
+
+#include <dlfcn.h>
+#include <dlog.h>
+
+#include "radio_hal_interface.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif /* LOG_TAG */
+
+#define LOG_TAG "RADIO_HAL_INTF"
+
+#define LIB_TIZEN_RADIO PATH_LIBDIR"/libtizen-radio.so"
+
+#define RADIO_INTF_CHECK_ARG(x_radio) \
+do { \
+ if (!x_radio) { \
+ LOGE("argument is NULL\n"); \
+ return RADIO_ERROR_INVALID_PARAMETER; \
+ } \
+} while (0)
+
+int radio_hal_interface_init(radio_hal_interface **handle)
+{
+ radio_hal_interface *h = NULL;
+ int ret = RADIO_ERROR_NONE;
+ h = (radio_hal_interface *)malloc(sizeof(radio_hal_interface));
+
+ if (!h) {
+ LOGE("cannot allocate memory for radio_hal interface");
+ return RADIO_ERROR_OUT_OF_MEMORY;
+ }
+
+ h->dl_handle = dlopen(LIB_TIZEN_RADIO, RTLD_NOW);
+
+ if (h->dl_handle) {
+ h->intf.init = dlsym(h->dl_handle, "radio_init");
+ h->intf.deinit = dlsym(h->dl_handle, "radio_deinit");
+ h->intf.prepare = dlsym(h->dl_handle, "radio_prepare");
+ h->intf.unprepare = dlsym(h->dl_handle, "radio_unprepare");
+ h->intf.open = dlsym(h->dl_handle, "radio_open");
+ h->intf.close = dlsym(h->dl_handle, "radio_close");
+ h->intf.start = dlsym(h->dl_handle, "radio_start");
+ h->intf.stop = dlsym(h->dl_handle, "radio_stop");
+ h->intf.seek = dlsym(h->dl_handle, "radio_seek");
+ h->intf.get_frequency = dlsym(h->dl_handle, "radio_get_frequency");
+ h->intf.set_frequency = dlsym(h->dl_handle, "radio_set_frequency");
+ h->intf.mute = dlsym(h->dl_handle, "radio_mute");
+ h->intf.unmute = dlsym(h->dl_handle, "radio_unmute");
+ h->intf.get_signal_strength = dlsym(h->dl_handle, "radio_get_signal_strength");
+ h->intf.get_volume = dlsym(h->dl_handle, "radio_get_volume");
+ h->intf.set_volume = dlsym(h->dl_handle, "radio_set_volume");
+ h->intf.set_media_volume = dlsym(h->dl_handle, "radio_set_media_volume");
+
+ if (h->intf.init == NULL || h->intf.deinit == NULL) {
+ LOGE("could not get mandatory funtion");
+ goto FAIL;
+ }
+
+ ret = h->intf.init(&h->rh_handle);
+ if (ret != RADIO_ERROR_NONE) {
+ LOGE("radio_hal init failed %d", ret);
+ goto FAIL;
+ }
+
+ } else {
+ LOGE("open radio hal_interface failed : %s", dlerror());
+ ret = RADIO_ERROR_INTERNAL;
+ goto FAIL;
+ }
+
+ *handle = h;
+
+ LOGD("open radio_hal interface");
+
+ return ret;
+FAIL:
+ if (h) {
+ if (h->dl_handle)
+ dlclose(h->dl_handle);
+ free(h);
+ }
+
+ return ret;
+}
+
+int radio_hal_interface_deinit(radio_hal_interface *handle)
+{
+ int ret = RADIO_ERROR_NONE;
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (handle->dl_handle) {
+ ret = handle->intf.deinit(handle->rh_handle);
+ if (ret != RADIO_ERROR_NONE)
+ return ret;
+
+ handle->rh_handle = NULL;
+
+ LOGD("close radio_hal interface");
+ dlclose(handle->dl_handle);
+ handle->dl_handle = NULL;
+ }
+
+ free(handle);
+ handle = NULL;
+
+ return ret;
+}
+
+int radio_hal_open(radio_hal_interface *handle)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.open) {
+ LOGW("radio_hal open is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.open(handle->rh_handle);
+}
+
+int radio_hal_prepare(radio_hal_interface *handle)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.prepare) {
+ LOGW("radio_hal prepare is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.prepare(handle->rh_handle);
+}
+
+int radio_hal_unprepare(radio_hal_interface *handle)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.unprepare) {
+ LOGW("radio_hal unprepare is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.unprepare(handle->rh_handle);
+}
+
+
+int radio_hal_close(radio_hal_interface *handle)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.close) {
+ LOGW("radio_hal close is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.close(handle->rh_handle);
+}
+
+int radio_hal_start(radio_hal_interface *handle)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.start) {
+ LOGW("radio_hal start is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.start(handle->rh_handle);
+}
+
+int radio_hal_stop(radio_hal_interface *handle)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.stop) {
+ LOGW("radio_hal stop is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.stop(handle->rh_handle);
+}
+
+
+int radio_hal_seek(radio_hal_interface *handle, seek_direction_type_t direction)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.seek) {
+ LOGW("radio_hal seek is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.seek(handle->rh_handle, (radio_seek_direction_type_t)direction);
+}
+
+int radio_hal_get_frequency(radio_hal_interface *handle, uint32_t *frequency)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.get_frequency) {
+ LOGW("radio_hal get_frequency is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.get_frequency(handle->rh_handle, frequency);
+}
+
+int radio_hal_set_frequency(radio_hal_interface *handle, uint32_t frequency)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.set_frequency) {
+ LOGW("radio_hal set_frequency is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.set_frequency(handle->rh_handle, frequency);
+}
+
+int radio_hal_get_signal_strength(radio_hal_interface *handle, int32_t *strength)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.get_signal_strength) {
+ LOGW("radio_hal get_signal_strength is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.get_signal_strength(handle->rh_handle, strength);
+}
+
+int radio_hal_mute(radio_hal_interface *handle)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.mute) {
+ LOGW("radio_hal mute is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.mute(handle->rh_handle);
+}
+
+int radio_hal_unmute(radio_hal_interface *handle)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.unmute) {
+ LOGW("radio_hal unmute is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.unmute(handle->rh_handle);
+}
+
+int radio_hal_set_volume(radio_hal_interface *handle, float volume)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.set_volume) {
+ LOGW("radio_hal set_volume is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.set_volume(handle->rh_handle, volume);
+}
+
+int radio_hal_get_volume(radio_hal_interface *handle, float *volume)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.get_volume) {
+ LOGW("radio_hal get_volume is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.get_volume(handle->rh_handle, volume);
+}
+
+int radio_hal_set_media_volume(radio_hal_interface *handle, uint32_t level)
+{
+ RADIO_INTF_CHECK_ARG(handle);
+
+ if (!handle->intf.set_media_volume) {
+ LOGW("radio_hal set_media_volume is NULL");
+ return RADIO_ERROR_NOT_IMPLEMENTED;
+ }
+
+ return handle->intf.set_media_volume(handle->rh_handle, level);
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Gilbok Lee <gilbok.lee@samsung.com>
+ *
+ * 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.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+#include <iostream>
+#include <system_info.h>
+#include <radio_hal_interface.h>
+
+using namespace std;
+
+int ret;
+
+radio_hal_interface *h;
+
+GMutex msg_cb_lock;
+GCond msg_cb_cond;
+
+bool radio_supported;
+
+#define RADIO_SUPPORT_CHECK \
+do {\
+ if (!radio_supported) {\
+ cout << "RADIO NOT SUPPORTED" << endl;\
+ return;\
+ }\
+} while (0)
+
+/*
+ * main class
+ */
+class RadioHalTest : public testing::Test
+{
+ public:
+ virtual void SetUp()
+ {
+ radio_supported = false;
+
+ system_info_get_platform_bool("http://tizen.org/feature/fmradio", &radio_supported);
+
+ ret = radio_hal_interface_init(&h);
+ if (ret != RADIO_ERROR_NONE) {
+ cout << "radio hal init failed " << ret << endl;
+ return;
+ }
+
+ return;
+ }
+
+ virtual void TearDown()
+ {
+ if (h) {
+ ret = radio_hal_interface_deinit(h);
+ h = nullptr;
+ }
+
+ return;
+ }
+};
+
+/**
+ * @testcase InitP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Initializes radio HAL handle
+ * @apicovered radio_init
+ * @passcase when radio_init returns RADIO_ERROR_NONE and the handle "h" is not a NULL pointer
+ * @failcase when handle "h" is a NULL pointer
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, InitP)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+}
+
+/**
+ * @testcase DeinitP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Deinitializes radio HAL handle
+ * @apicovered radio_init, radio_deinit
+ * @passcase when radio_dedeinit returns RADIO_ERROR_NONE
+ * @failcase when radio_init does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, DeinitP)
+{
+ radio_hal_interface *hal_handle = nullptr;
+
+ RADIO_SUPPORT_CHECK;
+
+ ret = radio_hal_interface_init(&hal_handle);
+
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+ EXPECT_NE(hal_handle, nullptr);
+
+ ret = radio_hal_interface_deinit(hal_handle);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+ hal_handle = nullptr;
+}
+
+/**
+ * @testcase PrepareDeviceP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Prepares device for device open
+ * @apicovered radio_prepare
+ * @passcase when radio_prepare returns RADIO_ERROR_NONE
+ * @failcase when radio_prepare does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, PrepareDeviceP)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase PrepareDeviceN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Prepares device for device open
+ * @apicovered radio_prepare
+ * @passcase when radio_prepare returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_prepare does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, PrepareDeviceN)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+}
+
+/**
+ * @testcase UnprepareDeviceP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Unprepares device for device open
+ * @apicovered radio_prepare, radio_unprepare
+ * @passcase when radio_unprepare returns RADIO_ERROR_NONE
+ * @failcase when radio_unprepare does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, UnprepareDeviceP)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_unprepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+}
+
+/**
+ * @testcase UnprepareDeviceN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Prepares device for device open
+ * @apicovered radio_prepare, radio_unprepare
+ * @passcase when radio_unprepare returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_unprepare does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, UnprepareDeviceN)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_unprepare(nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase OpenDeviceP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Opens radio device
+ * @apicovered radio_prepare, radio_open
+ * @passcase when radio_open returns RADIO_ERROR_NONE
+ * @failcase when radio_open does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, OpenDeviceP)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_close(h);
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase OpenDeviceN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Opens radio device
+ * @apicovered radio_prepare, radio_open
+ * @passcase when radio_open returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_open does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, OpenDeviceN)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase CloseDeviceP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Closes radio device
+ * @apicovered radio_prepare, radio_open, radio_close
+ * @passcase when radio_close returns RADIO_ERROR_NONE
+ * @failcase when radio_close does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, CloseDeviceP)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_close(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase CloseDeviceN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Closes radio device
+ * @apicovered radio_prepare, radio_open, radio_close
+ * @passcase when radio_close returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_close does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, CloseDeviceN)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_close(nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase StartP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Starts radio
+ * @apicovered radio_prepare, radio_open, radio_start
+ * @passcase when radio_start returns RADIO_ERROR_NONE
+ * @failcase when radio_start does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, StartP)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase StartN1
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Starts radio
+ * @apicovered radio_prepare, radio_open, radio_start
+ * @passcase when radio_start returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_start does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, StartN1)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase StartN2
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Starts radio
+ * @apicovered radio_start
+ * @passcase when radio_start returns RADIO_ERROR_DEVICE_NOT_OPENED
+ * @failcase when radio_start does not return RADIO_ERROR_DEVICE_NOT_OPENED
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, StartN2)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_DEVICE_NOT_OPENED);
+}
+
+/**
+ * @testcase StopP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Stops radio
+ * @apicovered radio_prepare, radio_open, radio_start, radio_stop
+ * @passcase when radio_stop returns RADIO_ERROR_NONE
+ * @failcase when radio_stop does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, StopP)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_stop(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase StopN1
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Stops radio
+ * @apicovered radio_prepare, radio_open, radio_start, radio_stop
+ * @passcase when radio_stop returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_stop does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, StopN1)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_stop(nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase StopN2
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Stops radio
+ * @apicovered radio_stop
+ * @passcase when radio_stop returns RADIO_ERROR_DEVICE_NOT_OPENED
+ * @failcase when radio_stop does not return RADIO_ERROR_DEVICE_NOT_OPENED
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, StopN2)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_stop(h);
+ EXPECT_EQ(ret, RADIO_ERROR_DEVICE_NOT_OPENED);
+}
+
+/**
+ * @testcase SetFrequencyP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Sets radio frequency
+ * @apicovered radio_prepare, radio_open, radio_start, radio_stop, radio_set_frequency
+ * @passcase when radio_set_frequency returns RADIO_ERROR_NONE
+ * @failcase when radio_set_frequency does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SetFrequencyP)
+{
+ uint32_t freq = 95900;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase SetFrequencyN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Sets radio frequency
+ * @apicovered radio_prepare, radio_open, radio_start, radio_stop, radio_set_frequency
+ * @passcase when radio_set_frequency returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_set_frequency does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SetFrequencyN)
+{
+ uint32_t freq = 100;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase GetFrequencyP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Gets radio frequency
+ * @apicovered radio_prepare, radio_open, radio_start, radio_stop, radio_set_frequency, radio_get_frequency
+ * @passcase when radio_get_frequency returns RADIO_ERROR_NONE and result is same with previous set frequecny
+ * @failcase when radio_get_frequency does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, GetFrequencyP)
+{
+ uint32_t freq = 95900;
+ uint32_t getfreq = 0;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_get_frequency(h, &getfreq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+ EXPECT_EQ(freq, getfreq);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase GetFrequencyN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Gets radio frequency
+ * @apicovered radio_prepare, radio_open, radio_start, radio_get_frequency
+ * @passcase when radio_get_frequency returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_get_frequency does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, GetFrequencyN)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_get_frequency(h, NULL);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase SeekUpP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Seeks up frequency
+ * @apicovered radio_prepare, radio_open, radio_set_frequency, radio_seek, radio_get_frequency
+ * @passcase when radio_seek returns RADIO_ERROR_NONE and the result frequency is higher than the previous set frequency.
+ * @failcase when radio_seek does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SeekUpP)
+{
+ uint32_t freq = 87500;
+ uint32_t getfreq = 0;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_seek(h, SEEK_DIRECTION_UP);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_get_frequency(h, &getfreq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+ EXPECT_LT(freq, getfreq);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase SeekUpP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Seeks up frequency
+ * @apicovered radio_prepare, radio_open, radio_set_frequency, radio_seek, radio_get_frequency
+ * @passcase when radio_seek returns RADIO_ERROR_NONE and the result frequency is lower than the previous set frequency.
+ * @failcase when radio_seek does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SeekDownP)
+{
+ uint32_t freq = 108000;
+ uint32_t getfreq = 0;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_seek(h, SEEK_DIRECTION_DOWN);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_get_frequency(h, &getfreq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+ EXPECT_GT(freq, getfreq);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase SeekN1
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Seeks up frequency
+ * @apicovered radio_prepare, radio_open, radio_set_frequency, radio_seek
+ * @passcase when radio_seek returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_seek does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SeekN)
+{
+ uint32_t freq = 95900;
+
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_seek(nullptr, SEEK_DIRECTION_UP);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase SeekN2
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Seeks up frequency
+ * @apicovered radio_seek
+ * @passcase when radio_seek returns RADIO_ERROR_DEVICE_NOT_OPENED
+ * @failcase when radio_seek does not return RADIO_ERROR_DEVICE_NOT_OPENED
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SeekN2)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_seek(h, SEEK_DIRECTION_UP);
+ EXPECT_EQ(ret, RADIO_ERROR_DEVICE_NOT_OPENED);
+}
+
+/**
+ * @testcase MuteP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Mutes radio
+ * @apicovered radio_prepare, radio_open, radio_set_frequency, radio_mute
+ * @passcase when radio_mute returns RADIO_ERROR_NONE
+ * @failcase when radio_mute does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, MuteP)
+{
+ uint32_t freq = 95900;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_mute(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase MuteP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Mutes radio
+ * @apicovered radio_prepare, radio_open, radio_set_frequency, radio_mute
+ * @passcase when radio_mute returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_mute does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, MuteN)
+{
+ uint32_t freq = 95900;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_mute(nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase UnMuteP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Unmutes radio
+ * @apicovered radio_prepare, radio_open, radio_set_frequency, radio_unmute
+ * @passcase when radio_seek returns RADIO_ERROR_NONE
+ * @failcase when radio_seek does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, UnMuteP)
+{
+ uint32_t freq = 95900;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_unmute(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase UnMuteN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Unmutes radio
+ * @apicovered radio_prepare, radio_open, radio_set_frequency, radio_unmute
+ * @passcase when radio_unmute returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_unmute does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, UnMuteN)
+{
+ uint32_t freq = 95900;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_unmute(NULL);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase GetSignalStrengthP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Gets the radio signal strength
+ * @apicovered radio_prepare, radio_open, radio_start, radio_get_signal_strength
+ * @passcase when radio_get_signal_strength returns RADIO_ERROR_NONE
+ * @failcase when radio_get_signal_strength does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, GetSignalStrengthP)
+{
+ int32_t getSignal = 0;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_get_signal_strength(h, &getSignal);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase GetSignalStrengthN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Gets the radio signal strength
+ * @apicovered radio_prepare, radio_open, radio_start, radio_get_signal_strength
+ * @passcase when radio_get_signal_strength returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_get_signal_strength does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, GetSignalStrengthN)
+{
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_get_signal_strength(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase SetVolumeP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Sets the radio volume
+ * @apicovered radio_prepare, radio_open, radio_start, radio_set_freqeuncy, radio_set_volume
+ * @passcase when radio_set_volume returns RADIO_ERROR_NONE
+ * @failcase when radio_set_volume does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SetVolumeP)
+{
+ uint32_t freq = 95900;
+ float vol = 0.5;
+
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_volume(h, vol);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase SetVolumeN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Sets the radio volume
+ * @apicovered radio_prepare, radio_open, radio_start, radio_set_freqeuncy, radio_set_volume
+ * @passcase when radio_set_volume returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_set_volume does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SetVolumeN)
+{
+ uint32_t freq = 95900;
+ float vol = 0.5;
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_volume(nullptr, vol);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase GetVolumeP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Gets the radio volume
+ * @apicovered radio_prepare, radio_open, radio_start, radio_set_freqeuncy, radio_set_volume, radio_get_volume
+ * @passcase when radio_set_volume returns RADIO_ERROR_NONE and result is same with previous set volume
+ * @failcase when radio_set_volume does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, GetVolumeP)
+{
+ uint32_t freq = 95900;
+ float vol = 0.5;
+ float getVol = 0;
+
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_volume(h, vol);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_get_volume(h, &getVol);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+ EXPECT_EQ(vol, getVol);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase GetVolumeP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Negative, Gets the radio volume
+ * @apicovered radio_prepare, radio_open, radio_start, radio_set_freqeuncy, radio_set_volume, radio_get_volume
+ * @passcase when radio_set_volume returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_set_volume does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, GetVolumeN)
+{
+ uint32_t freq = 95900;
+ float getVol = 0;
+
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_get_volume(nullptr, &getVol);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase SetMediaVolumeP
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Sets the media volume in radio
+ * @apicovered radio_prepare, radio_open, radio_start, radio_set_freqeuncy, radio_set_media_volume
+ * @passcase when radio_set_volume returns RADIO_ERROR_NONE
+ * @failcase when radio_set_volume does not return RADIO_ERROR_NONE
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SetMediaVolumeP)
+{
+ uint32_t freq = 95900;
+ int level = 5;
+
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_media_volume(h, level);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+/**
+ * @testcase SetMediaVolumeN
+ * @sizen_tizen 5.0
+ * @author SR(gilbok.lee)
+ * @reviewer SR(eunhae1.choi)
+ * @type auto
+ * @description Positive, Sets the media volume in radio
+ * @apicovered radio_prepare, radio_open, radio_start, radio_set_freqeuncy, radio_set_media_volume
+ * @passcase when radio_set_volume returns RADIO_ERROR_INVALID_PARAMETER
+ * @failcase when radio_set_volume does not return RADIO_ERROR_INVALID_PARAMETER
+ * @precondition None
+ * @postcondition None
+ */
+TEST_F(RadioHalTest, SetMediaVolumeN)
+{
+ uint32_t freq = 95900;
+ int level = 5;
+
+ RADIO_SUPPORT_CHECK;
+
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_prepare(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_open(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_start(h);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_frequency(h, freq);
+ EXPECT_EQ(ret, RADIO_ERROR_NONE);
+
+ ret = radio_hal_set_media_volume(nullptr, level);
+ EXPECT_EQ(ret, RADIO_ERROR_INVALID_PARAMETER);
+
+ radio_hal_stop(h);
+
+ radio_hal_close(h);
+
+ radio_hal_unprepare(h);
+}
+
+int main(int argc, char **argv)
+{
+ testing::InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}