From c280ba17fe8e08af92b7476c4baa705e37155bf0 Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 20 Sep 2024 17:30:52 +0800 Subject: [PATCH 1/2] add bluetooth capi Signed-off-by: lee --- ConnectivityKit/bluetooth/BUILD.gn | 29 ++++++ .../bluetooth/libbluetooth.ndk.json | 5 + ConnectivityKit/bluetooth/oh_bluetooth.h | 95 +++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 ConnectivityKit/bluetooth/BUILD.gn create mode 100644 ConnectivityKit/bluetooth/libbluetooth.ndk.json create mode 100644 ConnectivityKit/bluetooth/oh_bluetooth.h diff --git a/ConnectivityKit/bluetooth/BUILD.gn b/ConnectivityKit/bluetooth/BUILD.gn new file mode 100644 index 000000000..869366f31 --- /dev/null +++ b/ConnectivityKit/bluetooth/BUILD.gn @@ -0,0 +1,29 @@ +# Copyright (C) 2024 Huawei Device Co., Ltd. +# 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. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") + +ohos_ndk_headers("bluetooth_ndk_header") { + dest_dir = "$ndk_headers_out_dir/ConnectivityKit/bluetooth" + sources = [ "./oh_bluetooth.h" ] +} + +ohos_ndk_library("libbluetooth_ndk") { + ndk_description_file = "./libbluetooth.ndk.json" + output_name = "bluetooth_ndk" + output_extension = "so" + min_compact_version = "13" + system_capability = "SystemCapability.Communication.Bluetooth.Core" + system_capability_headers = [ "./oh_bluetooth.h" ] +} diff --git a/ConnectivityKit/bluetooth/libbluetooth.ndk.json b/ConnectivityKit/bluetooth/libbluetooth.ndk.json new file mode 100644 index 000000000..d8b21f30c --- /dev/null +++ b/ConnectivityKit/bluetooth/libbluetooth.ndk.json @@ -0,0 +1,5 @@ +[ + { + "name": "OH_Bluetooth_GetBluetoothSwitchState" + } +] \ No newline at end of file diff --git a/ConnectivityKit/bluetooth/oh_bluetooth.h b/ConnectivityKit/bluetooth/oh_bluetooth.h new file mode 100644 index 000000000..cbe820916 --- /dev/null +++ b/ConnectivityKit/bluetooth/oh_bluetooth.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * 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. + */ + +/** + * @addtogroup Bluetooth + * @{ + * + * @brief Provide functions for querying the status of bluetooth switch. + * @since 13 + */ +/** + * @file oh_bluetooth.h + * @kit ConnectivityKit + * @brief Define interfaces for querying bluetooth switch status. + * @library libbluetooth.so + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 13 + */ + +#ifndef OH_BLUETOOTH_H +#define OH_BLUETOOTH_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumeration state of bluetooth switch. + * + * @since 13 + */ +typedef enum Bluetooth_SwitchState { + /** Indicates the local bluetooth is off. */ + BLUETOOTH_STATE_OFF = 0, + /** Indicates the local bluetooth is turning on. */ + BLUETOOTH_STATE_TURNING_ON = 1, + /** Indicates the local bluetooth is on, and ready for use. */ + BLUETOOTH_STATE_ON = 2, + /** Indicates the local bluetooth is turning off. */ + BLUETOOTH_STATE_TURNING_OFF = 3, + /** Indicates the local bluetooth is turning LE mode on. */ + BLUETOOTH_STATE_BLE_TURNING_ON = 4, + /** Indicates the local bluetooth is in LE only mode. */ + BLUETOOTH_STATE_BLE_ON = 5, + /** Indicates the local bluetooth is turning off LE only mode. */ + BLUETOOTH_STATE_BLE_TURNING_OFF = 6 +} Bluetooth_SwitchState; + +/** + * @brief Enumeration the bluetooth result codes. + * + * @since 13 + */ +typedef enum Bluetooth_ResultCode { + /** + * @error The operation is successful. + */ + BLUETOOTH_SUCCESS = 0, + /** + * @error Parameter error. Possible reasons: 1. The input parameter is a null pointer; + * 2. Parameter values exceed the defined range. + */ + BLUETOOTH_INVALID_PARAM = 401, +} Bluetooth_ResultCode; + +/** + * @brief Get the bluetooth switch state. + * + * @param state - It is a pointer used to receive bluetooth switch status values. + * The caller needs to pass in a non empty boolean pointer, otherwise an error will be returned. + * For a detailed definition, please refer to {@link Bluetooth_SwitchState}. + * @return Bluetooth functions result code. + * For a detailed definition, please refer to {@link Bluetooth_ResultCode}. + * {@link BLUETOOTH_SUCCESS} Successfully obtained the bluetooth switch status. + * {@link BLUETOOTH_INVALID_PARAM} The input parameter enabled is a null pointer. + * @since 13 + */ +Bluetooth_ResultCode OH_Bluetooth_GetBluetoothSwitchState(Bluetooth_SwitchState *state); +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // OH_BLUETOOTH_H \ No newline at end of file -- Gitee From 77d2be1233199fcc8c63bf763a366d30cab2bc02 Mon Sep 17 00:00:00 2001 From: m00472246 Date: Wed, 25 Sep 2024 09:05:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9hdi=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=A0=81=E7=9A=84api=E7=89=88=E6=9C=AC=20Signed-off-by:=20m004?= =?UTF-8?q?72246=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: m00472246 --- graphic/graphic_2d/native_window/graphic_error_code.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_window/graphic_error_code.h b/graphic/graphic_2d/native_window/graphic_error_code.h index 1b5e9deb0..9bd9f2ace 100644 --- a/graphic/graphic_2d/native_window/graphic_error_code.h +++ b/graphic/graphic_2d/native_window/graphic_error_code.h @@ -80,7 +80,10 @@ typedef enum OHNativeErrorCode { NATIVE_ERROR_UNSUPPORTED = 50102000, /** @error unknown error, please check log */ NATIVE_ERROR_UNKNOWN = 50002000, - /** @error hdi interface error */ + /** + * @error hdi interface error + * @since 13 + */ NATIVE_ERROR_HDI_ERROR = 50007000, /** @error ipc send failed */ NATIVE_ERROR_BINDER_ERROR = 50401000, -- Gitee