Back to Puppeteer

BluetoothEmulation interface

website/versioned_docs/version-24.40.0/api/puppeteer.bluetoothemulation.md

19.2.22.1 KB
Original Source

BluetoothEmulation interface

Exposes the bluetooth emulation abilities.

Signature

typescript
export interface BluetoothEmulation

Remarks

Web Bluetooth specification requires the emulated adapters should be isolated per top-level navigable. However, at the moment Chromium's bluetooth emulation implementation is tight to the browser context, not the page. This means the bluetooth emulation exposed from different pages of the same browser context would interfere their states.

Example

ts
await page.bluetooth.emulateAdapter('powered-on');
await page.bluetooth.simulatePreconnectedPeripheral({
  address: '09:09:09:09:09:09',
  name: 'SOME_NAME',
  manufacturerData: [
    {
      key: 17,
      data: 'AP8BAX8=',
    },
  ],
  knownServiceUuids: ['12345678-1234-5678-9abc-def123456789'],
});
await page.bluetooth.disableEmulation();

Methods

<table><thead><tr><th>

Method

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

<span id="disableemulation">disableEmulation()</span>

</td><td>

(Experimental) Disable emulated bluetooth adapter. See bluetooth.disableSimulation.

</td></tr> <tr><td>

<span id="emulateadapter">emulateAdapter(state, leSupported)</span>

</td><td>

(Experimental) Emulate Bluetooth adapter. Required for bluetooth simulations See bluetooth.simulateAdapter.

</td></tr> <tr><td>

<span id="simulatepreconnectedperipheral">simulatePreconnectedPeripheral(preconnectedPeripheral)</span>

</td><td>

(Experimental) Simulated preconnected Bluetooth Peripheral. See bluetooth.simulatePreconnectedPeripheral.

</td></tr> </tbody></table>