27
27
import z from 'zod' ;
28
28
29
29
export namespace Bluetooth {
30
- export const BluetoothServiceUuidSchema = z . lazy ( ( ) => z . string ( ) ) ;
30
+ export const BluetoothUuidSchema = z . lazy ( ( ) => z . string ( ) ) ;
31
31
}
32
32
export namespace Bluetooth {
33
33
export const BluetoothManufacturerDataSchema = z . lazy ( ( ) =>
@@ -37,6 +37,20 @@ export namespace Bluetooth {
37
37
} ) ,
38
38
) ;
39
39
}
40
+ export namespace Bluetooth {
41
+ export const CharacteristicPropertiesSchema = z . lazy ( ( ) =>
42
+ z . object ( {
43
+ broadcast : z . boolean ( ) . optional ( ) ,
44
+ read : z . boolean ( ) . optional ( ) ,
45
+ writeWithoutResponse : z . boolean ( ) . optional ( ) ,
46
+ write : z . boolean ( ) . optional ( ) ,
47
+ notify : z . boolean ( ) . optional ( ) ,
48
+ indicate : z . boolean ( ) . optional ( ) ,
49
+ authenticatedSignedWrites : z . boolean ( ) . optional ( ) ,
50
+ extendedProperties : z . boolean ( ) . optional ( ) ,
51
+ } ) ,
52
+ ) ;
53
+ }
40
54
export namespace Bluetooth {
41
55
export const RequestDeviceSchema = z . lazy ( ( ) => z . string ( ) ) ;
42
56
}
@@ -55,7 +69,7 @@ export namespace Bluetooth {
55
69
export const ScanRecordSchema = z . lazy ( ( ) =>
56
70
z . object ( {
57
71
name : z . string ( ) . optional ( ) ,
58
- uuids : z . array ( Bluetooth . BluetoothServiceUuidSchema ) . optional ( ) ,
72
+ uuids : z . array ( Bluetooth . BluetoothUuidSchema ) . optional ( ) ,
59
73
appearance : z . number ( ) . optional ( ) ,
60
74
manufacturerData : z
61
75
. array ( Bluetooth . BluetoothManufacturerDataSchema )
@@ -72,6 +86,11 @@ export const BluetoothCommandSchema = z.lazy(() =>
72
86
Bluetooth . SimulateAdvertisementSchema ,
73
87
Bluetooth . SimulateGattConnectionResponseSchema ,
74
88
Bluetooth . SimulateGattDisconnectionSchema ,
89
+ Bluetooth . SimulateServiceSchema ,
90
+ Bluetooth . SimulateCharacteristicSchema ,
91
+ Bluetooth . SimulateCharacteristicResponseSchema ,
92
+ Bluetooth . SimulateDescriptorSchema ,
93
+ Bluetooth . SimulateDescriptorResponseSchema ,
75
94
z . object ( { } ) ,
76
95
] ) ,
77
96
) ;
@@ -160,7 +179,7 @@ export namespace Bluetooth {
160
179
address : z . string ( ) ,
161
180
name : z . string ( ) ,
162
181
manufacturerData : z . array ( Bluetooth . BluetoothManufacturerDataSchema ) ,
163
- knownServiceUuids : z . array ( Bluetooth . BluetoothServiceUuidSchema ) ,
182
+ knownServiceUuids : z . array ( Bluetooth . BluetoothUuidSchema ) ,
164
183
} ) ,
165
184
) ;
166
185
}
@@ -222,6 +241,111 @@ export namespace Bluetooth {
222
241
} ) ,
223
242
) ;
224
243
}
244
+ export namespace Bluetooth {
245
+ export const SimulateServiceSchema = z . lazy ( ( ) =>
246
+ z . object ( {
247
+ method : z . literal ( 'bluetooth.simulateService' ) ,
248
+ params : Bluetooth . SimulateServiceParametersSchema ,
249
+ } ) ,
250
+ ) ;
251
+ }
252
+ export namespace Bluetooth {
253
+ export const SimulateServiceParametersSchema = z . lazy ( ( ) =>
254
+ z . object ( {
255
+ context : z . string ( ) ,
256
+ address : z . string ( ) ,
257
+ uuid : Bluetooth . BluetoothUuidSchema ,
258
+ type : z . enum ( [ 'add' , 'remove' ] ) ,
259
+ } ) ,
260
+ ) ;
261
+ }
262
+ export namespace Bluetooth {
263
+ export const SimulateCharacteristicSchema = z . lazy ( ( ) =>
264
+ z . object ( {
265
+ method : z . literal ( 'bluetooth.simulateCharacteristic' ) ,
266
+ params : Bluetooth . SimulateCharacteristicParametersSchema ,
267
+ } ) ,
268
+ ) ;
269
+ }
270
+ export namespace Bluetooth {
271
+ export const SimulateCharacteristicParametersSchema = z . lazy ( ( ) =>
272
+ z . object ( {
273
+ context : z . string ( ) ,
274
+ address : z . string ( ) ,
275
+ serviceUuid : Bluetooth . BluetoothUuidSchema ,
276
+ characteristicUuid : Bluetooth . BluetoothUuidSchema ,
277
+ characteristicProperties :
278
+ Bluetooth . CharacteristicPropertiesSchema . optional ( ) ,
279
+ type : z . enum ( [ 'add' , 'remove' ] ) ,
280
+ } ) ,
281
+ ) ;
282
+ }
283
+ export namespace Bluetooth {
284
+ export const SimulateCharacteristicResponseSchema = z . lazy ( ( ) =>
285
+ z . object ( {
286
+ method : z . literal ( 'bluetooth.simulateCharacteristicResponse' ) ,
287
+ params : Bluetooth . SimulateCharacteristicResponseParametersSchema ,
288
+ } ) ,
289
+ ) ;
290
+ }
291
+ export namespace Bluetooth {
292
+ export const SimulateCharacteristicResponseParametersSchema = z . lazy ( ( ) =>
293
+ z . object ( {
294
+ context : z . string ( ) ,
295
+ address : z . string ( ) ,
296
+ serviceUuid : Bluetooth . BluetoothUuidSchema ,
297
+ characteristicUuid : Bluetooth . BluetoothUuidSchema ,
298
+ type : z . enum ( [
299
+ 'read' ,
300
+ 'write' ,
301
+ 'subscribe-to-notifications' ,
302
+ 'unsubscribe-from-notifications' ,
303
+ ] ) ,
304
+ code : z . number ( ) . int ( ) . nonnegative ( ) ,
305
+ } ) ,
306
+ ) ;
307
+ }
308
+ export namespace Bluetooth {
309
+ export const SimulateDescriptorSchema = z . lazy ( ( ) =>
310
+ z . object ( {
311
+ method : z . literal ( 'bluetooth.simulateDescriptor' ) ,
312
+ params : Bluetooth . SimulateDescriptorParametersSchema ,
313
+ } ) ,
314
+ ) ;
315
+ }
316
+ export namespace Bluetooth {
317
+ export const SimulateDescriptorParametersSchema = z . lazy ( ( ) =>
318
+ z . object ( {
319
+ context : z . string ( ) ,
320
+ address : z . string ( ) ,
321
+ serviceUuid : Bluetooth . BluetoothUuidSchema ,
322
+ characteristicUuid : Bluetooth . BluetoothUuidSchema ,
323
+ descriptorUuid : Bluetooth . BluetoothUuidSchema ,
324
+ type : z . enum ( [ 'add' , 'remove' ] ) ,
325
+ } ) ,
326
+ ) ;
327
+ }
328
+ export namespace Bluetooth {
329
+ export const SimulateDescriptorResponseSchema = z . lazy ( ( ) =>
330
+ z . object ( {
331
+ method : z . literal ( 'bluetooth.simulateDescriptorResponse' ) ,
332
+ params : Bluetooth . SimulateDescriptorResponseParametersSchema ,
333
+ } ) ,
334
+ ) ;
335
+ }
336
+ export namespace Bluetooth {
337
+ export const SimulateDescriptorResponseParametersSchema = z . lazy ( ( ) =>
338
+ z . object ( {
339
+ context : z . string ( ) ,
340
+ address : z . string ( ) ,
341
+ serviceUuid : Bluetooth . BluetoothUuidSchema ,
342
+ characteristicUuid : Bluetooth . BluetoothUuidSchema ,
343
+ descriptorUuid : Bluetooth . BluetoothUuidSchema ,
344
+ type : z . enum ( [ 'read' , 'write' ] ) ,
345
+ code : z . number ( ) . int ( ) . nonnegative ( ) ,
346
+ } ) ,
347
+ ) ;
348
+ }
225
349
export namespace Bluetooth {
226
350
export const RequestDevicePromptUpdatedSchema = z . lazy ( ( ) =>
227
351
z . object ( {
@@ -255,3 +379,50 @@ export namespace Bluetooth {
255
379
} ) ,
256
380
) ;
257
381
}
382
+ export namespace Bluetooth {
383
+ export const CharacteristicEventGeneratedSchema = z . lazy ( ( ) =>
384
+ z . object ( {
385
+ method : z . literal ( 'bluetooth.characteristicEventGenerated' ) ,
386
+ params : Bluetooth . CharacteristicEventGeneratedParametersSchema ,
387
+ } ) ,
388
+ ) ;
389
+ }
390
+ export namespace Bluetooth {
391
+ export const CharacteristicEventGeneratedParametersSchema = z . lazy ( ( ) =>
392
+ z . object ( {
393
+ context : z . string ( ) ,
394
+ address : z . string ( ) ,
395
+ serviceUuid : Bluetooth . BluetoothUuidSchema ,
396
+ characteristicUuid : Bluetooth . BluetoothUuidSchema ,
397
+ type : z . enum ( [
398
+ 'read' ,
399
+ 'write-with-response' ,
400
+ 'write-without-response' ,
401
+ 'subscribe-to-notifications' ,
402
+ 'unsubscribe-from-notifications' ,
403
+ ] ) ,
404
+ data : z . array ( z . number ( ) . int ( ) . nonnegative ( ) ) . optional ( ) ,
405
+ } ) ,
406
+ ) ;
407
+ }
408
+ export namespace Bluetooth {
409
+ export const DescriptorEventGeneratedSchema = z . lazy ( ( ) =>
410
+ z . object ( {
411
+ method : z . literal ( 'bluetooth.descriptorEventGenerated' ) ,
412
+ params : Bluetooth . DescriptorEventGeneratedParametersSchema ,
413
+ } ) ,
414
+ ) ;
415
+ }
416
+ export namespace Bluetooth {
417
+ export const DescriptorEventGeneratedParametersSchema = z . lazy ( ( ) =>
418
+ z . object ( {
419
+ context : z . string ( ) ,
420
+ address : z . string ( ) ,
421
+ serviceUuid : Bluetooth . BluetoothUuidSchema ,
422
+ characteristicUuid : Bluetooth . BluetoothUuidSchema ,
423
+ descriptorUuid : Bluetooth . BluetoothUuidSchema ,
424
+ type : z . enum ( [ 'read' , 'write' ] ) ,
425
+ data : z . array ( z . number ( ) . int ( ) . nonnegative ( ) ) . optional ( ) ,
426
+ } ) ,
427
+ ) ;
428
+ }
0 commit comments