1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
///命令 marker、完整参数与成功响应。
pub mod commands;
///事件 marker 和拥有型事件参数。
pub mod events;
///命名协议类型;不包含连接状态。
pub mod types;
///薄 Domain 视图,仅借用 Session;创建不发送数据。协议来源:BluetoothEmulation。
///
///协议原文:
///
///<pre>This domain allows configuring virtual Bluetooth devices to test
///the web-bluetooth API.</pre>
///
///此项为 experimental,端点可能不支持。
pub struct Domain<'a> {
///借用的通信路由,生命周期不超过 Session。
pub(super) session: &'a ydp_core::Session,
}
impl<'a> Domain<'a> {
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.addCharacteristic。
///
///协议原文:
///
///<pre>Adds a characteristic with |characteristicUuid| and |properties| to the
///service represented by |serviceId|.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::AddCharacteristicParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().add_characteristic(params).await?;
///# Ok(())
///# }
///```
pub fn add_characteristic(
&self,
params: commands::AddCharacteristicParams,
) -> ydp_core::Request<commands::AddCharacteristic> {
self.session.send::<commands::AddCharacteristic>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.addDescriptor。
///
///协议原文:
///
///<pre>Adds a descriptor with |descriptorUuid| to the characteristic respresented
///by |characteristicId|.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::AddDescriptorParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().add_descriptor(params).await?;
///# Ok(())
///# }
///```
pub fn add_descriptor(
&self,
params: commands::AddDescriptorParams,
) -> ydp_core::Request<commands::AddDescriptor> {
self.session.send::<commands::AddDescriptor>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.addService。
///
///协议原文:
///
///<pre>Adds a service with |serviceUuid| to the peripheral with |address|.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::AddServiceParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().add_service(params).await?;
///# Ok(())
///# }
///```
pub fn add_service(
&self,
params: commands::AddServiceParams,
) -> ydp_core::Request<commands::AddService> {
self.session.send::<commands::AddService>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.disable。
///
///协议原文:
///
///<pre>Disable the BluetoothEmulation domain.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::DisableParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().disable(params).await?;
///# Ok(())
///# }
///```
pub fn disable(&self, params: commands::DisableParams) -> ydp_core::Request<commands::Disable> {
self.session.send::<commands::Disable>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.enable。
///
///协议原文:
///
///<pre>Enable the BluetoothEmulation domain.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::EnableParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().enable(params).await?;
///# Ok(())
///# }
///```
pub fn enable(&self, params: commands::EnableParams) -> ydp_core::Request<commands::Enable> {
self.session.send::<commands::Enable>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.removeCharacteristic。
///
///协议原文:
///
///<pre>Removes the characteristic respresented by |characteristicId| from the
///simulated central.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::RemoveCharacteristicParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().remove_characteristic(params).await?;
///# Ok(())
///# }
///```
pub fn remove_characteristic(
&self,
params: commands::RemoveCharacteristicParams,
) -> ydp_core::Request<commands::RemoveCharacteristic> {
self.session.send::<commands::RemoveCharacteristic>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.removeDescriptor。
///
///协议原文:
///
///<pre>Removes the descriptor with |descriptorId| from the simulated central.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::RemoveDescriptorParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().remove_descriptor(params).await?;
///# Ok(())
///# }
///```
pub fn remove_descriptor(
&self,
params: commands::RemoveDescriptorParams,
) -> ydp_core::Request<commands::RemoveDescriptor> {
self.session.send::<commands::RemoveDescriptor>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.removeService。
///
///协议原文:
///
///<pre>Removes the service respresented by |serviceId| from the simulated central.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::RemoveServiceParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().remove_service(params).await?;
///# Ok(())
///# }
///```
pub fn remove_service(
&self,
params: commands::RemoveServiceParams,
) -> ydp_core::Request<commands::RemoveService> {
self.session.send::<commands::RemoveService>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.setSimulatedCentralState。
///
///协议原文:
///
///<pre>Set the state of the simulated central.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::SetSimulatedCentralStateParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().set_simulated_central_state(params).await?;
///# Ok(())
///# }
///```
pub fn set_simulated_central_state(
&self,
params: commands::SetSimulatedCentralStateParams,
) -> ydp_core::Request<commands::SetSimulatedCentralState> {
self.session
.send::<commands::SetSimulatedCentralState>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.simulateAdvertisement。
///
///协议原文:
///
///<pre>Simulates an advertisement packet described in |entry| being received by
///the central.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::SimulateAdvertisementParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().simulate_advertisement(params).await?;
///# Ok(())
///# }
///```
pub fn simulate_advertisement(
&self,
params: commands::SimulateAdvertisementParams,
) -> ydp_core::Request<commands::SimulateAdvertisement> {
self.session.send::<commands::SimulateAdvertisement>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.simulateCharacteristicOperationResponse。
///
///协议原文:
///
///<pre>Simulates the response from the characteristic with |characteristicId| for a
///characteristic operation of |type|. The |code| value follows the Error
///Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.
///The |data| is expected to exist when simulating a successful read operation
///response.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::SimulateCharacteristicOperationResponseParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().simulate_characteristic_operation_response(params).await?;
///# Ok(())
///# }
///```
pub fn simulate_characteristic_operation_response(
&self,
params: commands::SimulateCharacteristicOperationResponseParams,
) -> ydp_core::Request<commands::SimulateCharacteristicOperationResponse> {
self.session
.send::<commands::SimulateCharacteristicOperationResponse>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.simulateDescriptorOperationResponse。
///
///协议原文:
///
///<pre>Simulates the response from the descriptor with |descriptorId| for a
///descriptor operation of |type|. The |code| value follows the Error
///Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.
///The |data| is expected to exist when simulating a successful read operation
///response.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::SimulateDescriptorOperationResponseParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().simulate_descriptor_operation_response(params).await?;
///# Ok(())
///# }
///```
pub fn simulate_descriptor_operation_response(
&self,
params: commands::SimulateDescriptorOperationResponseParams,
) -> ydp_core::Request<commands::SimulateDescriptorOperationResponse> {
self.session
.send::<commands::SimulateDescriptorOperationResponse>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.simulateGATTDisconnection。
///
///协议原文:
///
///<pre>Simulates a GATT disconnection from the peripheral with |address|.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::SimulateGattDisconnectionParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().simulate_gatt_disconnection(params).await?;
///# Ok(())
///# }
///```
pub fn simulate_gatt_disconnection(
&self,
params: commands::SimulateGattDisconnectionParams,
) -> ydp_core::Request<commands::SimulateGattDisconnection> {
self.session
.send::<commands::SimulateGattDisconnection>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.simulateGATTOperationResponse。
///
///协议原文:
///
///<pre>Simulates the response code from the peripheral with |address| for a
///GATT operation of |type|. The |code| value follows the HCI Error Codes from
///Bluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::SimulateGattOperationResponseParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().simulate_gatt_operation_response(params).await?;
///# Ok(())
///# }
///```
pub fn simulate_gatt_operation_response(
&self,
params: commands::SimulateGattOperationResponseParams,
) -> ydp_core::Request<commands::SimulateGattOperationResponse> {
self.session
.send::<commands::SimulateGattOperationResponse>(params)
}
///拥有参数并返回冷 Request;首次 poll 才提交,Drop 仅结束本地等待,发布后远端可能继续执行。协议来源:BluetoothEmulation.command.simulatePreconnectedPeripheral。
///
///协议原文:
///
///<pre>Simulates a peripheral with |address|, |name| and |knownServiceUuids|
///that has already been connected to the system.</pre>
///
///
///
///```no_run
///use ydp::SessionDomains as _;
///# async fn call(session: &ydp_core::Session, params: ydp::bluetooth_emulation::commands::SimulatePreconnectedPeripheralParams) -> ydp_core::Result<()> {
///let response = session.bluetooth_emulation().simulate_preconnected_peripheral(params).await?;
///# Ok(())
///# }
///```
pub fn simulate_preconnected_peripheral(
&self,
params: commands::SimulatePreconnectedPeripheralParams,
) -> ydp_core::Request<commands::SimulatePreconnectedPeripheral> {
self.session
.send::<commands::SimulatePreconnectedPeripheral>(params)
}
}