BluetoothEmulation🧪
该域允许配置虚拟蓝牙设备以测试''web-bluetooth API''。
EN
This domain allows configuring virtual Bluetooth devices to test the web-bluetooth API.
✅️️ Methods
🔨BluetoothEmulation.addCharacteristic
向由|serviceId|表示的服务添加一个具有|characteristicUuid|和|properties|特性的特征 。
EN
Adds a characteristic with |characteristicUuid| and |properties| to the service represented by |serviceId|.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| serviceId | ✔️ | string | |||
| characteristicUuid | ✔️ | string | |||
| properties | ✔️ | CharacteristicProperties |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| characteristicId | string | 一个唯一标识此特征的标识符。 | ENAn identifier that uniquely represents this characteristic. |
🔨BluetoothEmulation.addDescriptor
向由 |characteristicId| 表示的特性添加一个具有 |descriptorUuid| 的描述符。
EN
Adds a descriptor with |descriptorUuid| to the characteristic respresented by |characteristicId|.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| characteristicId | ✔️ | string | |||
| descriptorUuid | ✔️ | string |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| descriptorId | string | 一个唯一标识此描述符的标识符。 | ENAn identifier that uniquely represents this descriptor. |
🔨BluetoothEmulation.addService
将带有 |serviceUuid| 的服务添加到地址为 |address| 的外围设备中。
EN
Adds a service with |serviceUuid| to the peripheral with |address|.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| address | ✔️ | string | |||
| serviceUuid | ✔️ | string |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| serviceId | string | 唯一标识此服务的标识符。 | ENAn identifier that uniquely represents this service. |
🔨BluetoothEmulation.disable
禁用BluetoothEmulation域。
EN
Disable the BluetoothEmulation domain.
🔨BluetoothEmulation.enable
启用BluetoothEmulation域。
EN
Enable the BluetoothEmulation domain.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| state | ✔️ | CentralState | 模拟中心的状态。 | ENState of the simulated central. | |
| leSupported | ✔️ | boolean | 如果模拟中心支持低功耗。 | ENIf the simulated central supports low-energy. |
🔨BluetoothEmulation.removeCharacteristic
从模拟中央设备中移除由 |characteristicId| 所代表的特性。
EN
Removes the characteristic respresented by |characteristicId| from the simulated central.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| characteristicId | ✔️ | string |
🔨BluetoothEmulation.removeDescriptor
从模拟中央设备中移除具有 |descriptorId| 的描述符。
EN
Removes the descriptor with |descriptorId| from the simulated central.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| descriptorId | ✔️ | string |
🔨BluetoothEmulation.removeService
从模拟中心移除由 |serviceId| 表示的服务。
EN
Removes the service respresented by |serviceId| from the simulated central.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| serviceId | ✔️ | string |
🔨BluetoothEmulation.setSimulatedCentralState
设置模拟中央的状态。
EN
Set the state of the simulated central.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| state | ✔️ | CentralState | 模拟中央的状态。 | ENState of the simulated central. |
🔨BluetoothEmulation.simulateAdvertisement
模拟一个由中央接收到的广告数据包,该数据包在 |entry| 中有描述。
EN
Simulates an advertisement packet described in |entry| being received by the central.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| entry | ✔️ | ScanEntry |
🔨BluetoothEmulation.simulateCharacteristicOperationResponse
模拟来自特性操作 |type| 中具有 |characteristicId| 的特性的响应。|code| 值遵循蓝牙核心规范卷 3 第 F 部分 3.4.1.1 错误响应中的错误代码。在模拟成功的读取操作响应时,|data| 应当存在。
EN
Simulates the response from the characteristic with |characteristicId| for a characteristic operation of |type|. The |code| value follows the Error Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response. The |data| is expected to exist when simulating a successful read operation response.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| characteristicId | ✔️ | string | |||
| type | ✔️ | CharacteristicOperationType | |||
| code | ✔️ | integer | |||
| data | string |
🔨BluetoothEmulation.simulateDescriptorOperationResponse
模拟针对类型为|type|的描述符操作,使用描述符ID |descriptorId|的响应。|code|值遵循蓝牙核心规范第3卷F部分3.4.1.1章节的错误代码定义。在模拟成功的读取操作响应时,|data|应当存在。
EN
Simulates the response from the descriptor with |descriptorId| for a descriptor operation of |type|. The |code| value follows the Error Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response. The |data| is expected to exist when simulating a successful read operation response.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| descriptorId | ✔️ | string | |||
| type | ✔️ | DescriptorOperationType | |||
| code | ✔️ | integer | |||
| data | string |
🔨BluetoothEmulation.simulateGATTDisconnection
模拟从地址为 |address| 的外围设备断开 GATT 连接。
EN
Simulates a GATT disconnection from the peripheral with |address|.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| address | ✔️ | string |
🔨BluetoothEmulation.simulateGATTOperationResponse
模拟来自外围设备地址为|address|的GATT操作类型为|type|的响应代码。|code|值遵循蓝牙核心规范第2卷第D部分1.3节错误代码列表中的HCI错误代码。
EN
Simulates the response code from the peripheral with |address| for a GATT operation of |type|. The |code| value follows the HCI Error Codes from Bluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| address | ✔️ | string | |||
| type | ✔️ | GATTOperationType | |||
| code | ✔️ | integer |