summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorGilbok Lee <gilbok.lee@samsung.com>2018-08-24 04:28:21 +0000
committerGilbok Lee <gilbok.lee@samsung.com>2018-08-24 04:28:21 +0000
commitc10f1b656c40594b1c55ce5bd0ab833831b68f40 (patch)
treebfd08ba0d338dcd2dcf1b1d1f3ae3a54a524177a /src/include
parentd15d19531cf004eea3b846d50c62c0faf857c9d1 (diff)
downloadlibmm-radio-c10f1b656c40594b1c55ce5bd0ab833831b68f40.tar.gz
libmm-radio-c10f1b656c40594b1c55ce5bd0ab833831b68f40.tar.bz2
libmm-radio-c10f1b656c40594b1c55ce5bd0ab833831b68f40.zip
Revert "Using radio-hal-interface in mm-hal-interface"
This reverts commit d15d19531cf004eea3b846d50c62c0faf857c9d1. Change-Id: I3ef458e8e6cc3713cb33d0c400522eea39a27d9f
Diffstat (limited to 'src/include')
-rw-r--r--src/include/radio_hal_interface.h61
-rw-r--r--src/include/tizen-radio.h307
2 files changed, 368 insertions, 0 deletions
diff --git a/src/include/radio_hal_interface.h b/src/include/radio_hal_interface.h
new file mode 100644
index 0000000..cb4a1d0
--- /dev/null
+++ b/src/include/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/src/include/tizen-radio.h b/src/include/tizen-radio.h
new file mode 100644
index 0000000..494df04
--- /dev/null
+++ b/src/include/tizen-radio.h
@@ -0,0 +1,307 @@
+/*
+ * tizen-radio.h
+ *
+ * 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.
+ *
+ */
+
+#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_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_NO_ANTENNA,
+ RADIO_ERROR_INTERNAL,
+ RADIO_ERROR_NOT_IMPLEMENTED,
+ 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, 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 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 radio HAL.
+ * @since_tizen 3.0
+ * @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
+ * @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 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_unprepare()
+ */
+radio_error_t radio_prepare(void *radio_handle);
+
+/**
+ * @brief Unprepare the device of radio.
+ * @since_tizen 3.0
+ * @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 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_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()
+ */
+radio_error_t radio_open(void *radio_handle);
+
+/**
+ * @brief Closes the device of radio.
+ * @since_tizen 3.0
+ * @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 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 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 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
+ * @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 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_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 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_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 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
+ */
+radio_error_t radio_mute(void *radio_handle);
+
+/**
+ * @brief Unsets the radio's mute
+ * @since_tizen 3.0
+ * @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
+ */
+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 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, 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);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_RADIO_HAL_H__ */
+