1use serde::{Serialize, Deserialize};
6use serde_json::Value as JsonValue;
7use std::borrow::Cow;
8
9#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
12pub enum CentralState {
13 #[default]
14 #[serde(rename = "absent")]
15 Absent,
16 #[serde(rename = "powered-off")]
17 PoweredOff,
18 #[serde(rename = "powered-on")]
19 PoweredOn,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
25pub enum GATTOperationType {
26 #[default]
27 #[serde(rename = "connection")]
28 Connection,
29 #[serde(rename = "discovery")]
30 Discovery,
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
36pub enum CharacteristicWriteType {
37 #[default]
38 #[serde(rename = "write-default-deprecated")]
39 WriteDefaultDeprecated,
40 #[serde(rename = "write-with-response")]
41 WriteWithResponse,
42 #[serde(rename = "write-without-response")]
43 WriteWithoutResponse,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
49pub enum CharacteristicOperationType {
50 #[default]
51 #[serde(rename = "read")]
52 Read,
53 #[serde(rename = "write")]
54 Write,
55 #[serde(rename = "subscribe-to-notifications")]
56 SubscribeToNotifications,
57 #[serde(rename = "unsubscribe-from-notifications")]
58 UnsubscribeFromNotifications,
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
64pub enum DescriptorOperationType {
65 #[default]
66 #[serde(rename = "read")]
67 Read,
68 #[serde(rename = "write")]
69 Write,
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize, Default)]
75#[serde(rename_all = "camelCase")]
76pub struct ManufacturerData<'a> {
77 key: i64,
81 data: Cow<'a, str>,
83}
84
85impl<'a> ManufacturerData<'a> {
86 pub fn builder(key: i64, data: impl Into<Cow<'a, str>>) -> ManufacturerDataBuilder<'a> {
87 ManufacturerDataBuilder {
88 key: key,
89 data: data.into(),
90 }
91 }
92 pub fn key(&self) -> i64 { self.key }
93 pub fn data(&self) -> &str { self.data.as_ref() }
94}
95
96
97pub struct ManufacturerDataBuilder<'a> {
98 key: i64,
99 data: Cow<'a, str>,
100}
101
102impl<'a> ManufacturerDataBuilder<'a> {
103 pub fn build(self) -> ManufacturerData<'a> {
104 ManufacturerData {
105 key: self.key,
106 data: self.data,
107 }
108 }
109}
110
111#[derive(Debug, Clone, Serialize, Deserialize, Default)]
114#[serde(rename_all = "camelCase")]
115pub struct ScanRecord<'a> {
116 #[serde(skip_serializing_if = "Option::is_none")]
117 name: Option<Cow<'a, str>>,
118 #[serde(skip_serializing_if = "Option::is_none")]
119 uuids: Option<Vec<Cow<'a, str>>>,
120 #[serde(skip_serializing_if = "Option::is_none")]
122 appearance: Option<i64>,
123 #[serde(skip_serializing_if = "Option::is_none")]
125 txPower: Option<i64>,
126 #[serde(skip_serializing_if = "Option::is_none")]
129 manufacturerData: Option<Vec<ManufacturerData<'a>>>,
130}
131
132impl<'a> ScanRecord<'a> {
133 pub fn builder() -> ScanRecordBuilder<'a> {
134 ScanRecordBuilder {
135 name: None,
136 uuids: None,
137 appearance: None,
138 txPower: None,
139 manufacturerData: None,
140 }
141 }
142 pub fn name(&self) -> Option<&str> { self.name.as_deref() }
143 pub fn uuids(&self) -> Option<&[Cow<'a, str>]> { self.uuids.as_deref() }
144 pub fn appearance(&self) -> Option<i64> { self.appearance }
145 pub fn txPower(&self) -> Option<i64> { self.txPower }
146 pub fn manufacturerData(&self) -> Option<&[ManufacturerData<'a>]> { self.manufacturerData.as_deref() }
147}
148
149#[derive(Default)]
150pub struct ScanRecordBuilder<'a> {
151 name: Option<Cow<'a, str>>,
152 uuids: Option<Vec<Cow<'a, str>>>,
153 appearance: Option<i64>,
154 txPower: Option<i64>,
155 manufacturerData: Option<Vec<ManufacturerData<'a>>>,
156}
157
158impl<'a> ScanRecordBuilder<'a> {
159 pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
160 pub fn uuids(mut self, uuids: Vec<Cow<'a, str>>) -> Self { self.uuids = Some(uuids); self }
161 pub fn appearance(mut self, appearance: i64) -> Self { self.appearance = Some(appearance); self }
163 pub fn txPower(mut self, txPower: i64) -> Self { self.txPower = Some(txPower); self }
165 pub fn manufacturerData(mut self, manufacturerData: Vec<ManufacturerData<'a>>) -> Self { self.manufacturerData = Some(manufacturerData); self }
168 pub fn build(self) -> ScanRecord<'a> {
169 ScanRecord {
170 name: self.name,
171 uuids: self.uuids,
172 appearance: self.appearance,
173 txPower: self.txPower,
174 manufacturerData: self.manufacturerData,
175 }
176 }
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize, Default)]
182#[serde(rename_all = "camelCase")]
183pub struct ScanEntry<'a> {
184 deviceAddress: Cow<'a, str>,
185 rssi: i64,
186 scanRecord: ScanRecord<'a>,
187}
188
189impl<'a> ScanEntry<'a> {
190 pub fn builder(deviceAddress: impl Into<Cow<'a, str>>, rssi: i64, scanRecord: ScanRecord<'a>) -> ScanEntryBuilder<'a> {
191 ScanEntryBuilder {
192 deviceAddress: deviceAddress.into(),
193 rssi: rssi,
194 scanRecord: scanRecord,
195 }
196 }
197 pub fn deviceAddress(&self) -> &str { self.deviceAddress.as_ref() }
198 pub fn rssi(&self) -> i64 { self.rssi }
199 pub fn scanRecord(&self) -> &ScanRecord<'a> { &self.scanRecord }
200}
201
202
203pub struct ScanEntryBuilder<'a> {
204 deviceAddress: Cow<'a, str>,
205 rssi: i64,
206 scanRecord: ScanRecord<'a>,
207}
208
209impl<'a> ScanEntryBuilder<'a> {
210 pub fn build(self) -> ScanEntry<'a> {
211 ScanEntry {
212 deviceAddress: self.deviceAddress,
213 rssi: self.rssi,
214 scanRecord: self.scanRecord,
215 }
216 }
217}
218
219#[derive(Debug, Clone, Serialize, Deserialize, Default)]
223#[serde(rename_all = "camelCase")]
224pub struct CharacteristicProperties {
225 #[serde(skip_serializing_if = "Option::is_none")]
226 broadcast: Option<bool>,
227 #[serde(skip_serializing_if = "Option::is_none")]
228 read: Option<bool>,
229 #[serde(skip_serializing_if = "Option::is_none")]
230 writeWithoutResponse: Option<bool>,
231 #[serde(skip_serializing_if = "Option::is_none")]
232 write: Option<bool>,
233 #[serde(skip_serializing_if = "Option::is_none")]
234 notify: Option<bool>,
235 #[serde(skip_serializing_if = "Option::is_none")]
236 indicate: Option<bool>,
237 #[serde(skip_serializing_if = "Option::is_none")]
238 authenticatedSignedWrites: Option<bool>,
239 #[serde(skip_serializing_if = "Option::is_none")]
240 extendedProperties: Option<bool>,
241}
242
243impl CharacteristicProperties {
244 pub fn builder() -> CharacteristicPropertiesBuilder {
245 CharacteristicPropertiesBuilder {
246 broadcast: None,
247 read: None,
248 writeWithoutResponse: None,
249 write: None,
250 notify: None,
251 indicate: None,
252 authenticatedSignedWrites: None,
253 extendedProperties: None,
254 }
255 }
256 pub fn broadcast(&self) -> Option<bool> { self.broadcast }
257 pub fn read(&self) -> Option<bool> { self.read }
258 pub fn writeWithoutResponse(&self) -> Option<bool> { self.writeWithoutResponse }
259 pub fn write(&self) -> Option<bool> { self.write }
260 pub fn notify(&self) -> Option<bool> { self.notify }
261 pub fn indicate(&self) -> Option<bool> { self.indicate }
262 pub fn authenticatedSignedWrites(&self) -> Option<bool> { self.authenticatedSignedWrites }
263 pub fn extendedProperties(&self) -> Option<bool> { self.extendedProperties }
264}
265
266#[derive(Default)]
267pub struct CharacteristicPropertiesBuilder {
268 broadcast: Option<bool>,
269 read: Option<bool>,
270 writeWithoutResponse: Option<bool>,
271 write: Option<bool>,
272 notify: Option<bool>,
273 indicate: Option<bool>,
274 authenticatedSignedWrites: Option<bool>,
275 extendedProperties: Option<bool>,
276}
277
278impl CharacteristicPropertiesBuilder {
279 pub fn broadcast(mut self, broadcast: bool) -> Self { self.broadcast = Some(broadcast); self }
280 pub fn read(mut self, read: bool) -> Self { self.read = Some(read); self }
281 pub fn writeWithoutResponse(mut self, writeWithoutResponse: bool) -> Self { self.writeWithoutResponse = Some(writeWithoutResponse); self }
282 pub fn write(mut self, write: bool) -> Self { self.write = Some(write); self }
283 pub fn notify(mut self, notify: bool) -> Self { self.notify = Some(notify); self }
284 pub fn indicate(mut self, indicate: bool) -> Self { self.indicate = Some(indicate); self }
285 pub fn authenticatedSignedWrites(mut self, authenticatedSignedWrites: bool) -> Self { self.authenticatedSignedWrites = Some(authenticatedSignedWrites); self }
286 pub fn extendedProperties(mut self, extendedProperties: bool) -> Self { self.extendedProperties = Some(extendedProperties); self }
287 pub fn build(self) -> CharacteristicProperties {
288 CharacteristicProperties {
289 broadcast: self.broadcast,
290 read: self.read,
291 writeWithoutResponse: self.writeWithoutResponse,
292 write: self.write,
293 notify: self.notify,
294 indicate: self.indicate,
295 authenticatedSignedWrites: self.authenticatedSignedWrites,
296 extendedProperties: self.extendedProperties,
297 }
298 }
299}
300
301#[derive(Debug, Clone, Serialize, Deserialize, Default)]
304#[serde(rename_all = "camelCase")]
305pub struct EnableParams {
306 state: CentralState,
308 leSupported: bool,
310}
311
312impl EnableParams {
313 pub fn builder(state: CentralState, leSupported: bool) -> EnableParamsBuilder {
314 EnableParamsBuilder {
315 state: state,
316 leSupported: leSupported,
317 }
318 }
319 pub fn state(&self) -> &CentralState { &self.state }
320 pub fn leSupported(&self) -> bool { self.leSupported }
321}
322
323
324pub struct EnableParamsBuilder {
325 state: CentralState,
326 leSupported: bool,
327}
328
329impl EnableParamsBuilder {
330 pub fn build(self) -> EnableParams {
331 EnableParams {
332 state: self.state,
333 leSupported: self.leSupported,
334 }
335 }
336}
337
338impl EnableParams { pub const METHOD: &'static str = "BluetoothEmulation.enable"; }
339
340impl<'a> crate::CdpCommand<'a> for EnableParams {
341 const METHOD: &'static str = "BluetoothEmulation.enable";
342 type Response = crate::EmptyReturns;
343}
344
345#[derive(Debug, Clone, Serialize, Deserialize, Default)]
348#[serde(rename_all = "camelCase")]
349pub struct SetSimulatedCentralStateParams {
350 state: CentralState,
352}
353
354impl SetSimulatedCentralStateParams {
355 pub fn builder(state: CentralState) -> SetSimulatedCentralStateParamsBuilder {
356 SetSimulatedCentralStateParamsBuilder {
357 state: state,
358 }
359 }
360 pub fn state(&self) -> &CentralState { &self.state }
361}
362
363
364pub struct SetSimulatedCentralStateParamsBuilder {
365 state: CentralState,
366}
367
368impl SetSimulatedCentralStateParamsBuilder {
369 pub fn build(self) -> SetSimulatedCentralStateParams {
370 SetSimulatedCentralStateParams {
371 state: self.state,
372 }
373 }
374}
375
376impl SetSimulatedCentralStateParams { pub const METHOD: &'static str = "BluetoothEmulation.setSimulatedCentralState"; }
377
378impl<'a> crate::CdpCommand<'a> for SetSimulatedCentralStateParams {
379 const METHOD: &'static str = "BluetoothEmulation.setSimulatedCentralState";
380 type Response = crate::EmptyReturns;
381}
382
383#[derive(Debug, Clone, Serialize, Deserialize, Default)]
384pub struct DisableParams {}
385
386impl DisableParams { pub const METHOD: &'static str = "BluetoothEmulation.disable"; }
387
388impl<'a> crate::CdpCommand<'a> for DisableParams {
389 const METHOD: &'static str = "BluetoothEmulation.disable";
390 type Response = crate::EmptyReturns;
391}
392
393#[derive(Debug, Clone, Serialize, Deserialize, Default)]
397#[serde(rename_all = "camelCase")]
398pub struct SimulatePreconnectedPeripheralParams<'a> {
399 address: Cow<'a, str>,
400 name: Cow<'a, str>,
401 manufacturerData: Vec<ManufacturerData<'a>>,
402 knownServiceUuids: Vec<Cow<'a, str>>,
403}
404
405impl<'a> SimulatePreconnectedPeripheralParams<'a> {
406 pub fn builder(address: impl Into<Cow<'a, str>>, name: impl Into<Cow<'a, str>>, manufacturerData: Vec<ManufacturerData<'a>>, knownServiceUuids: Vec<Cow<'a, str>>) -> SimulatePreconnectedPeripheralParamsBuilder<'a> {
407 SimulatePreconnectedPeripheralParamsBuilder {
408 address: address.into(),
409 name: name.into(),
410 manufacturerData: manufacturerData,
411 knownServiceUuids: knownServiceUuids,
412 }
413 }
414 pub fn address(&self) -> &str { self.address.as_ref() }
415 pub fn name(&self) -> &str { self.name.as_ref() }
416 pub fn manufacturerData(&self) -> &[ManufacturerData<'a>] { &self.manufacturerData }
417 pub fn knownServiceUuids(&self) -> &[Cow<'a, str>] { &self.knownServiceUuids }
418}
419
420
421pub struct SimulatePreconnectedPeripheralParamsBuilder<'a> {
422 address: Cow<'a, str>,
423 name: Cow<'a, str>,
424 manufacturerData: Vec<ManufacturerData<'a>>,
425 knownServiceUuids: Vec<Cow<'a, str>>,
426}
427
428impl<'a> SimulatePreconnectedPeripheralParamsBuilder<'a> {
429 pub fn build(self) -> SimulatePreconnectedPeripheralParams<'a> {
430 SimulatePreconnectedPeripheralParams {
431 address: self.address,
432 name: self.name,
433 manufacturerData: self.manufacturerData,
434 knownServiceUuids: self.knownServiceUuids,
435 }
436 }
437}
438
439impl<'a> SimulatePreconnectedPeripheralParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.simulatePreconnectedPeripheral"; }
440
441impl<'a> crate::CdpCommand<'a> for SimulatePreconnectedPeripheralParams<'a> {
442 const METHOD: &'static str = "BluetoothEmulation.simulatePreconnectedPeripheral";
443 type Response = crate::EmptyReturns;
444}
445
446#[derive(Debug, Clone, Serialize, Deserialize, Default)]
450#[serde(rename_all = "camelCase")]
451pub struct SimulateAdvertisementParams<'a> {
452 entry: ScanEntry<'a>,
453}
454
455impl<'a> SimulateAdvertisementParams<'a> {
456 pub fn builder(entry: ScanEntry<'a>) -> SimulateAdvertisementParamsBuilder<'a> {
457 SimulateAdvertisementParamsBuilder {
458 entry: entry,
459 }
460 }
461 pub fn entry(&self) -> &ScanEntry<'a> { &self.entry }
462}
463
464
465pub struct SimulateAdvertisementParamsBuilder<'a> {
466 entry: ScanEntry<'a>,
467}
468
469impl<'a> SimulateAdvertisementParamsBuilder<'a> {
470 pub fn build(self) -> SimulateAdvertisementParams<'a> {
471 SimulateAdvertisementParams {
472 entry: self.entry,
473 }
474 }
475}
476
477impl<'a> SimulateAdvertisementParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.simulateAdvertisement"; }
478
479impl<'a> crate::CdpCommand<'a> for SimulateAdvertisementParams<'a> {
480 const METHOD: &'static str = "BluetoothEmulation.simulateAdvertisement";
481 type Response = crate::EmptyReturns;
482}
483
484#[derive(Debug, Clone, Serialize, Deserialize, Default)]
489#[serde(rename_all = "camelCase")]
490pub struct SimulateGATTOperationResponseParams<'a> {
491 address: Cow<'a, str>,
492 #[serde(rename = "type")]
493 type_: GATTOperationType,
494 code: i64,
495}
496
497impl<'a> SimulateGATTOperationResponseParams<'a> {
498 pub fn builder(address: impl Into<Cow<'a, str>>, type_: GATTOperationType, code: i64) -> SimulateGATTOperationResponseParamsBuilder<'a> {
499 SimulateGATTOperationResponseParamsBuilder {
500 address: address.into(),
501 type_: type_,
502 code: code,
503 }
504 }
505 pub fn address(&self) -> &str { self.address.as_ref() }
506 pub fn type_(&self) -> &GATTOperationType { &self.type_ }
507 pub fn code(&self) -> i64 { self.code }
508}
509
510
511pub struct SimulateGATTOperationResponseParamsBuilder<'a> {
512 address: Cow<'a, str>,
513 type_: GATTOperationType,
514 code: i64,
515}
516
517impl<'a> SimulateGATTOperationResponseParamsBuilder<'a> {
518 pub fn build(self) -> SimulateGATTOperationResponseParams<'a> {
519 SimulateGATTOperationResponseParams {
520 address: self.address,
521 type_: self.type_,
522 code: self.code,
523 }
524 }
525}
526
527impl<'a> SimulateGATTOperationResponseParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.simulateGATTOperationResponse"; }
528
529impl<'a> crate::CdpCommand<'a> for SimulateGATTOperationResponseParams<'a> {
530 const METHOD: &'static str = "BluetoothEmulation.simulateGATTOperationResponse";
531 type Response = crate::EmptyReturns;
532}
533
534#[derive(Debug, Clone, Serialize, Deserialize, Default)]
541#[serde(rename_all = "camelCase")]
542pub struct SimulateCharacteristicOperationResponseParams<'a> {
543 characteristicId: Cow<'a, str>,
544 #[serde(rename = "type")]
545 type_: CharacteristicOperationType,
546 code: i64,
547 #[serde(skip_serializing_if = "Option::is_none")]
548 data: Option<Cow<'a, str>>,
549}
550
551impl<'a> SimulateCharacteristicOperationResponseParams<'a> {
552 pub fn builder(characteristicId: impl Into<Cow<'a, str>>, type_: CharacteristicOperationType, code: i64) -> SimulateCharacteristicOperationResponseParamsBuilder<'a> {
553 SimulateCharacteristicOperationResponseParamsBuilder {
554 characteristicId: characteristicId.into(),
555 type_: type_,
556 code: code,
557 data: None,
558 }
559 }
560 pub fn characteristicId(&self) -> &str { self.characteristicId.as_ref() }
561 pub fn type_(&self) -> &CharacteristicOperationType { &self.type_ }
562 pub fn code(&self) -> i64 { self.code }
563 pub fn data(&self) -> Option<&str> { self.data.as_deref() }
564}
565
566
567pub struct SimulateCharacteristicOperationResponseParamsBuilder<'a> {
568 characteristicId: Cow<'a, str>,
569 type_: CharacteristicOperationType,
570 code: i64,
571 data: Option<Cow<'a, str>>,
572}
573
574impl<'a> SimulateCharacteristicOperationResponseParamsBuilder<'a> {
575 pub fn data(mut self, data: impl Into<Cow<'a, str>>) -> Self { self.data = Some(data.into()); self }
576 pub fn build(self) -> SimulateCharacteristicOperationResponseParams<'a> {
577 SimulateCharacteristicOperationResponseParams {
578 characteristicId: self.characteristicId,
579 type_: self.type_,
580 code: self.code,
581 data: self.data,
582 }
583 }
584}
585
586impl<'a> SimulateCharacteristicOperationResponseParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.simulateCharacteristicOperationResponse"; }
587
588impl<'a> crate::CdpCommand<'a> for SimulateCharacteristicOperationResponseParams<'a> {
589 const METHOD: &'static str = "BluetoothEmulation.simulateCharacteristicOperationResponse";
590 type Response = crate::EmptyReturns;
591}
592
593#[derive(Debug, Clone, Serialize, Deserialize, Default)]
600#[serde(rename_all = "camelCase")]
601pub struct SimulateDescriptorOperationResponseParams<'a> {
602 descriptorId: Cow<'a, str>,
603 #[serde(rename = "type")]
604 type_: DescriptorOperationType,
605 code: i64,
606 #[serde(skip_serializing_if = "Option::is_none")]
607 data: Option<Cow<'a, str>>,
608}
609
610impl<'a> SimulateDescriptorOperationResponseParams<'a> {
611 pub fn builder(descriptorId: impl Into<Cow<'a, str>>, type_: DescriptorOperationType, code: i64) -> SimulateDescriptorOperationResponseParamsBuilder<'a> {
612 SimulateDescriptorOperationResponseParamsBuilder {
613 descriptorId: descriptorId.into(),
614 type_: type_,
615 code: code,
616 data: None,
617 }
618 }
619 pub fn descriptorId(&self) -> &str { self.descriptorId.as_ref() }
620 pub fn type_(&self) -> &DescriptorOperationType { &self.type_ }
621 pub fn code(&self) -> i64 { self.code }
622 pub fn data(&self) -> Option<&str> { self.data.as_deref() }
623}
624
625
626pub struct SimulateDescriptorOperationResponseParamsBuilder<'a> {
627 descriptorId: Cow<'a, str>,
628 type_: DescriptorOperationType,
629 code: i64,
630 data: Option<Cow<'a, str>>,
631}
632
633impl<'a> SimulateDescriptorOperationResponseParamsBuilder<'a> {
634 pub fn data(mut self, data: impl Into<Cow<'a, str>>) -> Self { self.data = Some(data.into()); self }
635 pub fn build(self) -> SimulateDescriptorOperationResponseParams<'a> {
636 SimulateDescriptorOperationResponseParams {
637 descriptorId: self.descriptorId,
638 type_: self.type_,
639 code: self.code,
640 data: self.data,
641 }
642 }
643}
644
645impl<'a> SimulateDescriptorOperationResponseParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.simulateDescriptorOperationResponse"; }
646
647impl<'a> crate::CdpCommand<'a> for SimulateDescriptorOperationResponseParams<'a> {
648 const METHOD: &'static str = "BluetoothEmulation.simulateDescriptorOperationResponse";
649 type Response = crate::EmptyReturns;
650}
651
652#[derive(Debug, Clone, Serialize, Deserialize, Default)]
655#[serde(rename_all = "camelCase")]
656pub struct AddServiceParams<'a> {
657 address: Cow<'a, str>,
658 serviceUuid: Cow<'a, str>,
659}
660
661impl<'a> AddServiceParams<'a> {
662 pub fn builder(address: impl Into<Cow<'a, str>>, serviceUuid: impl Into<Cow<'a, str>>) -> AddServiceParamsBuilder<'a> {
663 AddServiceParamsBuilder {
664 address: address.into(),
665 serviceUuid: serviceUuid.into(),
666 }
667 }
668 pub fn address(&self) -> &str { self.address.as_ref() }
669 pub fn serviceUuid(&self) -> &str { self.serviceUuid.as_ref() }
670}
671
672
673pub struct AddServiceParamsBuilder<'a> {
674 address: Cow<'a, str>,
675 serviceUuid: Cow<'a, str>,
676}
677
678impl<'a> AddServiceParamsBuilder<'a> {
679 pub fn build(self) -> AddServiceParams<'a> {
680 AddServiceParams {
681 address: self.address,
682 serviceUuid: self.serviceUuid,
683 }
684 }
685}
686
687#[derive(Debug, Clone, Serialize, Deserialize, Default)]
690#[serde(rename_all = "camelCase")]
691pub struct AddServiceReturns<'a> {
692 serviceId: Cow<'a, str>,
694}
695
696impl<'a> AddServiceReturns<'a> {
697 pub fn builder(serviceId: impl Into<Cow<'a, str>>) -> AddServiceReturnsBuilder<'a> {
698 AddServiceReturnsBuilder {
699 serviceId: serviceId.into(),
700 }
701 }
702 pub fn serviceId(&self) -> &str { self.serviceId.as_ref() }
703}
704
705
706pub struct AddServiceReturnsBuilder<'a> {
707 serviceId: Cow<'a, str>,
708}
709
710impl<'a> AddServiceReturnsBuilder<'a> {
711 pub fn build(self) -> AddServiceReturns<'a> {
712 AddServiceReturns {
713 serviceId: self.serviceId,
714 }
715 }
716}
717
718impl<'a> AddServiceParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.addService"; }
719
720impl<'a> crate::CdpCommand<'a> for AddServiceParams<'a> {
721 const METHOD: &'static str = "BluetoothEmulation.addService";
722 type Response = AddServiceReturns<'a>;
723}
724
725#[derive(Debug, Clone, Serialize, Deserialize, Default)]
728#[serde(rename_all = "camelCase")]
729pub struct RemoveServiceParams<'a> {
730 serviceId: Cow<'a, str>,
731}
732
733impl<'a> RemoveServiceParams<'a> {
734 pub fn builder(serviceId: impl Into<Cow<'a, str>>) -> RemoveServiceParamsBuilder<'a> {
735 RemoveServiceParamsBuilder {
736 serviceId: serviceId.into(),
737 }
738 }
739 pub fn serviceId(&self) -> &str { self.serviceId.as_ref() }
740}
741
742
743pub struct RemoveServiceParamsBuilder<'a> {
744 serviceId: Cow<'a, str>,
745}
746
747impl<'a> RemoveServiceParamsBuilder<'a> {
748 pub fn build(self) -> RemoveServiceParams<'a> {
749 RemoveServiceParams {
750 serviceId: self.serviceId,
751 }
752 }
753}
754
755impl<'a> RemoveServiceParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.removeService"; }
756
757impl<'a> crate::CdpCommand<'a> for RemoveServiceParams<'a> {
758 const METHOD: &'static str = "BluetoothEmulation.removeService";
759 type Response = crate::EmptyReturns;
760}
761
762#[derive(Debug, Clone, Serialize, Deserialize, Default)]
766#[serde(rename_all = "camelCase")]
767pub struct AddCharacteristicParams<'a> {
768 serviceId: Cow<'a, str>,
769 characteristicUuid: Cow<'a, str>,
770 properties: CharacteristicProperties,
771}
772
773impl<'a> AddCharacteristicParams<'a> {
774 pub fn builder(serviceId: impl Into<Cow<'a, str>>, characteristicUuid: impl Into<Cow<'a, str>>, properties: CharacteristicProperties) -> AddCharacteristicParamsBuilder<'a> {
775 AddCharacteristicParamsBuilder {
776 serviceId: serviceId.into(),
777 characteristicUuid: characteristicUuid.into(),
778 properties: properties,
779 }
780 }
781 pub fn serviceId(&self) -> &str { self.serviceId.as_ref() }
782 pub fn characteristicUuid(&self) -> &str { self.characteristicUuid.as_ref() }
783 pub fn properties(&self) -> &CharacteristicProperties { &self.properties }
784}
785
786
787pub struct AddCharacteristicParamsBuilder<'a> {
788 serviceId: Cow<'a, str>,
789 characteristicUuid: Cow<'a, str>,
790 properties: CharacteristicProperties,
791}
792
793impl<'a> AddCharacteristicParamsBuilder<'a> {
794 pub fn build(self) -> AddCharacteristicParams<'a> {
795 AddCharacteristicParams {
796 serviceId: self.serviceId,
797 characteristicUuid: self.characteristicUuid,
798 properties: self.properties,
799 }
800 }
801}
802
803#[derive(Debug, Clone, Serialize, Deserialize, Default)]
807#[serde(rename_all = "camelCase")]
808pub struct AddCharacteristicReturns<'a> {
809 characteristicId: Cow<'a, str>,
811}
812
813impl<'a> AddCharacteristicReturns<'a> {
814 pub fn builder(characteristicId: impl Into<Cow<'a, str>>) -> AddCharacteristicReturnsBuilder<'a> {
815 AddCharacteristicReturnsBuilder {
816 characteristicId: characteristicId.into(),
817 }
818 }
819 pub fn characteristicId(&self) -> &str { self.characteristicId.as_ref() }
820}
821
822
823pub struct AddCharacteristicReturnsBuilder<'a> {
824 characteristicId: Cow<'a, str>,
825}
826
827impl<'a> AddCharacteristicReturnsBuilder<'a> {
828 pub fn build(self) -> AddCharacteristicReturns<'a> {
829 AddCharacteristicReturns {
830 characteristicId: self.characteristicId,
831 }
832 }
833}
834
835impl<'a> AddCharacteristicParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.addCharacteristic"; }
836
837impl<'a> crate::CdpCommand<'a> for AddCharacteristicParams<'a> {
838 const METHOD: &'static str = "BluetoothEmulation.addCharacteristic";
839 type Response = AddCharacteristicReturns<'a>;
840}
841
842#[derive(Debug, Clone, Serialize, Deserialize, Default)]
846#[serde(rename_all = "camelCase")]
847pub struct RemoveCharacteristicParams<'a> {
848 characteristicId: Cow<'a, str>,
849}
850
851impl<'a> RemoveCharacteristicParams<'a> {
852 pub fn builder(characteristicId: impl Into<Cow<'a, str>>) -> RemoveCharacteristicParamsBuilder<'a> {
853 RemoveCharacteristicParamsBuilder {
854 characteristicId: characteristicId.into(),
855 }
856 }
857 pub fn characteristicId(&self) -> &str { self.characteristicId.as_ref() }
858}
859
860
861pub struct RemoveCharacteristicParamsBuilder<'a> {
862 characteristicId: Cow<'a, str>,
863}
864
865impl<'a> RemoveCharacteristicParamsBuilder<'a> {
866 pub fn build(self) -> RemoveCharacteristicParams<'a> {
867 RemoveCharacteristicParams {
868 characteristicId: self.characteristicId,
869 }
870 }
871}
872
873impl<'a> RemoveCharacteristicParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.removeCharacteristic"; }
874
875impl<'a> crate::CdpCommand<'a> for RemoveCharacteristicParams<'a> {
876 const METHOD: &'static str = "BluetoothEmulation.removeCharacteristic";
877 type Response = crate::EmptyReturns;
878}
879
880#[derive(Debug, Clone, Serialize, Deserialize, Default)]
884#[serde(rename_all = "camelCase")]
885pub struct AddDescriptorParams<'a> {
886 characteristicId: Cow<'a, str>,
887 descriptorUuid: Cow<'a, str>,
888}
889
890impl<'a> AddDescriptorParams<'a> {
891 pub fn builder(characteristicId: impl Into<Cow<'a, str>>, descriptorUuid: impl Into<Cow<'a, str>>) -> AddDescriptorParamsBuilder<'a> {
892 AddDescriptorParamsBuilder {
893 characteristicId: characteristicId.into(),
894 descriptorUuid: descriptorUuid.into(),
895 }
896 }
897 pub fn characteristicId(&self) -> &str { self.characteristicId.as_ref() }
898 pub fn descriptorUuid(&self) -> &str { self.descriptorUuid.as_ref() }
899}
900
901
902pub struct AddDescriptorParamsBuilder<'a> {
903 characteristicId: Cow<'a, str>,
904 descriptorUuid: Cow<'a, str>,
905}
906
907impl<'a> AddDescriptorParamsBuilder<'a> {
908 pub fn build(self) -> AddDescriptorParams<'a> {
909 AddDescriptorParams {
910 characteristicId: self.characteristicId,
911 descriptorUuid: self.descriptorUuid,
912 }
913 }
914}
915
916#[derive(Debug, Clone, Serialize, Deserialize, Default)]
920#[serde(rename_all = "camelCase")]
921pub struct AddDescriptorReturns<'a> {
922 descriptorId: Cow<'a, str>,
924}
925
926impl<'a> AddDescriptorReturns<'a> {
927 pub fn builder(descriptorId: impl Into<Cow<'a, str>>) -> AddDescriptorReturnsBuilder<'a> {
928 AddDescriptorReturnsBuilder {
929 descriptorId: descriptorId.into(),
930 }
931 }
932 pub fn descriptorId(&self) -> &str { self.descriptorId.as_ref() }
933}
934
935
936pub struct AddDescriptorReturnsBuilder<'a> {
937 descriptorId: Cow<'a, str>,
938}
939
940impl<'a> AddDescriptorReturnsBuilder<'a> {
941 pub fn build(self) -> AddDescriptorReturns<'a> {
942 AddDescriptorReturns {
943 descriptorId: self.descriptorId,
944 }
945 }
946}
947
948impl<'a> AddDescriptorParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.addDescriptor"; }
949
950impl<'a> crate::CdpCommand<'a> for AddDescriptorParams<'a> {
951 const METHOD: &'static str = "BluetoothEmulation.addDescriptor";
952 type Response = AddDescriptorReturns<'a>;
953}
954
955#[derive(Debug, Clone, Serialize, Deserialize, Default)]
958#[serde(rename_all = "camelCase")]
959pub struct RemoveDescriptorParams<'a> {
960 descriptorId: Cow<'a, str>,
961}
962
963impl<'a> RemoveDescriptorParams<'a> {
964 pub fn builder(descriptorId: impl Into<Cow<'a, str>>) -> RemoveDescriptorParamsBuilder<'a> {
965 RemoveDescriptorParamsBuilder {
966 descriptorId: descriptorId.into(),
967 }
968 }
969 pub fn descriptorId(&self) -> &str { self.descriptorId.as_ref() }
970}
971
972
973pub struct RemoveDescriptorParamsBuilder<'a> {
974 descriptorId: Cow<'a, str>,
975}
976
977impl<'a> RemoveDescriptorParamsBuilder<'a> {
978 pub fn build(self) -> RemoveDescriptorParams<'a> {
979 RemoveDescriptorParams {
980 descriptorId: self.descriptorId,
981 }
982 }
983}
984
985impl<'a> RemoveDescriptorParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.removeDescriptor"; }
986
987impl<'a> crate::CdpCommand<'a> for RemoveDescriptorParams<'a> {
988 const METHOD: &'static str = "BluetoothEmulation.removeDescriptor";
989 type Response = crate::EmptyReturns;
990}
991
992#[derive(Debug, Clone, Serialize, Deserialize, Default)]
995#[serde(rename_all = "camelCase")]
996pub struct SimulateGATTDisconnectionParams<'a> {
997 address: Cow<'a, str>,
998}
999
1000impl<'a> SimulateGATTDisconnectionParams<'a> {
1001 pub fn builder(address: impl Into<Cow<'a, str>>) -> SimulateGATTDisconnectionParamsBuilder<'a> {
1002 SimulateGATTDisconnectionParamsBuilder {
1003 address: address.into(),
1004 }
1005 }
1006 pub fn address(&self) -> &str { self.address.as_ref() }
1007}
1008
1009
1010pub struct SimulateGATTDisconnectionParamsBuilder<'a> {
1011 address: Cow<'a, str>,
1012}
1013
1014impl<'a> SimulateGATTDisconnectionParamsBuilder<'a> {
1015 pub fn build(self) -> SimulateGATTDisconnectionParams<'a> {
1016 SimulateGATTDisconnectionParams {
1017 address: self.address,
1018 }
1019 }
1020}
1021
1022impl<'a> SimulateGATTDisconnectionParams<'a> { pub const METHOD: &'static str = "BluetoothEmulation.simulateGATTDisconnection"; }
1023
1024impl<'a> crate::CdpCommand<'a> for SimulateGATTDisconnectionParams<'a> {
1025 const METHOD: &'static str = "BluetoothEmulation.simulateGATTDisconnection";
1026 type Response = crate::EmptyReturns;
1027}