openharmony 鸿蒙 js-apis-bluetooth-common

2026-08-25 浏览 (1)

@ohos.bluetooth.common (Bluetooth Common Module)

This module provides Bluetooth common APIs and parameter types. The first batch of APIs allow applications to specify the MAC address and address type of the target device when calling connection.pairDevice.

NOTE

The initial APIs of this module are supported since API version 21. Newly added APIs will be marked with a superscript to indicate their earliest API version.

Modules to Import

import { common } from '@kit.ConnectivityKit';

BluetoothAddress

Defines the address information of a Bluetooth device, including the address and address type.

System capability: SystemCapability.Communication.Bluetooth.Core

NameTypeRead-OnlyOptionalDescription
addressstringNoNoAddress of the Bluetooth device, for example, XX:XX:XX:XX:XX:XX.
addressTypeBluetoothAddressTypeNoNoAddress type, which can be the actual or virtual MAC address of the Bluetooth device.
rawAddressType23+BluetoothRawAddressTypeNoYesBluetooth device address type defined by the Bluetooth protocol, which can be Public or Random.

BluetoothAddressType

Enumerates the Bluetooth device address types defined by the Bluetooth subsystem. The actual MAC address of a Bluetooth device is private information. During device discovery, the Bluetooth subsystem assigns a virtual MAC address to each Bluetooth device and saves the mapping between the virtual MAC address and the actual MAC address. For details about the address types, see Bluetooth Device Address Type.

System capability: SystemCapability.Communication.Bluetooth.Core

NameValueDescription
VIRTUAL1Virtual MAC address.
REAL2Actual MAC address.

BluetoothRawAddressType23+

Enumerates the Bluetooth device address types defined by the Bluetooth protocol. For details about the address types, see Bluetooth Device Address Type.

System capability: SystemCapability.Communication.Bluetooth.Core

NameValueDescription
PUBLIC0Public address type.
RANDOM1Random address type.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 js-apis-bluetooth-a2dp

openharmony 鸿蒙 js-apis-bluetooth-map

openharmony 鸿蒙 capi-oh-bluetooth-h

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

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