1# oh_bluetooth.h 2 3<!--Kit: Connectivity Kit--> 4<!--Subsystem: Communication--> 5<!--Owner: @enjoy_sunshine--> 6<!--Designer: @chengguohong; @tangjia15--> 7<!--Tester: @wangfeng517--> 8<!--Adviser: @zhang_yixin13--> 9 10## 概述 11 12定义查询蓝牙开关状态的接口。 13 14**引用文件:** <ConnectivityKit/bluetooth/oh_bluetooth.h> 15 16**库:** libbluetooth.so 17 18**系统能力:** SystemCapability.Communication.Bluetooth.Core 19 20**起始版本:** 13 21 22**相关模块:** [Bluetooth](capi-bluetooth.md) 23 24## 汇总 25 26### 枚举 27 28| 名称 | typedef关键字 | 描述 | 29| -- | -- | -- | 30| [Bluetooth_SwitchState](#bluetooth_switchstate) | Bluetooth_SwitchState | 定义蓝牙开关状态的枚举值。 | 31| [Bluetooth_ResultCode](#bluetooth_resultcode) | Bluetooth_ResultCode | 定义蓝牙返回值。 | 32 33### 函数 34 35| 名称 | 描述 | 36| -- | -- | 37| [Bluetooth_ResultCode OH_Bluetooth_GetBluetoothSwitchState(Bluetooth_SwitchState *state)](#oh_bluetooth_getbluetoothswitchstate) | 获取蓝牙开关状态。 | 38 39## 枚举类型说明 40 41### Bluetooth_SwitchState 42 43``` 44enum Bluetooth_SwitchState 45``` 46 47**描述** 48 49定义蓝牙开关状态的枚举值。 50 51**起始版本:** 13 52 53| 枚举项 | 描述 | 54| -- | -- | 55| BLUETOOTH_STATE_OFF = 0 | 表示蓝牙关闭。 | 56| BLUETOOTH_STATE_TURNING_ON = 1 | 表示蓝牙打开中。 | 57| BLUETOOTH_STATE_ON = 2 | 表示蓝牙已打开,使用就绪。 | 58| BLUETOOTH_STATE_TURNING_OFF = 3 | 表示蓝牙关闭中。 | 59| BLUETOOTH_STATE_BLE_TURNING_ON = 4 | 表示蓝牙LE only模式打开中。 | 60| BLUETOOTH_STATE_BLE_ON = 5 | 表示蓝牙处于LE only模式。 | 61| BLUETOOTH_STATE_BLE_TURNING_OFF = 6 | 表示蓝牙LE only模式关闭中。 | 62 63### Bluetooth_ResultCode 64 65``` 66enum Bluetooth_ResultCode 67``` 68 69**描述** 70 71定义蓝牙返回值。 72 73**起始版本:** 13 74 75| 枚举项 | 描述 | 76| -- | -- | 77| BLUETOOTH_SUCCESS = 0 | 操作成功。 | 78| BLUETOOTH_INVALID_PARAM = 401 | 参数错误。可能原因:1. 输入参数为空指针;2. 参数数值超出定义范围。 | 79 80 81## 函数说明 82 83### OH_Bluetooth_GetBluetoothSwitchState() 84 85``` 86Bluetooth_ResultCode OH_Bluetooth_GetBluetoothSwitchState(Bluetooth_SwitchState *state) 87``` 88 89**描述** 90 91获取蓝牙开关状态。 92 93**起始版本:** 13 94 95 96**参数:** 97 98| 参数项 | 描述 | 99| -- | -- | 100| [Bluetooth_SwitchState](capi-oh-bluetooth-h.md#bluetooth_switchstate) *state | - 指向接收蓝牙开关状态的枚举值的指针。需要传入非空指针,否则将返回错误码。详细定义请参考[Bluetooth_SwitchState](capi-oh-bluetooth-h.md#bluetooth_switchstate)。 | 101 102**返回:** 103 104| 类型 | 说明 | 105| -- | -- | 106| [Bluetooth_ResultCode](capi-oh-bluetooth-h.md#bluetooth_resultcode) | 蓝牙开关状态函数返回值。<br> 详细定义请参考[Bluetooth_ResultCode](capi-oh-bluetooth-h.md#bluetooth_resultcode)。<br> [BLUETOOTH_SUCCESS](capi-oh-bluetooth-h.md#bluetooth_resultcode) 成功获取蓝牙开关状态。<br> [BLUETOOTH_INVALID_PARAM](capi-oh-bluetooth-h.md#bluetooth_resultcode) 输入参数为空指针。 | 107 108 109