1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup Bluetooth 18 * @{ 19 * 20 * @brief Provide functions for querying the status of bluetooth switch. 21 * @since 13 22 */ 23 /** 24 * @file oh_bluetooth.h 25 * @kit ConnectivityKit 26 * @brief Define interfaces for querying bluetooth switch status. 27 * @library libbluetooth.so 28 * @syscap SystemCapability.Communication.Bluetooth.Core 29 * @since 13 30 */ 31 32 #ifndef OH_BLUETOOTH_H 33 #define OH_BLUETOOTH_H 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /** 40 * @brief Enumeration state of bluetooth switch. 41 * 42 * @since 13 43 */ 44 typedef enum Bluetooth_SwitchState { 45 /** Indicates the local bluetooth is off. */ 46 BLUETOOTH_STATE_OFF = 0, 47 /** Indicates the local bluetooth is turning on. */ 48 BLUETOOTH_STATE_TURNING_ON = 1, 49 /** Indicates the local bluetooth is on, and ready for use. */ 50 BLUETOOTH_STATE_ON = 2, 51 /** Indicates the local bluetooth is turning off. */ 52 BLUETOOTH_STATE_TURNING_OFF = 3, 53 /** Indicates the local bluetooth is turning LE mode on. */ 54 BLUETOOTH_STATE_BLE_TURNING_ON = 4, 55 /** Indicates the local bluetooth is in LE only mode. */ 56 BLUETOOTH_STATE_BLE_ON = 5, 57 /** Indicates the local bluetooth is turning off LE only mode. */ 58 BLUETOOTH_STATE_BLE_TURNING_OFF = 6 59 } Bluetooth_SwitchState; 60 61 /** 62 * @brief Enumeration the bluetooth result codes. 63 * 64 * @since 13 65 */ 66 typedef enum Bluetooth_ResultCode { 67 /** 68 * @error The operation is successful. 69 */ 70 BLUETOOTH_SUCCESS = 0, 71 /** 72 * @error Parameter error. Possible reasons: 1. The input parameter is a null pointer; 73 * 2. Parameter values exceed the defined range. 74 */ 75 BLUETOOTH_INVALID_PARAM = 401, 76 } Bluetooth_ResultCode; 77 78 /** 79 * @brief Get the bluetooth switch state. 80 * 81 * @param state - It is a pointer used to receive bluetooth switch status values. 82 * The caller needs to pass in a non empty boolean pointer, otherwise an error will be returned. 83 * For a detailed definition, please refer to {@link Bluetooth_SwitchState}. 84 * @return Bluetooth functions result code. 85 * For a detailed definition, please refer to {@link Bluetooth_ResultCode}. 86 * {@link BLUETOOTH_SUCCESS} Successfully obtained the bluetooth switch status. 87 * {@link BLUETOOTH_INVALID_PARAM} The input parameter enabled is a null pointer. 88 * @since 13 89 */ 90 Bluetooth_ResultCode OH_Bluetooth_GetBluetoothSwitchState(Bluetooth_SwitchState *state); 91 #ifdef __cplusplus 92 } 93 #endif 94 /** @} */ 95 #endif // OH_BLUETOOTH_H