openharmony 鸿蒙 js-apis-bluetooth-common

2026-08-25 浏览 (1)

@ohos.bluetooth.common (蓝牙common模块)

本模块提供了蓝牙公共接口和参数类型。首批接口包括在调用connection.pairDevice时用于指定目标设备的MAC地址与地址类型的相关参数。

说明:

本模块首批接口从API version 21开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

导入模块

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

BluetoothAddress

描述蓝牙设备地址信息的参数结构,包括地址与地址类型。

系统能力:SystemCapability.Communication.Bluetooth.Core

名称类型只读可选说明
addressstring表示蓝牙设备的地址,例如:"XX:XX:XX:XX:XX:XX"。
addressTypeBluetoothAddressType表示地址类型为蓝牙设备的实际MAC地址或虚拟MAC地址。
rawAddressType23+BluetoothRawAddressType表示地址类型为蓝牙协议定义的Public类型或Random类型。

BluetoothAddressType

枚举,蓝牙子系统定义的地址类型。蓝牙设备的实际MAC地址属于用户的隐私信息,在发现设备的过程中,蓝牙子系统会给每个蓝牙外设分配一个虚拟MAC地址,并保存该虚拟MAC地址和外设实际MAC地址的映射关系。关于地址类型的详细介绍请参见蓝牙设备地址类型

系统能力:SystemCapability.Communication.Bluetooth.Core

名称说明
VIRTUAL1虚拟MAC地址类型。
REAL2实际MAC地址类型。

BluetoothRawAddressType23+

枚举,蓝牙协议定义的蓝牙设备地址类型。关于地址类型的详细介绍请参见蓝牙设备地址类型

系统能力:SystemCapability.Communication.Bluetooth.Core

名称说明
PUBLIC0Public地址类型。
RANDOM1Random地址类型。

你可能感兴趣的鸿蒙文章

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/AyGvRus4