openharmony 鸿蒙 capi-oh-bluetooth-h

2026-08-25 浏览 (1)

oh_bluetooth.h

Overview

Defines the API for obtaining the Bluetooth switch state.

File to include: <ConnectivityKit/bluetooth/oh_bluetooth.h>

Library: libbluetooth_ndk.so

System capability: SystemCapability.Communication.Bluetooth.Core

Since: 13

Related module: Bluetooth

Summary

Enums

Nametypedef KeywordDescription
Bluetooth_SwitchStateBluetooth_SwitchStateEnumerates the Bluetooth switch states.
Bluetooth_ResultCodeBluetooth_ResultCodeDefines the Bluetooth return value.

Functions

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

Enum Description

Bluetooth_SwitchState

enum Bluetooth_SwitchState

Description

Enumerates the Bluetooth switch states.

Since: 13

Enum ItemDescription
BLUETOOTH_STATE_OFF = 0Bluetooth is turned off.
BLUETOOTH_STATE_TURNING_ON = 1Bluetooth is being turned on.
BLUETOOTH_STATE_ON = 2Bluetooth is turned on and ready for use.
BLUETOOTH_STATE_TURNING_OFF = 3Bluetooth is being turned off.
BLUETOOTH_STATE_BLE_TURNING_ON = 4The BLE only mode is being turned on.
BLUETOOTH_STATE_BLE_ON = 5The BLE only mode is turned on.
BLUETOOTH_STATE_BLE_TURNING_OFF = 6The BLE only mode is being turned off.

Bluetooth_ResultCode

enum Bluetooth_ResultCode

Description

Defines the Bluetooth return value.

Since: 13

Enum ItemDescription
BLUETOOTH_SUCCESS = 0Operation success.
BLUETOOTH_INVALID_PARAM = 401Invalid parameter. Possible causes: 1. The input parameter is a null pointer. 2. The parameter value exceeds the value range.

Function Description

OH_Bluetooth_GetBluetoothSwitchState()

Bluetooth_ResultCode OH_Bluetooth_GetBluetoothSwitchState(Bluetooth_SwitchState *state)

Description

Obtains the Bluetooth state.

Since: 13

Parameters

NameDescription
Bluetooth_SwitchState *statePointer to the Bluetooth state obtained. A null pointer is prohibited. If a null pointer is passed in, an error is returned. For details, see Bluetooth_SwitchState.

Returns

TypeDescription
Bluetooth_ResultCodeBluetooth switch state enumerated by Bluetooth_ResultCode.
The value can be:
BLUETOOTH_SUCCESS: The Bluetooth switch status is successfully obtained.
BLUETOOTH_INVALID_PARAM: The input parameter is a null pointer.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 js-apis-bluetooth-a2dp

openharmony 鸿蒙 js-apis-bluetooth-map

openharmony 鸿蒙 js-apis-nfcTag

openharmony 鸿蒙 js-apis-wifiManagerExt

openharmony 鸿蒙 js-apis-bluetooth-ble

openharmony 鸿蒙 errorcode-wifi

openharmony 鸿蒙 capi-bluetooth

openharmony 鸿蒙 js-apis-wifiext

openharmony 鸿蒙 js-apis-fusionConnectivity-partnerAgent-sys

openharmony 鸿蒙 js-apis-bluetooth-baseProfile-sys

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