1use serde::{Deserialize, Serialize};
2#[doc = "Enable the BluetoothEmulation domain.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-enable)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct EnableParams {
5 #[doc = "State of the simulated central."]
6 #[serde(rename = "state")]
7 pub state: super::types::CentralState,
8 #[doc = "If the simulated central supports low-energy."]
9 #[serde(rename = "leSupported")]
10 pub le_supported: bool,
11}
12impl EnableParams {
13 pub fn new(
14 state: impl Into<super::types::CentralState>,
15 le_supported: impl Into<bool>,
16 ) -> Self {
17 Self {
18 state: state.into(),
19 le_supported: le_supported.into(),
20 }
21 }
22}
23#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
24pub enum EnableMethod {
25 #[serde(rename = "BluetoothEmulation.enable")]
26 Enable,
27}
28#[doc = "Enable the BluetoothEmulation domain.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-enable)"]
29#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
30pub struct Enable {
31 pub method: EnableMethod,
32 pub params: EnableParams,
33}
34impl Enable {
35 pub const IDENTIFIER: &'static str = "BluetoothEmulation.enable";
36 pub fn identifier(&self) -> &'static str {
37 Self::IDENTIFIER
38 }
39}
40impl crate::CommandResult for Enable {
41 type Result = super::results::EnableResult;
42}
43#[doc = "Set the state of the simulated central.\n[setSimulatedCentralState](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-setSimulatedCentralState)"]
44#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
45pub struct SetSimulatedCentralStateParams {
46 #[doc = "State of the simulated central."]
47 #[serde(rename = "state")]
48 pub state: super::types::CentralState,
49}
50impl SetSimulatedCentralStateParams {
51 pub fn new(state: impl Into<super::types::CentralState>) -> Self {
52 Self {
53 state: state.into(),
54 }
55 }
56}
57#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
58pub enum SetSimulatedCentralStateMethod {
59 #[serde(rename = "BluetoothEmulation.setSimulatedCentralState")]
60 SetSimulatedCentralState,
61}
62#[doc = "Set the state of the simulated central.\n[setSimulatedCentralState](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-setSimulatedCentralState)"]
63#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
64pub struct SetSimulatedCentralState {
65 pub method: SetSimulatedCentralStateMethod,
66 pub params: SetSimulatedCentralStateParams,
67}
68impl SetSimulatedCentralState {
69 pub const IDENTIFIER: &'static str = "BluetoothEmulation.setSimulatedCentralState";
70 pub fn identifier(&self) -> &'static str {
71 Self::IDENTIFIER
72 }
73}
74impl crate::CommandResult for SetSimulatedCentralState {
75 type Result = super::results::SetSimulatedCentralStateResult;
76}
77#[doc = "Disable the BluetoothEmulation domain.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-disable)"]
78#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
79pub struct DisableParams {}
80#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
81pub enum DisableMethod {
82 #[serde(rename = "BluetoothEmulation.disable")]
83 Disable,
84}
85#[doc = "Disable the BluetoothEmulation domain.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-disable)"]
86#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
87pub struct Disable {
88 pub method: DisableMethod,
89 pub params: DisableParams,
90}
91impl Disable {
92 pub const IDENTIFIER: &'static str = "BluetoothEmulation.disable";
93 pub fn identifier(&self) -> &'static str {
94 Self::IDENTIFIER
95 }
96}
97impl crate::CommandResult for Disable {
98 type Result = super::results::DisableResult;
99}
100#[doc = "Simulates a peripheral with |address|, |name| and |knownServiceUuids|\nthat has already been connected to the system.\n[simulatePreconnectedPeripheral](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulatePreconnectedPeripheral)"]
101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
102pub struct SimulatePreconnectedPeripheralParams {
103 #[serde(rename = "address")]
104 pub address: String,
105 #[serde(rename = "name")]
106 pub name: String,
107 #[serde(rename = "manufacturerData")]
108 #[serde(skip_serializing_if = "Vec::is_empty")]
109 pub manufacturer_data: Vec<super::types::ManufacturerData>,
110 #[serde(rename = "knownServiceUuids")]
111 #[serde(skip_serializing_if = "Vec::is_empty")]
112 pub known_service_uuids: Vec<String>,
113}
114impl SimulatePreconnectedPeripheralParams {
115 pub fn new(
116 address: impl Into<String>,
117 name: impl Into<String>,
118 manufacturer_data: Vec<super::types::ManufacturerData>,
119 known_service_uuids: Vec<String>,
120 ) -> Self {
121 Self {
122 address: address.into(),
123 name: name.into(),
124 manufacturer_data,
125 known_service_uuids,
126 }
127 }
128}
129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
130pub enum SimulatePreconnectedPeripheralMethod {
131 #[serde(rename = "BluetoothEmulation.simulatePreconnectedPeripheral")]
132 SimulatePreconnectedPeripheral,
133}
134#[doc = "Simulates a peripheral with |address|, |name| and |knownServiceUuids|\nthat has already been connected to the system.\n[simulatePreconnectedPeripheral](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulatePreconnectedPeripheral)"]
135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
136pub struct SimulatePreconnectedPeripheral {
137 pub method: SimulatePreconnectedPeripheralMethod,
138 pub params: SimulatePreconnectedPeripheralParams,
139}
140impl SimulatePreconnectedPeripheral {
141 pub const IDENTIFIER: &'static str = "BluetoothEmulation.simulatePreconnectedPeripheral";
142 pub fn identifier(&self) -> &'static str {
143 Self::IDENTIFIER
144 }
145}
146impl crate::CommandResult for SimulatePreconnectedPeripheral {
147 type Result = super::results::SimulatePreconnectedPeripheralResult;
148}
149#[doc = "Simulates an advertisement packet described in |entry| being received by\nthe central.\n[simulateAdvertisement](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateAdvertisement)"]
150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
151pub struct SimulateAdvertisementParams {
152 #[serde(rename = "entry")]
153 pub entry: super::types::ScanEntry,
154}
155impl SimulateAdvertisementParams {
156 pub fn new(entry: impl Into<super::types::ScanEntry>) -> Self {
157 Self {
158 entry: entry.into(),
159 }
160 }
161}
162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
163pub enum SimulateAdvertisementMethod {
164 #[serde(rename = "BluetoothEmulation.simulateAdvertisement")]
165 SimulateAdvertisement,
166}
167#[doc = "Simulates an advertisement packet described in |entry| being received by\nthe central.\n[simulateAdvertisement](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateAdvertisement)"]
168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
169pub struct SimulateAdvertisement {
170 pub method: SimulateAdvertisementMethod,
171 pub params: SimulateAdvertisementParams,
172}
173impl SimulateAdvertisement {
174 pub const IDENTIFIER: &'static str = "BluetoothEmulation.simulateAdvertisement";
175 pub fn identifier(&self) -> &'static str {
176 Self::IDENTIFIER
177 }
178}
179impl crate::CommandResult for SimulateAdvertisement {
180 type Result = super::results::SimulateAdvertisementResult;
181}
182#[doc = "Simulates the response code from the peripheral with |address| for a\nGATT operation of |type|. The |code| value follows the HCI Error Codes from\nBluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.\n[simulateGATTOperationResponse](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateGATTOperationResponse)"]
183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
184pub struct SimulateGattOperationResponseParams {
185 #[serde(rename = "address")]
186 pub address: String,
187 #[serde(rename = "type")]
188 pub r#type: super::types::GattOperationType,
189 #[serde(rename = "code")]
190 pub code: i64,
191}
192impl SimulateGattOperationResponseParams {
193 pub fn new(
194 address: impl Into<String>,
195 r#type: impl Into<super::types::GattOperationType>,
196 code: impl Into<i64>,
197 ) -> Self {
198 Self {
199 address: address.into(),
200 r#type: r#type.into(),
201 code: code.into(),
202 }
203 }
204}
205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
206pub enum SimulateGattOperationResponseMethod {
207 #[serde(rename = "BluetoothEmulation.simulateGATTOperationResponse")]
208 SimulateGattOperationResponse,
209}
210#[doc = "Simulates the response code from the peripheral with |address| for a\nGATT operation of |type|. The |code| value follows the HCI Error Codes from\nBluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.\n[simulateGATTOperationResponse](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateGATTOperationResponse)"]
211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
212pub struct SimulateGattOperationResponse {
213 pub method: SimulateGattOperationResponseMethod,
214 pub params: SimulateGattOperationResponseParams,
215}
216impl SimulateGattOperationResponse {
217 pub const IDENTIFIER: &'static str = "BluetoothEmulation.simulateGATTOperationResponse";
218 pub fn identifier(&self) -> &'static str {
219 Self::IDENTIFIER
220 }
221}
222impl crate::CommandResult for SimulateGattOperationResponse {
223 type Result = super::results::SimulateGattOperationResponseResult;
224}
225#[doc = "Simulates the response from the characteristic with |characteristicId| for a\ncharacteristic operation of |type|. The |code| value follows the Error\nCodes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.\nThe |data| is expected to exist when simulating a successful read operation\nresponse.\n[simulateCharacteristicOperationResponse](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateCharacteristicOperationResponse)"]
226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
227pub struct SimulateCharacteristicOperationResponseParams {
228 #[serde(rename = "characteristicId")]
229 pub characteristic_id: String,
230 #[serde(rename = "type")]
231 pub r#type: super::types::CharacteristicOperationType,
232 #[serde(rename = "code")]
233 pub code: i64,
234 #[serde(rename = "data")]
235 #[serde(skip_serializing_if = "Option::is_none")]
236 #[serde(default)]
237 pub data: Option<crate::Binary>,
238}
239impl SimulateCharacteristicOperationResponseParams {
240 pub fn new(
241 characteristic_id: impl Into<String>,
242 r#type: impl Into<super::types::CharacteristicOperationType>,
243 code: impl Into<i64>,
244 ) -> Self {
245 Self {
246 characteristic_id: characteristic_id.into(),
247 r#type: r#type.into(),
248 code: code.into(),
249 data: None,
250 }
251 }
252}
253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
254pub enum SimulateCharacteristicOperationResponseMethod {
255 #[serde(rename = "BluetoothEmulation.simulateCharacteristicOperationResponse")]
256 SimulateCharacteristicOperationResponse,
257}
258#[doc = "Simulates the response from the characteristic with |characteristicId| for a\ncharacteristic operation of |type|. The |code| value follows the Error\nCodes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.\nThe |data| is expected to exist when simulating a successful read operation\nresponse.\n[simulateCharacteristicOperationResponse](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateCharacteristicOperationResponse)"]
259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
260pub struct SimulateCharacteristicOperationResponse {
261 pub method: SimulateCharacteristicOperationResponseMethod,
262 pub params: SimulateCharacteristicOperationResponseParams,
263}
264impl SimulateCharacteristicOperationResponse {
265 pub const IDENTIFIER: &'static str =
266 "BluetoothEmulation.simulateCharacteristicOperationResponse";
267 pub fn identifier(&self) -> &'static str {
268 Self::IDENTIFIER
269 }
270}
271impl crate::CommandResult for SimulateCharacteristicOperationResponse {
272 type Result = super::results::SimulateCharacteristicOperationResponseResult;
273}
274#[doc = "Simulates the response from the descriptor with |descriptorId| for a\ndescriptor operation of |type|. The |code| value follows the Error\nCodes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.\nThe |data| is expected to exist when simulating a successful read operation\nresponse.\n[simulateDescriptorOperationResponse](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateDescriptorOperationResponse)"]
275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
276pub struct SimulateDescriptorOperationResponseParams {
277 #[serde(rename = "descriptorId")]
278 pub descriptor_id: String,
279 #[serde(rename = "type")]
280 pub r#type: super::types::DescriptorOperationType,
281 #[serde(rename = "code")]
282 pub code: i64,
283 #[serde(rename = "data")]
284 #[serde(skip_serializing_if = "Option::is_none")]
285 #[serde(default)]
286 pub data: Option<crate::Binary>,
287}
288impl SimulateDescriptorOperationResponseParams {
289 pub fn new(
290 descriptor_id: impl Into<String>,
291 r#type: impl Into<super::types::DescriptorOperationType>,
292 code: impl Into<i64>,
293 ) -> Self {
294 Self {
295 descriptor_id: descriptor_id.into(),
296 r#type: r#type.into(),
297 code: code.into(),
298 data: None,
299 }
300 }
301}
302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
303pub enum SimulateDescriptorOperationResponseMethod {
304 #[serde(rename = "BluetoothEmulation.simulateDescriptorOperationResponse")]
305 SimulateDescriptorOperationResponse,
306}
307#[doc = "Simulates the response from the descriptor with |descriptorId| for a\ndescriptor operation of |type|. The |code| value follows the Error\nCodes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.\nThe |data| is expected to exist when simulating a successful read operation\nresponse.\n[simulateDescriptorOperationResponse](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateDescriptorOperationResponse)"]
308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
309pub struct SimulateDescriptorOperationResponse {
310 pub method: SimulateDescriptorOperationResponseMethod,
311 pub params: SimulateDescriptorOperationResponseParams,
312}
313impl SimulateDescriptorOperationResponse {
314 pub const IDENTIFIER: &'static str = "BluetoothEmulation.simulateDescriptorOperationResponse";
315 pub fn identifier(&self) -> &'static str {
316 Self::IDENTIFIER
317 }
318}
319impl crate::CommandResult for SimulateDescriptorOperationResponse {
320 type Result = super::results::SimulateDescriptorOperationResponseResult;
321}
322#[doc = "Adds a service with |serviceUuid| to the peripheral with |address|.\n[addService](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-addService)"]
323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
324pub struct AddServiceParams {
325 #[serde(rename = "address")]
326 pub address: String,
327 #[serde(rename = "serviceUuid")]
328 pub service_uuid: String,
329}
330impl AddServiceParams {
331 pub fn new(address: impl Into<String>, service_uuid: impl Into<String>) -> Self {
332 Self {
333 address: address.into(),
334 service_uuid: service_uuid.into(),
335 }
336 }
337}
338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
339pub enum AddServiceMethod {
340 #[serde(rename = "BluetoothEmulation.addService")]
341 AddService,
342}
343#[doc = "Adds a service with |serviceUuid| to the peripheral with |address|.\n[addService](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-addService)"]
344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
345pub struct AddService {
346 pub method: AddServiceMethod,
347 pub params: AddServiceParams,
348}
349impl AddService {
350 pub const IDENTIFIER: &'static str = "BluetoothEmulation.addService";
351 pub fn identifier(&self) -> &'static str {
352 Self::IDENTIFIER
353 }
354}
355impl crate::CommandResult for AddService {
356 type Result = super::results::AddServiceResult;
357}
358#[doc = "Removes the service respresented by |serviceId| from the simulated central.\n[removeService](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-removeService)"]
359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
360pub struct RemoveServiceParams {
361 #[serde(rename = "serviceId")]
362 pub service_id: String,
363}
364impl RemoveServiceParams {
365 pub fn new(service_id: impl Into<String>) -> Self {
366 Self {
367 service_id: service_id.into(),
368 }
369 }
370}
371impl<T: Into<String>> From<T> for RemoveServiceParams {
372 fn from(url: T) -> Self {
373 RemoveServiceParams::new(url)
374 }
375}
376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
377pub enum RemoveServiceMethod {
378 #[serde(rename = "BluetoothEmulation.removeService")]
379 RemoveService,
380}
381#[doc = "Removes the service respresented by |serviceId| from the simulated central.\n[removeService](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-removeService)"]
382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
383pub struct RemoveService {
384 pub method: RemoveServiceMethod,
385 pub params: RemoveServiceParams,
386}
387impl RemoveService {
388 pub const IDENTIFIER: &'static str = "BluetoothEmulation.removeService";
389 pub fn identifier(&self) -> &'static str {
390 Self::IDENTIFIER
391 }
392}
393impl crate::CommandResult for RemoveService {
394 type Result = super::results::RemoveServiceResult;
395}
396#[doc = "Adds a characteristic with |characteristicUuid| and |properties| to the\nservice represented by |serviceId|.\n[addCharacteristic](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-addCharacteristic)"]
397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
398pub struct AddCharacteristicParams {
399 #[serde(rename = "serviceId")]
400 pub service_id: String,
401 #[serde(rename = "characteristicUuid")]
402 pub characteristic_uuid: String,
403 #[serde(rename = "properties")]
404 pub properties: super::types::CharacteristicProperties,
405}
406impl AddCharacteristicParams {
407 pub fn new(
408 service_id: impl Into<String>,
409 characteristic_uuid: impl Into<String>,
410 properties: impl Into<super::types::CharacteristicProperties>,
411 ) -> Self {
412 Self {
413 service_id: service_id.into(),
414 characteristic_uuid: characteristic_uuid.into(),
415 properties: properties.into(),
416 }
417 }
418}
419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
420pub enum AddCharacteristicMethod {
421 #[serde(rename = "BluetoothEmulation.addCharacteristic")]
422 AddCharacteristic,
423}
424#[doc = "Adds a characteristic with |characteristicUuid| and |properties| to the\nservice represented by |serviceId|.\n[addCharacteristic](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-addCharacteristic)"]
425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
426pub struct AddCharacteristic {
427 pub method: AddCharacteristicMethod,
428 pub params: AddCharacteristicParams,
429}
430impl AddCharacteristic {
431 pub const IDENTIFIER: &'static str = "BluetoothEmulation.addCharacteristic";
432 pub fn identifier(&self) -> &'static str {
433 Self::IDENTIFIER
434 }
435}
436impl crate::CommandResult for AddCharacteristic {
437 type Result = super::results::AddCharacteristicResult;
438}
439#[doc = "Removes the characteristic respresented by |characteristicId| from the\nsimulated central.\n[removeCharacteristic](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-removeCharacteristic)"]
440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
441pub struct RemoveCharacteristicParams {
442 #[serde(rename = "characteristicId")]
443 pub characteristic_id: String,
444}
445impl RemoveCharacteristicParams {
446 pub fn new(characteristic_id: impl Into<String>) -> Self {
447 Self {
448 characteristic_id: characteristic_id.into(),
449 }
450 }
451}
452impl<T: Into<String>> From<T> for RemoveCharacteristicParams {
453 fn from(url: T) -> Self {
454 RemoveCharacteristicParams::new(url)
455 }
456}
457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
458pub enum RemoveCharacteristicMethod {
459 #[serde(rename = "BluetoothEmulation.removeCharacteristic")]
460 RemoveCharacteristic,
461}
462#[doc = "Removes the characteristic respresented by |characteristicId| from the\nsimulated central.\n[removeCharacteristic](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-removeCharacteristic)"]
463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
464pub struct RemoveCharacteristic {
465 pub method: RemoveCharacteristicMethod,
466 pub params: RemoveCharacteristicParams,
467}
468impl RemoveCharacteristic {
469 pub const IDENTIFIER: &'static str = "BluetoothEmulation.removeCharacteristic";
470 pub fn identifier(&self) -> &'static str {
471 Self::IDENTIFIER
472 }
473}
474impl crate::CommandResult for RemoveCharacteristic {
475 type Result = super::results::RemoveCharacteristicResult;
476}
477#[doc = "Adds a descriptor with |descriptorUuid| to the characteristic respresented\nby |characteristicId|.\n[addDescriptor](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-addDescriptor)"]
478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
479pub struct AddDescriptorParams {
480 #[serde(rename = "characteristicId")]
481 pub characteristic_id: String,
482 #[serde(rename = "descriptorUuid")]
483 pub descriptor_uuid: String,
484}
485impl AddDescriptorParams {
486 pub fn new(characteristic_id: impl Into<String>, descriptor_uuid: impl Into<String>) -> Self {
487 Self {
488 characteristic_id: characteristic_id.into(),
489 descriptor_uuid: descriptor_uuid.into(),
490 }
491 }
492}
493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
494pub enum AddDescriptorMethod {
495 #[serde(rename = "BluetoothEmulation.addDescriptor")]
496 AddDescriptor,
497}
498#[doc = "Adds a descriptor with |descriptorUuid| to the characteristic respresented\nby |characteristicId|.\n[addDescriptor](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-addDescriptor)"]
499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
500pub struct AddDescriptor {
501 pub method: AddDescriptorMethod,
502 pub params: AddDescriptorParams,
503}
504impl AddDescriptor {
505 pub const IDENTIFIER: &'static str = "BluetoothEmulation.addDescriptor";
506 pub fn identifier(&self) -> &'static str {
507 Self::IDENTIFIER
508 }
509}
510impl crate::CommandResult for AddDescriptor {
511 type Result = super::results::AddDescriptorResult;
512}
513#[doc = "Removes the descriptor with |descriptorId| from the simulated central.\n[removeDescriptor](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-removeDescriptor)"]
514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
515pub struct RemoveDescriptorParams {
516 #[serde(rename = "descriptorId")]
517 pub descriptor_id: String,
518}
519impl RemoveDescriptorParams {
520 pub fn new(descriptor_id: impl Into<String>) -> Self {
521 Self {
522 descriptor_id: descriptor_id.into(),
523 }
524 }
525}
526impl<T: Into<String>> From<T> for RemoveDescriptorParams {
527 fn from(url: T) -> Self {
528 RemoveDescriptorParams::new(url)
529 }
530}
531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
532pub enum RemoveDescriptorMethod {
533 #[serde(rename = "BluetoothEmulation.removeDescriptor")]
534 RemoveDescriptor,
535}
536#[doc = "Removes the descriptor with |descriptorId| from the simulated central.\n[removeDescriptor](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-removeDescriptor)"]
537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
538pub struct RemoveDescriptor {
539 pub method: RemoveDescriptorMethod,
540 pub params: RemoveDescriptorParams,
541}
542impl RemoveDescriptor {
543 pub const IDENTIFIER: &'static str = "BluetoothEmulation.removeDescriptor";
544 pub fn identifier(&self) -> &'static str {
545 Self::IDENTIFIER
546 }
547}
548impl crate::CommandResult for RemoveDescriptor {
549 type Result = super::results::RemoveDescriptorResult;
550}
551#[doc = "Simulates a GATT disconnection from the peripheral with |address|.\n[simulateGATTDisconnection](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateGATTDisconnection)"]
552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
553pub struct SimulateGattDisconnectionParams {
554 #[serde(rename = "address")]
555 pub address: String,
556}
557impl SimulateGattDisconnectionParams {
558 pub fn new(address: impl Into<String>) -> Self {
559 Self {
560 address: address.into(),
561 }
562 }
563}
564impl<T: Into<String>> From<T> for SimulateGattDisconnectionParams {
565 fn from(url: T) -> Self {
566 SimulateGattDisconnectionParams::new(url)
567 }
568}
569#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
570pub enum SimulateGattDisconnectionMethod {
571 #[serde(rename = "BluetoothEmulation.simulateGATTDisconnection")]
572 SimulateGattDisconnection,
573}
574#[doc = "Simulates a GATT disconnection from the peripheral with |address|.\n[simulateGATTDisconnection](https://chromedevtools.github.io/devtools-protocol/tot/BluetoothEmulation/#method-simulateGATTDisconnection)"]
575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
576pub struct SimulateGattDisconnection {
577 pub method: SimulateGattDisconnectionMethod,
578 pub params: SimulateGattDisconnectionParams,
579}
580impl SimulateGattDisconnection {
581 pub const IDENTIFIER: &'static str = "BluetoothEmulation.simulateGATTDisconnection";
582 pub fn identifier(&self) -> &'static str {
583 Self::IDENTIFIER
584 }
585}
586impl crate::CommandResult for SimulateGattDisconnection {
587 type Result = super::results::SimulateGattDisconnectionResult;
588}
589group_enum ! (BluetoothEmulationCommands { Enable (Enable) , SetSimulatedCentralState (SetSimulatedCentralState) , Disable (Disable) , SimulatePreconnectedPeripheral (SimulatePreconnectedPeripheral) , SimulateAdvertisement (SimulateAdvertisement) , SimulateGattOperationResponse (SimulateGattOperationResponse) , SimulateCharacteristicOperationResponse (SimulateCharacteristicOperationResponse) , SimulateDescriptorOperationResponse (SimulateDescriptorOperationResponse) , AddService (AddService) , RemoveService (RemoveService) , AddCharacteristic (AddCharacteristic) , RemoveCharacteristic (RemoveCharacteristic) , AddDescriptor (AddDescriptor) , RemoveDescriptor (RemoveDescriptor) , SimulateGattDisconnection (SimulateGattDisconnection) } + identifiable);