From: Wootak Jung Date: Tue, 10 Dec 2024 03:22:49 +0000 (+0900) Subject: Add document and update doxygen X-Git-Tag: accepted/tizen/unified/x/20250117.125253^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_unified;p=platform%2Fhal%2Fapi%2Fbluetooth.git Add document and update doxygen Change-Id: I2ebcc0977549355c40b1f1e949f923e11c70d06f Signed-off-by: Wootak Jung --- diff --git a/doc/hal_bluetooth_doc.h b/doc/hal_bluetooth_doc.h new file mode 100644 index 0000000..1eec7d3 --- /dev/null +++ b/doc/hal_bluetooth_doc.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 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_HAL_BLUETOOTH_DOC_H__ +#define __TIZEN_HAL_BLUETOOTH_DOC_H__ + + +/** + * @file hal_bluetooth_doc.h + * @brief This file contains high level documentation of the HAL Bluetooth. + */ + +/** + * @defgroup HALAPI_HAL_BLUETOOTH_MODULE Bluetooth + * @brief The @ref HALAPI_HAL_BLUETOOTH_MODULE provides functions to enable and disable the HCI interface. + * + * @section HALAPI_HAL_BLUETOOTH_MODULE_HEADER Required Header + * \#include + * + * @section HALAPI_HAL_BLUETOOTH_MODULE_OVERVIEW Overview + * The Bluetooth provides to get/put backend and enable/disable HCI interface. + * - hal_bluetooth_get_backend + * - hal_bluetooth_put_backend + * - hal_bluetooth_start + * - hal_bluetooth_stop + * + * For more information on the Bluetooth features and the macros, see HAL Bluetooth programming guides and tutorials. + */ + +#endif /* __TIZEN_HAL_BLUETOOTH_DOC_H__ */ + diff --git a/include/hal-bluetooth-interface-1.h b/include/hal-bluetooth-interface-1.h index 30120e0..d1db15e 100644 --- a/include/hal-bluetooth-interface-1.h +++ b/include/hal-bluetooth-interface-1.h @@ -25,15 +25,47 @@ extern "C" { #endif -#define HAL_BACKEND_ERROR_NONE 0 -#define HAL_BACKEND_ERROR_INTERNAL -1 -#define HAL_BACKEND_ERROR_TIMEOUT -2 +/** + * @addtogroup HALAPI_HAL_BLUETOOTH_MODULE + * @{ + */ + +/** + * @brief Structure for bluetooth functions. + * @since HAL_MODULE_BLUETOOTH 1.0 + */ + +/** + * @brief Error none + * @since HAL_MODULE_BLUETOOTH 1.0 + */ +#define HAL_BLUETOOTH_BACKEND_ERROR_NONE 0 + +/** + * @brief Internal error + * @since HAL_MODULE_BLUETOOTH 1.0 + */ +#define HAL_BLUETOOTH_BACKEND_ERROR_INTERNAL -1 + +/** + * @brief Timeout error + * @since HAL_MODULE_BLUETOOTH 1.0 + */ +#define HAL_BLUETOOTH_BACKEND_ERROR_TIMEOUT -2 +/** + * @brief The structure type of the bluetooth HAL functions. + * @since HAL_MODULE_BLUETOOTH 1.0 + */ typedef struct _hal_backend_bluetooth_funcs { - int (*start)(void); - int (*stop)(void); + int (*start)(void); /**< Start Bluetooth HAL backend */ + int (*stop)(void); /**< Stop Bluetooth HAL backend */ } hal_backend_bluetooth_funcs; +/** + * @} + */ + #ifdef __cplusplus } #endif diff --git a/include/hal-bluetooth.h b/include/hal-bluetooth.h index 427b9e9..15a22bf 100644 --- a/include/hal-bluetooth.h +++ b/include/hal-bluetooth.h @@ -23,13 +23,51 @@ extern "C" { #endif +/** + * @addtogroup HALAPI_HAL_BLUETOOTH_MODULE + * @{ + */ + +/** + * @brief Gets the bluetooth backend + * @since HAL_MODULE_BLUETOOTH 1.0 + * @return @c 0 on success, + * otherwise a negative error value + * @see hal_bluetooth_put_backend() + */ int hal_bluetooth_get_backend(void); + +/** + * @brief Puts the bluetooth backend + * @since HAL_MODULE_BLUETOOTH 1.0 + * @return @c 0 on success, + * otherwise a negative error value + * @see hal_bluetooth_get_backend() + */ int hal_bluetooth_put_backend(void); +/** + * @brief Start the bluetooth backend + * @since HAL_MODULE_BLUETOOTH 1.0 + * @return @c 0 on success, + * otherwise a negative error value + * @see hal_bluetooth_stop() + */ int hal_bluetooth_start(void); +/** + * @brief Stop the bluetooth backend + * @since HAL_MODULE_BLUETOOTH 1.0 + * @return @c 0 on success, + * otherwise a negative error value + * @see hal_bluetooth_start() + */ int hal_bluetooth_stop(void); +/** + * @} + */ + #ifdef __cplusplus } #endif diff --git a/test/bluetooth_hal_tc.cpp b/test/bluetooth_hal_tc.cpp index c855511..fa46db1 100644 --- a/test/bluetooth_hal_tc.cpp +++ b/test/bluetooth_hal_tc.cpp @@ -38,33 +38,33 @@ using ::testing::TestPartResult; using ::testing::UnitTest; TEST(BluetoothHALtest, bluetooth_get_put_backend_p) { - int ret = HAL_BACKEND_ERROR_NONE; + int ret = HAL_BLUETOOTH_BACKEND_ERROR_NONE; ret = hal_bluetooth_get_backend(); - ASSERT_TRUE(ret == HAL_BACKEND_ERROR_NONE); + ASSERT_TRUE(ret == HAL_BLUETOOTH_BACKEND_ERROR_NONE); ret = hal_bluetooth_put_backend(); - ASSERT_TRUE(ret == HAL_BACKEND_ERROR_NONE); + ASSERT_TRUE(ret == HAL_BLUETOOTH_BACKEND_ERROR_NONE); } TEST(BluetoothHALtest, bluetooth_start_p) { - int ret = HAL_BACKEND_ERROR_NONE; + int ret = HAL_BLUETOOTH_BACKEND_ERROR_NONE; ret = hal_bluetooth_get_backend(); - ASSERT_TRUE(ret == HAL_BACKEND_ERROR_NONE); + ASSERT_TRUE(ret == HAL_BLUETOOTH_BACKEND_ERROR_NONE); ret = hal_bluetooth_start(); - ASSERT_TRUE(ret == HAL_BACKEND_ERROR_NONE); + ASSERT_TRUE(ret == HAL_BLUETOOTH_BACKEND_ERROR_NONE); } TEST(BluetoothHALtest, bluetooth_stop_p) { - int ret = HAL_BACKEND_ERROR_NONE; + int ret = HAL_BLUETOOTH_BACKEND_ERROR_NONE; ret = hal_bluetooth_get_backend(); - ASSERT_TRUE(ret == HAL_BACKEND_ERROR_NONE); + ASSERT_TRUE(ret == HAL_BLUETOOTH_BACKEND_ERROR_NONE); ret = hal_bluetooth_stop(); - ASSERT_TRUE(ret == HAL_BACKEND_ERROR_NONE); + ASSERT_TRUE(ret == HAL_BLUETOOTH_BACKEND_ERROR_NONE); } int main(int argc, char **argv) {