17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci/** 177777dab0Sopenharmony_ci * @addtogroup Bluetooth 187777dab0Sopenharmony_ci * @{ 197777dab0Sopenharmony_ci * 207777dab0Sopenharmony_ci * @brief Provide functions for querying the status of bluetooth switch. 217777dab0Sopenharmony_ci * @since 13 227777dab0Sopenharmony_ci */ 237777dab0Sopenharmony_ci/** 247777dab0Sopenharmony_ci * @file oh_bluetooth.h 257777dab0Sopenharmony_ci * @kit ConnectivityKit 267777dab0Sopenharmony_ci * @brief Define interfaces for querying bluetooth switch status. 277777dab0Sopenharmony_ci * @library libbluetooth.so 287777dab0Sopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 297777dab0Sopenharmony_ci * @since 13 307777dab0Sopenharmony_ci */ 317777dab0Sopenharmony_ci 327777dab0Sopenharmony_ci#ifndef OH_BLUETOOTH_H 337777dab0Sopenharmony_ci#define OH_BLUETOOTH_H 347777dab0Sopenharmony_ci 357777dab0Sopenharmony_ci#ifdef __cplusplus 367777dab0Sopenharmony_ciextern "C" { 377777dab0Sopenharmony_ci#endif 387777dab0Sopenharmony_ci 397777dab0Sopenharmony_ci/** 407777dab0Sopenharmony_ci * @brief Enumeration state of bluetooth switch. 417777dab0Sopenharmony_ci * 427777dab0Sopenharmony_ci * @since 13 437777dab0Sopenharmony_ci */ 447777dab0Sopenharmony_citypedef enum Bluetooth_SwitchState { 457777dab0Sopenharmony_ci /** Indicates the local bluetooth is off. */ 467777dab0Sopenharmony_ci BLUETOOTH_STATE_OFF = 0, 477777dab0Sopenharmony_ci /** Indicates the local bluetooth is turning on. */ 487777dab0Sopenharmony_ci BLUETOOTH_STATE_TURNING_ON = 1, 497777dab0Sopenharmony_ci /** Indicates the local bluetooth is on, and ready for use. */ 507777dab0Sopenharmony_ci BLUETOOTH_STATE_ON = 2, 517777dab0Sopenharmony_ci /** Indicates the local bluetooth is turning off. */ 527777dab0Sopenharmony_ci BLUETOOTH_STATE_TURNING_OFF = 3, 537777dab0Sopenharmony_ci /** Indicates the local bluetooth is turning LE mode on. */ 547777dab0Sopenharmony_ci BLUETOOTH_STATE_BLE_TURNING_ON = 4, 557777dab0Sopenharmony_ci /** Indicates the local bluetooth is in LE only mode. */ 567777dab0Sopenharmony_ci BLUETOOTH_STATE_BLE_ON = 5, 577777dab0Sopenharmony_ci /** Indicates the local bluetooth is turning off LE only mode. */ 587777dab0Sopenharmony_ci BLUETOOTH_STATE_BLE_TURNING_OFF = 6 597777dab0Sopenharmony_ci} Bluetooth_SwitchState; 607777dab0Sopenharmony_ci 617777dab0Sopenharmony_ci/** 627777dab0Sopenharmony_ci * @brief Enumeration the bluetooth result codes. 637777dab0Sopenharmony_ci * 647777dab0Sopenharmony_ci * @since 13 657777dab0Sopenharmony_ci */ 667777dab0Sopenharmony_citypedef enum Bluetooth_ResultCode { 677777dab0Sopenharmony_ci /** 687777dab0Sopenharmony_ci * @error The operation is successful. 697777dab0Sopenharmony_ci */ 707777dab0Sopenharmony_ci BLUETOOTH_SUCCESS = 0, 717777dab0Sopenharmony_ci /** 727777dab0Sopenharmony_ci * @error Parameter error. Possible reasons: 1. The input parameter is a null pointer; 737777dab0Sopenharmony_ci * 2. Parameter values exceed the defined range. 747777dab0Sopenharmony_ci */ 757777dab0Sopenharmony_ci BLUETOOTH_INVALID_PARAM = 401, 767777dab0Sopenharmony_ci} Bluetooth_ResultCode; 777777dab0Sopenharmony_ci 787777dab0Sopenharmony_ci/** 797777dab0Sopenharmony_ci * @brief Get the bluetooth switch state. 807777dab0Sopenharmony_ci * 817777dab0Sopenharmony_ci * @param state - It is a pointer used to receive bluetooth switch status values. 827777dab0Sopenharmony_ci * The caller needs to pass in a non empty boolean pointer, otherwise an error will be returned. 837777dab0Sopenharmony_ci * For a detailed definition, please refer to {@link Bluetooth_SwitchState}. 847777dab0Sopenharmony_ci * @return Bluetooth functions result code. 857777dab0Sopenharmony_ci * For a detailed definition, please refer to {@link Bluetooth_ResultCode}. 867777dab0Sopenharmony_ci * {@link BLUETOOTH_SUCCESS} Successfully obtained the bluetooth switch status. 877777dab0Sopenharmony_ci * {@link BLUETOOTH_INVALID_PARAM} The input parameter enabled is a null pointer. 887777dab0Sopenharmony_ci * @since 13 897777dab0Sopenharmony_ci */ 907777dab0Sopenharmony_ciBluetooth_ResultCode OH_Bluetooth_GetBluetoothSwitchState(Bluetooth_SwitchState *state); 917777dab0Sopenharmony_ci#ifdef __cplusplus 927777dab0Sopenharmony_ci} 937777dab0Sopenharmony_ci#endif 947777dab0Sopenharmony_ci/** @} */ 957777dab0Sopenharmony_ci#endif // OH_BLUETOOTH_H