MCPcopy
hub / github.com/yume-chan/ya-webadb / UHidOutputStream

Class UHidOutputStream

libraries/scrcpy/src/2_4/impl/uhid-output-stream.ts:20–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18>;
19
20export class UHidOutputStream
21 extends PushReadableStream<UHidOutputDeviceMessage>
22 implements ScrcpyDeviceMessageParser
23{
24 #controller: PushReadableStreamController<UHidOutputDeviceMessage>;
25
26 readonly id = 2;
27
28 constructor() {
29 let controller!: PushReadableStreamController<UHidOutputDeviceMessage>;
30 super((controller_) => {
31 controller = controller_;
32 });
33 this.#controller = controller;
34 }
35
36 async parse(_id: number, stream: AsyncExactReadable): Promise<undefined> {
37 const message = await UHidOutputDeviceMessage.deserialize(stream);
38 await this.#controller.enqueue(message);
39 }
40
41 close() {
42 this.#controller.close();
43 }
44
45 error(e?: unknown) {
46 this.#controller.error(e);
47 }
48}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected