Skip to content

Commit dca181a

Browse files
1 parent 421892a commit dca181a

File tree

3 files changed

+335
-6
lines changed

3 files changed

+335
-6
lines changed

src/bidiMapper/CommandProcessor.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,22 @@ export class CommandProcessor extends EventEmitter<CommandProcessorEventsMap> {
173173
return await this.#bluetoothProcessor.simulateAdvertisement(
174174
this.#parser.parseSimulateAdvertisementParameters(command.params),
175175
);
176+
case 'bluetooth.simulateCharacteristic':
177+
throw new UnknownErrorException(
178+
`Method ${command.method} is not implemented.`,
179+
);
180+
case 'bluetooth.simulateCharacteristicResponse':
181+
throw new UnknownErrorException(
182+
`Method ${command.method} is not implemented.`,
183+
);
184+
case 'bluetooth.simulateDescriptor':
185+
throw new UnknownErrorException(
186+
`Method ${command.method} is not implemented.`,
187+
);
188+
case 'bluetooth.simulateDescriptorResponse':
189+
throw new UnknownErrorException(
190+
`Method ${command.method} is not implemented.`,
191+
);
176192
case 'bluetooth.simulateGattConnectionResponse':
177193
return await this.#bluetoothProcessor.simulateGattConnectionResponse(
178194
this.#parser.parseSimulateGattConnectionResponseParameters(
@@ -189,6 +205,10 @@ export class CommandProcessor extends EventEmitter<CommandProcessorEventsMap> {
189205
command.params,
190206
),
191207
);
208+
case 'bluetooth.simulateService':
209+
throw new UnknownErrorException(
210+
`Method ${command.method} is not implemented.`,
211+
);
192212
// keep-sorted end
193213

194214
// Browser module

src/protocol-parser/generated/webdriver-bidi-bluetooth.ts

Lines changed: 174 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import z from 'zod';
2828

2929
export namespace Bluetooth {
30-
export const BluetoothServiceUuidSchema = z.lazy(() => z.string());
30+
export const BluetoothUuidSchema = z.lazy(() => z.string());
3131
}
3232
export namespace Bluetooth {
3333
export const BluetoothManufacturerDataSchema = z.lazy(() =>
@@ -37,6 +37,20 @@ export namespace Bluetooth {
3737
}),
3838
);
3939
}
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+
}
4054
export namespace Bluetooth {
4155
export const RequestDeviceSchema = z.lazy(() => z.string());
4256
}
@@ -55,7 +69,7 @@ export namespace Bluetooth {
5569
export const ScanRecordSchema = z.lazy(() =>
5670
z.object({
5771
name: z.string().optional(),
58-
uuids: z.array(Bluetooth.BluetoothServiceUuidSchema).optional(),
72+
uuids: z.array(Bluetooth.BluetoothUuidSchema).optional(),
5973
appearance: z.number().optional(),
6074
manufacturerData: z
6175
.array(Bluetooth.BluetoothManufacturerDataSchema)
@@ -72,6 +86,11 @@ export const BluetoothCommandSchema = z.lazy(() =>
7286
Bluetooth.SimulateAdvertisementSchema,
7387
Bluetooth.SimulateGattConnectionResponseSchema,
7488
Bluetooth.SimulateGattDisconnectionSchema,
89+
Bluetooth.SimulateServiceSchema,
90+
Bluetooth.SimulateCharacteristicSchema,
91+
Bluetooth.SimulateCharacteristicResponseSchema,
92+
Bluetooth.SimulateDescriptorSchema,
93+
Bluetooth.SimulateDescriptorResponseSchema,
7594
z.object({}),
7695
]),
7796
);
@@ -160,7 +179,7 @@ export namespace Bluetooth {
160179
address: z.string(),
161180
name: z.string(),
162181
manufacturerData: z.array(Bluetooth.BluetoothManufacturerDataSchema),
163-
knownServiceUuids: z.array(Bluetooth.BluetoothServiceUuidSchema),
182+
knownServiceUuids: z.array(Bluetooth.BluetoothUuidSchema),
164183
}),
165184
);
166185
}
@@ -222,6 +241,111 @@ export namespace Bluetooth {
222241
}),
223242
);
224243
}
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+
}
225349
export namespace Bluetooth {
226350
export const RequestDevicePromptUpdatedSchema = z.lazy(() =>
227351
z.object({
@@ -255,3 +379,50 @@ export namespace Bluetooth {
255379
}),
256380
);
257381
}
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

Comments
 (0)