harmony 鸿蒙Bluetooth

2025-06-12 浏览 (1)

Bluetooth

Overview

Provides APIs for obtaining the Bluetooth switch state.

Since: 13

Summary

Files

NameDescription
oh_bluetooth.hDefines the API for obtaining the Bluetooth switch state.
File to include: <ConnectivityKit/bluetooth/oh_bluetooth.h>

Types

NameDescription
typedef enum Bluetooth_SwitchState Bluetooth_SwitchStateDefines an enum for Bluetooth switch states.
typedef enum Bluetooth_ResultCode Bluetooth_ResultCodeDefines an enum for the error codes returned by Bluetooth APIs.

Enums

NameDescription
Bluetooth_SwitchState {
BLUETOOTH_STATE_OFF = 0,
BLUETOOTH_STATE_TURNING_ON = 1,
BLUETOOTH_STATE_ON = 2,
BLUETOOTH_STATE_TURNING_OFF = 3,
BLUETOOTH_STATE_BLE_TURNING_ON = 4,
BLUETOOTH_STATE_BLE_ON = 5,
BLUETOOTH_STATE_BLE_TURNING_OFF = 6
}
Enumerates the Bluetooth switch states.
Bluetooth_ResultCode {
BLUETOOTH_SUCCESS = 0,
BLUETOOTH_INVALID_PARAM = 401
}
Enumerates the error codes returned by Bluetooth APIs.

Functions

NameDescription
Bluetooth_ResultCode OH_Bluetooth_GetBluetoothSwitchState (Bluetooth_SwitchState *state)Obtains the Bluetooth state.

Type Description

Bluetooth_ResultCode

typedef enum Bluetooth_ResultCode Bluetooth_ResultCode

Description

Defines an enum for the error codes returned by Bluetooth APIs.

Since: 13

Bluetooth_SwitchState

typedef enum Bluetooth_SwitchState Bluetooth_SwitchState

Description

Defines an enum for Bluetooth switch states.

Since: 13

Enum Description

Bluetooth_ResultCode

enum Bluetooth_ResultCode

Description

Enumerates the error codes returned by Bluetooth APIs.

Since: 13

ValueDescription
BLUETOOTH_SUCCESSThe operation is successful.
BLUETOOTH_INVALID_PARAMInvalid parameter. Possible causes: 1. The input parameter is a null pointer. 2. The parameter value exceeds the value range.

Bluetooth_SwitchState

enum Bluetooth_SwitchState

Description

Enumerates Bluetooth switch states.

Since: 13

ValueDescription
BLUETOOTH_STATE_OFFBluetooth is turned off.
BLUETOOTH_STATE_TURNING_ONBluetooth is being turned on.
BLUETOOTH_STATE_ONBluetooth is turned on and ready for use.
BLUETOOTH_STATE_TURNING_OFFBluetooth is being turned off.
BLUETOOTH_STATE_BLE_TURNING_ONThe BLE only mode is being turned on.
BLUETOOTH_STATE_BLE_ONThe BLE only mode is turned on.
BLUETOOTH_STATE_BLE_TURNING_OFFThe BLE only mode is being turned off.

Function Description

OH_Bluetooth_GetBluetoothSwitchState()

Bluetooth_ResultCode OH_Bluetooth_GetBluetoothSwitchState (Bluetooth_SwitchState * state)

Description

Obtains the Bluetooth state.

Since: 13

Parameters

NameDescription
statePointer to the Bluetooth state obtained. A non-null pointer must be passed in. Otherwise, an error is returned. For details, see Bluetooth_SwitchState.

Returns

Returns a result code. For details, see Bluetooth_ResultCode.
BLUETOOTH_SUCCESS indicates that the operation is successful.
BLUETOOTH_INVALID_PARAM indicates that the input parameter is a null pointer.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Connectivity Kit (Short-Range Communication Service)

harmony 鸿蒙Wifi

harmony 鸿蒙Bluetooth Error Codes

harmony 鸿蒙NFC Error Codes

harmony 鸿蒙SecureElement Error Codes

harmony 鸿蒙Wi-Fi Error Codes

harmony 鸿蒙@ohos.bluetooth.a2dp (Bluetooth A2DP Module) (System API)

harmony 鸿蒙@ohos.bluetooth.a2dp (Bluetooth A2DP Module)

harmony 鸿蒙@ohos.bluetooth.access (Bluetooth Access Module) (System API)

harmony 鸿蒙@ohos.bluetooth.access (Bluetooth Access Module)

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/VuePrj