Skip to main content
版本:v3+

mstBuildProfile

API_LEVEL 3.0 开始支持,API 兼容性请参考 API_LEVEL。

创建 Profile 连接。

类型​

function mstBuildProfile(profile: ProfileObj): Result

参数​

ProfileObj​

属性类型必填默认值说明API_LEVEL
pairboolean是-是否自动配对3.0
idnumber是-连接 ID3.0
profilestring是-Profile 名称3.0
devArrayBuffer是-设备 MAC 地址,长度 6 字节,建议使用 Uint8Array 视图3.0
lennumber是-list 数组长度3.0
listArray<ServicesObj>是-Services list 数组3.0

ServicesObj​

属性类型必填默认值说明API_LEVEL
lennumber是-list 数组长度3.0
listArray<ServiceObj>是-Service 数组3.0

ServiceObj​

属性类型必填默认值说明API_LEVEL
uuidstring是-Service UUID3.0
permissionnumber否0权限控制,默认 0 不控制3.0
len1number是-Characteristic 数组长度3.0
listArray<CharacteristicObj>是-Characteristic 数组3.0

CharacteristicObj​

属性类型必填默认值说明API_LEVEL
uuidstring是-Characteristic UUID3.0
permissionnumber否0权限控制,默认 0 不控制3.0
lennumber是-Descriptor 数组长度3.0
listArray<DescriptorObj>是-Descriptor 数组3.0

DescriptorObj​

属性类型必填默认值说明API_LEVEL
uuidstring是-Descriptor UUID3.0
permissionnumber否0权限控制,默认 0 不控制3.0

Result​

类型说明
boolean函数调用结果,true 表示成功、false 表示失败

代码示例​

import { mstBuildProfile } from '@zos/ble'

// ...