Skip to main content

browser_commander/puppeteer/api/
bluetooth_emulation.rs

1// @generated by scripts/generate-puppeteer-bindings.mjs from
2// rust/protocol/puppeteer/api.json. Do not edit by hand.
3
4#![allow(clippy::all, missing_docs, unused_imports, non_snake_case)]
5
6use serde_json::Value;
7
8use super::*;
9use crate::puppeteer::bridge::{binary, remote_type, BridgeError, JsFunction, Remote};
10
11remote_type!(
12    /// Puppeteer's `BluetoothEmulation` (puppeteer-core 25.10.0), a remote object
13    /// served by `browser-commander serve --stdio`.
14    BluetoothEmulation
15);
16
17impl BluetoothEmulation {
18    /// `BluetoothEmulation.emulateAdapter`
19    ///
20    /// ```text
21    /// emulateAdapter(state: AdapterState, leSupported?: boolean): Promise<void>
22    /// ```
23    pub async fn emulate_adapter(&self, state: &str, le_supported: Option<bool>) -> Result<(), BridgeError> {
24        self.remote.call("emulateAdapter", vec![Some(Value::from(state)), le_supported.map(|x| Value::from(x))]).await
25    }
26
27    /// `BluetoothEmulation.disableEmulation`
28    ///
29    /// ```text
30    /// disableEmulation(): Promise<void>
31    /// ```
32    pub async fn disable_emulation(&self) -> Result<(), BridgeError> {
33        self.remote.call("disableEmulation", vec![]).await
34    }
35
36    /// `BluetoothEmulation.simulatePreconnectedPeripheral`
37    ///
38    /// ```text
39    /// simulatePreconnectedPeripheral(preconnectedPeripheral: PreconnectedPeripheral): Promise<void>
40    /// ```
41    pub async fn simulate_preconnected_peripheral(&self, preconnected_peripheral: Value) -> Result<(), BridgeError> {
42        self.remote.call("simulatePreconnectedPeripheral", vec![Some(preconnected_peripheral)]).await
43    }
44}