mstBuildProfile
API_LEVEL
3.0
开始支持,API 兼容性请参考 API_LEVEL。
创建 Profile 连接。
类型
function mstBuildProfile(profile: ProfileObj): Result
参数
ProfileObj
属性 | 类型 | 必填 | 默认值 | 说明 | API_LEVEL |
---|---|---|---|---|---|
pair | boolean | 是 | - | 是否自动配对 | 3.0 |
id | number | 是 | - | 连接 ID | 3.0 |
profile | string | 是 | - | Profile 名称 | 3.0 |
dev | ArrayBuffer | 是 | - | 设备 MAC 地址,长度 6 字节,建议使用 Uint8Array 视图 | 3.0 |
len | number | 是 | - | list 数组长度 | 3.0 |
list | Array<ServicesObj> | 是 | - | Services list 数组 | 3.0 |
ServicesObj
属性 | 类型 | 必填 | 默认值 | 说明 | API_LEVEL |
---|---|---|---|---|---|
len | number | 是 | - | list 数组长度 | 3.0 |
list | Array<ServiceObj> | 是 | - | Service 数组 | 3.0 |
ServiceObj
属性 | 类型 | 必填 | 默认值 | 说明 | API_LEVEL |
---|---|---|---|---|---|
uuid | string | 是 | - | Service UUID | 3.0 |
permission | number | 否 | 0 | 权限控制,默认 0 不控制 | 3.0 |
len1 | number | 是 | - | Characteristic 数组长度 | 3.0 |
list | Array<CharacteristicObj> | 是 | - | Characteristic 数组 | 3.0 |
CharacteristicObj
属性 | 类型 | 必填 | 默认值 | 说明 | API_LEVEL |
---|---|---|---|---|---|
uuid | string | 是 | - | Characteristic UUID | 3.0 |
permission | number | 否 | 0 | 权限控制,默认 0 不控制 | 3.0 |
len | number | 是 | - | Descriptor 数组长度 | 3.0 |
list | Array<DescriptorObj> | 是 | - | Descriptor 数组 | 3.0 |
DescriptorObj
属性 | 类型 | 必填 | 默认值 | 说明 | API_LEVEL |
---|---|---|---|---|---|
uuid | string | 是 | - | Descriptor UUID | 3.0 |
permission | number | 否 | 0 | 权限控制,默认 0 不控制 | 3.0 |
Result
类型 | 说明 |
---|---|
boolean | 函数调用结果,true 表示成功、false 表示失败 |
代码示例
import { mstGetConnIdByRemoteAddr } from '@zos/ble'
// ...