Skip to main content

cdp_driver/methods/
bluetooth_emulation.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! This domain allows configuring virtual Bluetooth devices to test the
5//! web-bluetooth API.
6//!
7//! Method names for the `BluetoothEmulation` domain, for use with
8//! [`CdpClient::call`](crate::CdpClient::call).
9//!
10//! This domain is experimental and may change without notice.
11
12/// Enable the BluetoothEmulation domain.
13///
14/// Parameters:
15/// - `state`: CentralState
16/// - `leSupported`: boolean
17pub const ENABLE: &str = "BluetoothEmulation.enable";
18
19/// Set the state of the simulated central.
20///
21/// Parameters:
22/// - `state`: CentralState
23pub const SET_SIMULATED_CENTRAL_STATE: &str = "BluetoothEmulation.setSimulatedCentralState";
24
25/// Disable the BluetoothEmulation domain.
26pub const DISABLE: &str = "BluetoothEmulation.disable";
27
28/// Simulates a peripheral with |address|, |name| and |knownServiceUuids| that
29/// has already been connected to the system.
30///
31/// Parameters:
32/// - `address`: string
33/// - `name`: string
34/// - `manufacturerData`: array
35/// - `knownServiceUuids`: array
36pub const SIMULATE_PRECONNECTED_PERIPHERAL: &str =
37    "BluetoothEmulation.simulatePreconnectedPeripheral";
38
39/// Simulates an advertisement packet described in |entry| being received by
40/// the central.
41///
42/// Parameters:
43/// - `entry`: ScanEntry
44pub const SIMULATE_ADVERTISEMENT: &str = "BluetoothEmulation.simulateAdvertisement";
45
46/// Simulates the response code from the peripheral with |address| for a GATT
47/// operation of |type|. The |code| value follows the HCI Error Codes from
48/// Bluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.
49///
50/// Parameters:
51/// - `address`: string
52/// - `type`: GATTOperationType
53/// - `code`: integer
54pub const SIMULATE_GATT_OPERATION_RESPONSE: &str =
55    "BluetoothEmulation.simulateGATTOperationResponse";
56
57/// Simulates the response from the characteristic with |characteristicId| for
58/// a characteristic operation of |type|. The |code| value follows the Error
59/// Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error
60/// Response. The |data| is expected to exist when simulating a successful
61/// read operation response.
62///
63/// Parameters:
64/// - `characteristicId`: string
65/// - `type`: CharacteristicOperationType
66/// - `code`: integer
67/// - `data`: string (optional)
68pub const SIMULATE_CHARACTERISTIC_OPERATION_RESPONSE: &str =
69    "BluetoothEmulation.simulateCharacteristicOperationResponse";
70
71/// Simulates the response from the descriptor with |descriptorId| for a
72/// descriptor operation of |type|. The |code| value follows the Error Codes
73/// from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response. The
74/// |data| is expected to exist when simulating a successful read operation
75/// response.
76///
77/// Parameters:
78/// - `descriptorId`: string
79/// - `type`: DescriptorOperationType
80/// - `code`: integer
81/// - `data`: string (optional)
82pub const SIMULATE_DESCRIPTOR_OPERATION_RESPONSE: &str =
83    "BluetoothEmulation.simulateDescriptorOperationResponse";
84
85/// Adds a service with |serviceUuid| to the peripheral with |address|.
86///
87/// Parameters:
88/// - `address`: string
89/// - `serviceUuid`: string
90///
91/// Returns: `serviceId`
92pub const ADD_SERVICE: &str = "BluetoothEmulation.addService";
93
94/// Removes the service respresented by |serviceId| from the simulated
95/// central.
96///
97/// Parameters:
98/// - `serviceId`: string
99pub const REMOVE_SERVICE: &str = "BluetoothEmulation.removeService";
100
101/// Adds a characteristic with |characteristicUuid| and |properties| to the
102/// service represented by |serviceId|.
103///
104/// Parameters:
105/// - `serviceId`: string
106/// - `characteristicUuid`: string
107/// - `properties`: CharacteristicProperties
108///
109/// Returns: `characteristicId`
110pub const ADD_CHARACTERISTIC: &str = "BluetoothEmulation.addCharacteristic";
111
112/// Removes the characteristic respresented by |characteristicId| from the
113/// simulated central.
114///
115/// Parameters:
116/// - `characteristicId`: string
117pub const REMOVE_CHARACTERISTIC: &str = "BluetoothEmulation.removeCharacteristic";
118
119/// Adds a descriptor with |descriptorUuid| to the characteristic respresented
120/// by |characteristicId|.
121///
122/// Parameters:
123/// - `characteristicId`: string
124/// - `descriptorUuid`: string
125///
126/// Returns: `descriptorId`
127pub const ADD_DESCRIPTOR: &str = "BluetoothEmulation.addDescriptor";
128
129/// Removes the descriptor with |descriptorId| from the simulated central.
130///
131/// Parameters:
132/// - `descriptorId`: string
133pub const REMOVE_DESCRIPTOR: &str = "BluetoothEmulation.removeDescriptor";
134
135/// Simulates a GATT disconnection from the peripheral with |address|.
136///
137/// Parameters:
138/// - `address`: string
139pub const SIMULATE_GATT_DISCONNECTION: &str = "BluetoothEmulation.simulateGATTDisconnection";