@illgrenoble/webx-client 1.9.2 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/input/GuacamoleKeyboard.js +118 -99
- package/dist/input/WebXKeyboard.d.ts +0 -16
- package/dist/input/WebXKeyboard.js +3 -27
- package/dist/input/WebXKeyboard.js.map +1 -1
- package/package.json +1 -1
- package/dist/display/WebXMaterialProvider.d.ts +0 -8
- package/dist/display/WebXMaterialProvider.js +0 -71
- package/dist/display/WebXMaterialProvider.js.map +0 -1
- package/dist/input/WebXNewKeyboard.d.ts +0 -62
- package/dist/input/WebXNewKeyboard.js +0 -94
- package/dist/input/WebXNewKeyboard.js.map +0 -1
- package/dist/input/keyboard/WebXKeyEvent.d.ts +0 -79
- package/dist/input/keyboard/WebXKeyEvent.js +0 -324
- package/dist/input/keyboard/WebXKeyEvent.js.map +0 -1
- package/dist/input/keyboard/WebXKeyPressEvent.d.ts +0 -30
- package/dist/input/keyboard/WebXKeyPressEvent.js +0 -44
- package/dist/input/keyboard/WebXKeyPressEvent.js.map +0 -1
- package/dist/input/keyboard/WebXKeyUpEvent.d.ts +0 -33
- package/dist/input/keyboard/WebXKeyUpEvent.js +0 -31
- package/dist/input/keyboard/WebXKeyUpEvent.js.map +0 -1
- package/dist/input/keyboard/WebXKeyboardModifierState.d.ts +0 -108
- package/dist/input/keyboard/WebXKeyboardModifierState.js +0 -148
- package/dist/input/keyboard/WebXKeyboardModifierState.js.map +0 -1
- package/dist/input/keyboard/WebXKeyboardUtils.d.ts +0 -25
- package/dist/input/keyboard/WebXKeyboardUtils.js +0 -63
- package/dist/input/keyboard/WebXKeyboardUtils.js.map +0 -1
- package/dist/input/keyboard/WebXKeydownEvent.d.ts +0 -46
- package/dist/input/keyboard/WebXKeydownEvent.js +0 -66
- package/dist/input/keyboard/WebXKeydownEvent.js.map +0 -1
- package/dist/input/keyboard/index.d.ts +0 -6
- package/dist/input/keyboard/index.js +0 -23
- package/dist/input/keyboard/index.js.map +0 -1
- package/dist/lib/GuacamoleKeyboard.js +0 -1290
- package/dist/lib/GuacamoleKeyboard.js.map +0 -1
- package/dist/message/WebXPollMessage.d.ts +0 -4
- package/dist/message/WebXPollMessage.js +0 -12
- package/dist/message/WebXPollMessage.js.map +0 -1
- package/dist/src/WebXClient.d.ts +0 -261
- package/dist/src/WebXClient.js +0 -571
- package/dist/src/WebXClient.js.map +0 -1
- package/dist/src/WebXEngine.d.ts +0 -4
- package/dist/src/WebXEngine.js +0 -7
- package/dist/src/WebXEngine.js.map +0 -1
- package/dist/src/display/WebXCursor.d.ts +0 -88
- package/dist/src/display/WebXCursor.js +0 -150
- package/dist/src/display/WebXCursor.js.map +0 -1
- package/dist/src/display/WebXCursorFactory.d.ts +0 -36
- package/dist/src/display/WebXCursorFactory.js +0 -59
- package/dist/src/display/WebXCursorFactory.js.map +0 -1
- package/dist/src/display/WebXDisplay.d.ts +0 -226
- package/dist/src/display/WebXDisplay.js +0 -424
- package/dist/src/display/WebXDisplay.js.map +0 -1
- package/dist/src/display/WebXMaterial.d.ts +0 -14
- package/dist/src/display/WebXMaterial.js +0 -140
- package/dist/src/display/WebXMaterial.js.map +0 -1
- package/dist/src/display/WebXSubImage.d.ts +0 -50
- package/dist/src/display/WebXSubImage.js +0 -26
- package/dist/src/display/WebXSubImage.js.map +0 -1
- package/dist/src/display/WebXTextureFactory.d.ts +0 -54
- package/dist/src/display/WebXTextureFactory.js +0 -160
- package/dist/src/display/WebXTextureFactory.js.map +0 -1
- package/dist/src/display/WebXWindow.d.ts +0 -241
- package/dist/src/display/WebXWindow.js +0 -438
- package/dist/src/display/WebXWindow.js.map +0 -1
- package/dist/src/display/WebXWindowProperties.d.ts +0 -44
- package/dist/src/display/WebXWindowProperties.js +0 -25
- package/dist/src/display/WebXWindowProperties.js.map +0 -1
- package/dist/src/display/index.d.ts +0 -7
- package/dist/src/display/index.js +0 -24
- package/dist/src/display/index.js.map +0 -1
- package/dist/src/index.d.ts +0 -7
- package/dist/src/index.js +0 -24
- package/dist/src/index.js.map +0 -1
- package/dist/src/input/WebXKeyboard.d.ts +0 -265
- package/dist/src/input/WebXKeyboard.js +0 -632
- package/dist/src/input/WebXKeyboard.js.map +0 -1
- package/dist/src/input/WebXMouse.d.ts +0 -125
- package/dist/src/input/WebXMouse.js +0 -231
- package/dist/src/input/WebXMouse.js.map +0 -1
- package/dist/src/input/index.d.ts +0 -4
- package/dist/src/input/index.js +0 -21
- package/dist/src/input/index.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyEvent.d.ts +0 -79
- package/dist/src/input/keyboard/WebXKeyEvent.js +0 -324
- package/dist/src/input/keyboard/WebXKeyEvent.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyPressEvent.d.ts +0 -30
- package/dist/src/input/keyboard/WebXKeyPressEvent.js +0 -44
- package/dist/src/input/keyboard/WebXKeyPressEvent.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyUpEvent.d.ts +0 -33
- package/dist/src/input/keyboard/WebXKeyUpEvent.js +0 -31
- package/dist/src/input/keyboard/WebXKeyUpEvent.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyboardModifierState.d.ts +0 -108
- package/dist/src/input/keyboard/WebXKeyboardModifierState.js +0 -148
- package/dist/src/input/keyboard/WebXKeyboardModifierState.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyboardUtils.d.ts +0 -25
- package/dist/src/input/keyboard/WebXKeyboardUtils.js +0 -63
- package/dist/src/input/keyboard/WebXKeyboardUtils.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeydownEvent.d.ts +0 -46
- package/dist/src/input/keyboard/WebXKeydownEvent.js +0 -66
- package/dist/src/input/keyboard/WebXKeydownEvent.js.map +0 -1
- package/dist/src/input/keyboard/index.d.ts +0 -6
- package/dist/src/input/keyboard/index.js +0 -23
- package/dist/src/input/keyboard/index.js.map +0 -1
- package/dist/src/input/mouse/WebXMouseState.d.ts +0 -190
- package/dist/src/input/mouse/WebXMouseState.js +0 -217
- package/dist/src/input/mouse/WebXMouseState.js.map +0 -1
- package/dist/src/input/mouse/index.d.ts +0 -1
- package/dist/src/input/mouse/index.js +0 -18
- package/dist/src/input/mouse/index.js.map +0 -1
- package/dist/src/instruction/WebXClipboardInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXClipboardInstruction.js +0 -23
- package/dist/src/instruction/WebXClipboardInstruction.js.map +0 -1
- package/dist/src/instruction/WebXConnectInstruction.d.ts +0 -19
- package/dist/src/instruction/WebXConnectInstruction.js +0 -24
- package/dist/src/instruction/WebXConnectInstruction.js.map +0 -1
- package/dist/src/instruction/WebXCursorImageInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXCursorImageInstruction.js +0 -23
- package/dist/src/instruction/WebXCursorImageInstruction.js.map +0 -1
- package/dist/src/instruction/WebXDataAckInstruction.d.ts +0 -25
- package/dist/src/instruction/WebXDataAckInstruction.js +0 -26
- package/dist/src/instruction/WebXDataAckInstruction.js.map +0 -1
- package/dist/src/instruction/WebXImageInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXImageInstruction.js +0 -23
- package/dist/src/instruction/WebXImageInstruction.js.map +0 -1
- package/dist/src/instruction/WebXInstruction.d.ts +0 -29
- package/dist/src/instruction/WebXInstruction.js +0 -28
- package/dist/src/instruction/WebXInstruction.js.map +0 -1
- package/dist/src/instruction/WebXInstructionResponse.d.ts +0 -66
- package/dist/src/instruction/WebXInstructionResponse.js +0 -78
- package/dist/src/instruction/WebXInstructionResponse.js.map +0 -1
- package/dist/src/instruction/WebXInstructionType.d.ts +0 -63
- package/dist/src/instruction/WebXInstructionType.js +0 -96
- package/dist/src/instruction/WebXInstructionType.js.map +0 -1
- package/dist/src/instruction/WebXKeyboardInstruction.d.ts +0 -23
- package/dist/src/instruction/WebXKeyboardInstruction.js +0 -25
- package/dist/src/instruction/WebXKeyboardInstruction.js.map +0 -1
- package/dist/src/instruction/WebXMouseInstruction.d.ts +0 -28
- package/dist/src/instruction/WebXMouseInstruction.js +0 -27
- package/dist/src/instruction/WebXMouseInstruction.js.map +0 -1
- package/dist/src/instruction/WebXPongInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXPongInstruction.js +0 -23
- package/dist/src/instruction/WebXPongInstruction.js.map +0 -1
- package/dist/src/instruction/WebXQualityInstruction.d.ts +0 -19
- package/dist/src/instruction/WebXQualityInstruction.js +0 -24
- package/dist/src/instruction/WebXQualityInstruction.js.map +0 -1
- package/dist/src/instruction/WebXScreenInstruction.d.ts +0 -12
- package/dist/src/instruction/WebXScreenInstruction.js +0 -20
- package/dist/src/instruction/WebXScreenInstruction.js.map +0 -1
- package/dist/src/instruction/WebXShapeInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXShapeInstruction.js +0 -23
- package/dist/src/instruction/WebXShapeInstruction.js.map +0 -1
- package/dist/src/instruction/WebXWindowsInstruction.d.ts +0 -13
- package/dist/src/instruction/WebXWindowsInstruction.js +0 -21
- package/dist/src/instruction/WebXWindowsInstruction.js.map +0 -1
- package/dist/src/instruction/index.d.ts +0 -15
- package/dist/src/instruction/index.js +0 -32
- package/dist/src/instruction/index.js.map +0 -1
- package/dist/src/message/WebXClipboardMessage.d.ts +0 -19
- package/dist/src/message/WebXClipboardMessage.js +0 -23
- package/dist/src/message/WebXClipboardMessage.js.map +0 -1
- package/dist/src/message/WebXConnectionMessage.d.ts +0 -12
- package/dist/src/message/WebXConnectionMessage.js +0 -20
- package/dist/src/message/WebXConnectionMessage.js.map +0 -1
- package/dist/src/message/WebXCursorImageMessage.d.ts +0 -46
- package/dist/src/message/WebXCursorImageMessage.js +0 -35
- package/dist/src/message/WebXCursorImageMessage.js.map +0 -1
- package/dist/src/message/WebXImageMessage.d.ts +0 -41
- package/dist/src/message/WebXImageMessage.js +0 -33
- package/dist/src/message/WebXImageMessage.js.map +0 -1
- package/dist/src/message/WebXMessage.d.ts +0 -24
- package/dist/src/message/WebXMessage.js +0 -23
- package/dist/src/message/WebXMessage.js.map +0 -1
- package/dist/src/message/WebXMessageType.d.ts +0 -59
- package/dist/src/message/WebXMessageType.js +0 -64
- package/dist/src/message/WebXMessageType.js.map +0 -1
- package/dist/src/message/WebXMouseMessage.d.ts +0 -30
- package/dist/src/message/WebXMouseMessage.js +0 -29
- package/dist/src/message/WebXMouseMessage.js.map +0 -1
- package/dist/src/message/WebXNopMessage.d.ts +0 -10
- package/dist/src/message/WebXNopMessage.js +0 -18
- package/dist/src/message/WebXNopMessage.js.map +0 -1
- package/dist/src/message/WebXPingMessage.d.ts +0 -13
- package/dist/src/message/WebXPingMessage.js +0 -21
- package/dist/src/message/WebXPingMessage.js.map +0 -1
- package/dist/src/message/WebXQualityMessage.d.ts +0 -39
- package/dist/src/message/WebXQualityMessage.js +0 -32
- package/dist/src/message/WebXQualityMessage.js.map +0 -1
- package/dist/src/message/WebXScreenMessage.d.ts +0 -37
- package/dist/src/message/WebXScreenMessage.js +0 -29
- package/dist/src/message/WebXScreenMessage.js.map +0 -1
- package/dist/src/message/WebXShapeMessage.d.ts +0 -31
- package/dist/src/message/WebXShapeMessage.js +0 -29
- package/dist/src/message/WebXShapeMessage.js.map +0 -1
- package/dist/src/message/WebXSubImagesMessage.d.ts +0 -31
- package/dist/src/message/WebXSubImagesMessage.js +0 -29
- package/dist/src/message/WebXSubImagesMessage.js.map +0 -1
- package/dist/src/message/WebXWindowsMessage.d.ts +0 -21
- package/dist/src/message/WebXWindowsMessage.js +0 -25
- package/dist/src/message/WebXWindowsMessage.js.map +0 -1
- package/dist/src/message/index.d.ts +0 -14
- package/dist/src/message/index.js +0 -31
- package/dist/src/message/index.js.map +0 -1
- package/dist/src/tracer/WebXDebugImageMessageHandler.d.ts +0 -48
- package/dist/src/tracer/WebXDebugImageMessageHandler.js +0 -102
- package/dist/src/tracer/WebXDebugImageMessageHandler.js.map +0 -1
- package/dist/src/tracer/WebXHandler.d.ts +0 -14
- package/dist/src/tracer/WebXHandler.js +0 -3
- package/dist/src/tracer/WebXHandler.js.map +0 -1
- package/dist/src/tracer/WebXInstructionHandler.d.ts +0 -21
- package/dist/src/tracer/WebXInstructionHandler.js +0 -13
- package/dist/src/tracer/WebXInstructionHandler.js.map +0 -1
- package/dist/src/tracer/WebXMessageHandler.d.ts +0 -21
- package/dist/src/tracer/WebXMessageHandler.js +0 -13
- package/dist/src/tracer/WebXMessageHandler.js.map +0 -1
- package/dist/src/tracer/WebXStatsHandler.d.ts +0 -23
- package/dist/src/tracer/WebXStatsHandler.js +0 -13
- package/dist/src/tracer/WebXStatsHandler.js.map +0 -1
- package/dist/src/tracer/index.d.ts +0 -5
- package/dist/src/tracer/index.js +0 -22
- package/dist/src/tracer/index.js.map +0 -1
- package/dist/src/transport/WebXBinarySerializer.d.ts +0 -31
- package/dist/src/transport/WebXBinarySerializer.js +0 -63
- package/dist/src/transport/WebXBinarySerializer.js.map +0 -1
- package/dist/src/transport/WebXInstructionBuffer.d.ts +0 -55
- package/dist/src/transport/WebXInstructionBuffer.js +0 -109
- package/dist/src/transport/WebXInstructionBuffer.js.map +0 -1
- package/dist/src/transport/WebXInstructionEncoder.d.ts +0 -181
- package/dist/src/transport/WebXInstructionEncoder.js +0 -294
- package/dist/src/transport/WebXInstructionEncoder.js.map +0 -1
- package/dist/src/transport/WebXMessageBuffer.d.ts +0 -80
- package/dist/src/transport/WebXMessageBuffer.js +0 -104
- package/dist/src/transport/WebXMessageBuffer.js.map +0 -1
- package/dist/src/transport/WebXMessageDecoder.d.ts +0 -108
- package/dist/src/transport/WebXMessageDecoder.js +0 -332
- package/dist/src/transport/WebXMessageDecoder.js.map +0 -1
- package/dist/src/transport/index.d.ts +0 -5
- package/dist/src/transport/index.js +0 -22
- package/dist/src/transport/index.js.map +0 -1
- package/dist/src/tunnel/WebXTunnel.d.ts +0 -93
- package/dist/src/tunnel/WebXTunnel.js +0 -156
- package/dist/src/tunnel/WebXTunnel.js.map +0 -1
- package/dist/src/tunnel/WebXWebSocketTunnel.d.ts +0 -40
- package/dist/src/tunnel/WebXWebSocketTunnel.js +0 -88
- package/dist/src/tunnel/WebXWebSocketTunnel.js.map +0 -1
- package/dist/src/tunnel/index.d.ts +0 -2
- package/dist/src/tunnel/index.js +0 -19
- package/dist/src/tunnel/index.js.map +0 -1
- package/dist/src/utils/WebXColorGenerator.d.ts +0 -24
- package/dist/src/utils/WebXColorGenerator.js +0 -46
- package/dist/src/utils/WebXColorGenerator.js.map +0 -1
- package/dist/src/utils/WebXVersion.d.ts +0 -34
- package/dist/src/utils/WebXVersion.js +0 -25
- package/dist/src/utils/WebXVersion.js.map +0 -1
- package/dist/src/utils/index.d.ts +0 -2
- package/dist/src/utils/index.js +0 -19
- package/dist/src/utils/index.js.map +0 -1
- package/dist/tracer/DemoVisualMessageHandler.d.ts +0 -15
- package/dist/tracer/DemoVisualMessageHandler.js +0 -55
- package/dist/tracer/DemoVisualMessageHandler.js.map +0 -1
- package/dist/tracer/WebXVisualMessageHandler.d.ts +0 -15
- package/dist/tracer/WebXVisualMessageHandler.js +0 -55
- package/dist/tracer/WebXVisualMessageHandler.js.map +0 -1
- package/dist/tunnel/WebXDefaultQoSHandler.d.ts +0 -16
- package/dist/tunnel/WebXDefaultQoSHandler.js +0 -57
- package/dist/tunnel/WebXDefaultQoSHandler.js.map +0 -1
- package/dist/tunnel/WebXQoSHandler.d.ts +0 -6
- package/dist/tunnel/WebXQoSHandler.js +0 -7
- package/dist/tunnel/WebXQoSHandler.js.map +0 -1
- package/dist/tunnel/WebXSocketIOTunnel.d.ts +0 -15
- package/dist/tunnel/WebXSocketIOTunnel.js +0 -41
- package/dist/tunnel/WebXSocketIOTunnel.js.map +0 -1
- package/dist/utils/ColorGenerator.d.ts +0 -24
- package/dist/utils/ColorGenerator.js +0 -46
- package/dist/utils/ColorGenerator.js.map +0 -1
- package/dist/utils/Config.d.ts +0 -4
- package/dist/utils/Config.js +0 -10
- package/dist/utils/Config.js.map +0 -1
- package/dist/utils/WebXAsyncExec.d.ts +0 -5
- package/dist/utils/WebXAsyncExec.js +0 -18
- package/dist/utils/WebXAsyncExec.js.map +0 -1
- package/dist/utils/WebXColourGenerator.d.ts +0 -5
- package/dist/utils/WebXColourGenerator.js +0 -27
- package/dist/utils/WebXColourGenerator.js.map +0 -1
- package/dist/utils/WebXFileSize.d.ts +0 -3
- package/dist/utils/WebXFileSize.js +0 -14
- package/dist/utils/WebXFileSize.js.map +0 -1
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebXInstructionEncoder = void 0;
|
|
4
|
-
const instruction_1 = require("../instruction");
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
/**
|
|
7
|
-
* Encodes WebX instructions into a format suitable for transmission.
|
|
8
|
-
* This class handles various instruction types and ensures they are
|
|
9
|
-
* serialized correctly.
|
|
10
|
-
*/
|
|
11
|
-
class WebXInstructionEncoder {
|
|
12
|
-
/**
|
|
13
|
-
* Convert the given instruction to an array buffer ready to be sent along the wire
|
|
14
|
-
* @param instruction the instruction to encode
|
|
15
|
-
* @returns The encoded instruction as an ArrayBuffer.
|
|
16
|
-
*/
|
|
17
|
-
encode(instruction) {
|
|
18
|
-
if (instruction.type === instruction_1.WebXInstructionType.MOUSE) {
|
|
19
|
-
return this._createMouseInstruction(instruction);
|
|
20
|
-
}
|
|
21
|
-
else if (instruction.type === instruction_1.WebXInstructionType.KEYBOARD) {
|
|
22
|
-
return this._createKeyboardInstruction(instruction);
|
|
23
|
-
}
|
|
24
|
-
else if (instruction.type === instruction_1.WebXInstructionType.CURSOR_IMAGE) {
|
|
25
|
-
return this._createCursorImageInstruction(instruction);
|
|
26
|
-
}
|
|
27
|
-
else if (instruction.type === instruction_1.WebXInstructionType.IMAGE) {
|
|
28
|
-
return this._createImageInstruction(instruction);
|
|
29
|
-
}
|
|
30
|
-
else if (instruction.type === instruction_1.WebXInstructionType.CONNECT) {
|
|
31
|
-
return this._createConnectInstruction(instruction);
|
|
32
|
-
}
|
|
33
|
-
else if (instruction.type === instruction_1.WebXInstructionType.SCREEN) {
|
|
34
|
-
return this._createScreenInstruction(instruction);
|
|
35
|
-
}
|
|
36
|
-
else if (instruction.type === instruction_1.WebXInstructionType.WINDOWS) {
|
|
37
|
-
return this._createWindowsInstruction(instruction);
|
|
38
|
-
}
|
|
39
|
-
else if (instruction.type === instruction_1.WebXInstructionType.QUALITY) {
|
|
40
|
-
return this._createQualityInstruction(instruction);
|
|
41
|
-
}
|
|
42
|
-
else if (instruction.type === instruction_1.WebXInstructionType.PONG) {
|
|
43
|
-
return this._createPongInstruction(instruction);
|
|
44
|
-
}
|
|
45
|
-
else if (instruction.type === instruction_1.WebXInstructionType.DATA_ACK) {
|
|
46
|
-
return this._createDataAckInstruction(instruction);
|
|
47
|
-
}
|
|
48
|
-
else if (instruction.type === instruction_1.WebXInstructionType.CLIPBOARD) {
|
|
49
|
-
return this._createClipboardInstruction(instruction);
|
|
50
|
-
}
|
|
51
|
-
else if (instruction.type === instruction_1.WebXInstructionType.SHAPE) {
|
|
52
|
-
return this._createShapeInstruction(instruction);
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Create a new mouse instruction
|
|
58
|
-
* @param instruction the mouse instruction to encode
|
|
59
|
-
* Structure:
|
|
60
|
-
* Header: 32 bytes
|
|
61
|
-
* sessionId: 16 bytes
|
|
62
|
-
* clientId:4 bytes
|
|
63
|
-
* type: 4 bytes
|
|
64
|
-
* id: 4 bytes
|
|
65
|
-
* padding: 4 bytes
|
|
66
|
-
* Content: 4 bytes
|
|
67
|
-
* x: 4 bytes
|
|
68
|
-
* y: 4 bytes
|
|
69
|
-
* buttonMask: 4 bytes
|
|
70
|
-
*/
|
|
71
|
-
_createMouseInstruction(instruction) {
|
|
72
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 12);
|
|
73
|
-
return encoder
|
|
74
|
-
// write the contents
|
|
75
|
-
.putInt32(instruction.x)
|
|
76
|
-
.putInt32(instruction.y)
|
|
77
|
-
.putUInt32(instruction.buttonMask)
|
|
78
|
-
.buffer();
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Create a new cursor image instruction
|
|
82
|
-
* @param instruction the cursor image instruction to encode
|
|
83
|
-
* Structure:
|
|
84
|
-
* Header: 32 bytes
|
|
85
|
-
* sessionId: 16 bytes
|
|
86
|
-
* clientId:4 bytes
|
|
87
|
-
* type: 4 bytes
|
|
88
|
-
* id: 4 bytes
|
|
89
|
-
* padding: 4 bytes
|
|
90
|
-
* Content: 4 bytes
|
|
91
|
-
* cursorId: 4 bytes
|
|
92
|
-
*/
|
|
93
|
-
_createCursorImageInstruction(instruction) {
|
|
94
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 4);
|
|
95
|
-
return encoder
|
|
96
|
-
// write the contents
|
|
97
|
-
.putInt32(instruction.cursorId)
|
|
98
|
-
.buffer();
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Create a new image instruction
|
|
102
|
-
* @param instruction the image instruction to encode
|
|
103
|
-
* Structure:
|
|
104
|
-
* Header: 32 bytes
|
|
105
|
-
* sessionId: 16 bytes
|
|
106
|
-
* clientId:4 bytes
|
|
107
|
-
* type: 4 bytes
|
|
108
|
-
* id: 4 bytes
|
|
109
|
-
* padding: 4 bytes
|
|
110
|
-
* Content: 4 bytes
|
|
111
|
-
* windowId: 4 bytes
|
|
112
|
-
*/
|
|
113
|
-
_createImageInstruction(instruction) {
|
|
114
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 4);
|
|
115
|
-
return encoder
|
|
116
|
-
// write the contents
|
|
117
|
-
.putUInt32(instruction.windowId)
|
|
118
|
-
.buffer();
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Create a keyboard instruction
|
|
122
|
-
* @param instruction the keyboard instruction to encode
|
|
123
|
-
* Structure:
|
|
124
|
-
* Header: 32 bytes
|
|
125
|
-
* sessionId: 16 bytes
|
|
126
|
-
* clientId: 4 bytes
|
|
127
|
-
* type: 4 bytes
|
|
128
|
-
* id: 4 bytes
|
|
129
|
-
* padding: 4 bytes
|
|
130
|
-
* Content: 8 bytes
|
|
131
|
-
* key (the keyboard key code): 4 bytes
|
|
132
|
-
* pressed: 4 bytes
|
|
133
|
-
*/
|
|
134
|
-
_createKeyboardInstruction(instruction) {
|
|
135
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 8);
|
|
136
|
-
return encoder
|
|
137
|
-
// write the contents
|
|
138
|
-
.putUInt32(instruction.key)
|
|
139
|
-
.putBoolean(instruction.pressed)
|
|
140
|
-
.buffer();
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Create a screen instruction
|
|
144
|
-
* @param instruction the screen instruction to encode
|
|
145
|
-
* Structure:
|
|
146
|
-
* Header: 32 bytes
|
|
147
|
-
* sessionId: 16 bytes
|
|
148
|
-
* clientId: 4 bytes
|
|
149
|
-
* type: 4 bytes
|
|
150
|
-
* id: 4 bytes
|
|
151
|
-
* padding: 4 bytes
|
|
152
|
-
*/
|
|
153
|
-
_createScreenInstruction(instruction) {
|
|
154
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 0);
|
|
155
|
-
return encoder.buffer();
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Create a windows instruction
|
|
159
|
-
* Structure:
|
|
160
|
-
* Header: 32 bytes
|
|
161
|
-
* sessionId: 16 bytes
|
|
162
|
-
* clientId: 4 bytes
|
|
163
|
-
* type: 4 bytes
|
|
164
|
-
* id: 4 bytes
|
|
165
|
-
* padding: 4 bytes
|
|
166
|
-
* @param instruction the windows instruction to encode
|
|
167
|
-
*/
|
|
168
|
-
_createWindowsInstruction(instruction) {
|
|
169
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 0);
|
|
170
|
-
return encoder.buffer();
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Create a connect instruction
|
|
174
|
-
* @param instruction the connect instruction to encode
|
|
175
|
-
* Structure:
|
|
176
|
-
* Header: 32 bytes
|
|
177
|
-
* sessionId: 16 bytes
|
|
178
|
-
* clientId: 4 bytes
|
|
179
|
-
* type: 4 bytes
|
|
180
|
-
* id: 4 bytes
|
|
181
|
-
* padding: 4 bytes
|
|
182
|
-
*/
|
|
183
|
-
_createConnectInstruction(instruction) {
|
|
184
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 0);
|
|
185
|
-
return encoder.buffer();
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Create a new quality instruction
|
|
189
|
-
* @param instruction the quality instruction to encode
|
|
190
|
-
* Structure:
|
|
191
|
-
* Header: 32 bytes
|
|
192
|
-
* sessionId: 16 bytes
|
|
193
|
-
* clientId: 4 bytes
|
|
194
|
-
* type: 4 bytes
|
|
195
|
-
* id: 4 bytes
|
|
196
|
-
* padding: 4 bytes
|
|
197
|
-
* Content: 4 bytes
|
|
198
|
-
* qualityIndex: 4 bytes
|
|
199
|
-
*/
|
|
200
|
-
_createQualityInstruction(instruction) {
|
|
201
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 4);
|
|
202
|
-
return encoder
|
|
203
|
-
// write the contents
|
|
204
|
-
.putUInt32(instruction.qualityIndex)
|
|
205
|
-
.buffer();
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Create a new pong instruction
|
|
209
|
-
* @param instruction the pong instruction to encode
|
|
210
|
-
* Structure:
|
|
211
|
-
* Header: 32 bytes
|
|
212
|
-
* sessionId: 16 bytes
|
|
213
|
-
* clientId: 4 bytes
|
|
214
|
-
* type: 4 bytes
|
|
215
|
-
* id: 4 bytes
|
|
216
|
-
* padding: 4 bytes
|
|
217
|
-
* Content: 8 bytes
|
|
218
|
-
* timestampMs: 8 bytes
|
|
219
|
-
*/
|
|
220
|
-
_createPongInstruction(instruction) {
|
|
221
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 8);
|
|
222
|
-
return encoder
|
|
223
|
-
// write the contents
|
|
224
|
-
.putUInt8Array(instruction.timestampMs, 8)
|
|
225
|
-
.buffer();
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Create a new data ack instruction
|
|
229
|
-
* @param instruction the data ack instruction to encode
|
|
230
|
-
* Structure:
|
|
231
|
-
* Header: 32 bytes
|
|
232
|
-
* sessionId: 16 bytes
|
|
233
|
-
* clientId: 4 bytes
|
|
234
|
-
* type: 4 bytes
|
|
235
|
-
* id: 4 bytes
|
|
236
|
-
* padding: 4 bytes
|
|
237
|
-
* Content: 8 bytes
|
|
238
|
-
* timestampMs: 8 bytes
|
|
239
|
-
* dataLength: 4 bytes
|
|
240
|
-
*/
|
|
241
|
-
_createDataAckInstruction(instruction) {
|
|
242
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 12);
|
|
243
|
-
return encoder
|
|
244
|
-
// write the contents
|
|
245
|
-
.putUInt8Array(instruction.timestampMs, 8)
|
|
246
|
-
.putUInt32(instruction.dataLength)
|
|
247
|
-
.buffer();
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Create a new clipboard instruction
|
|
251
|
-
* @param instruction the clipboard instruction to encode
|
|
252
|
-
* Structure:
|
|
253
|
-
* Header: 32 bytes
|
|
254
|
-
* sessionId: 16 bytes
|
|
255
|
-
* clientId: 4 bytes
|
|
256
|
-
* type: 4 bytes
|
|
257
|
-
* id: 4 bytes
|
|
258
|
-
* padding: 4 bytes
|
|
259
|
-
* Content:
|
|
260
|
-
* clipboardContentLength: 4 bytes
|
|
261
|
-
* clipboardContent: N bytes
|
|
262
|
-
*/
|
|
263
|
-
_createClipboardInstruction(instruction) {
|
|
264
|
-
const length = 4 + instruction.clipboardContent.length;
|
|
265
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, length);
|
|
266
|
-
return encoder
|
|
267
|
-
// write the contents
|
|
268
|
-
.putUInt32(instruction.clipboardContent.length)
|
|
269
|
-
.putString(instruction.clipboardContent)
|
|
270
|
-
.buffer();
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Create a new shape instruction
|
|
274
|
-
* @param instruction the shape instruction to encode
|
|
275
|
-
* Structure:
|
|
276
|
-
* Header: 32 bytes
|
|
277
|
-
* sessionId: 16 bytes
|
|
278
|
-
* clientId: 4 bytes
|
|
279
|
-
* type: 4 bytes
|
|
280
|
-
* id: 4 bytes
|
|
281
|
-
* padding: 4 bytes
|
|
282
|
-
* Content: 4 bytes
|
|
283
|
-
* windowId: 4 bytes
|
|
284
|
-
*/
|
|
285
|
-
_createShapeInstruction(instruction) {
|
|
286
|
-
const encoder = new _1.WebXInstructionBuffer(instruction, 4);
|
|
287
|
-
return encoder
|
|
288
|
-
// write the contents
|
|
289
|
-
.putUInt32(instruction.windowId)
|
|
290
|
-
.buffer();
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
exports.WebXInstructionEncoder = WebXInstructionEncoder;
|
|
294
|
-
//# sourceMappingURL=WebXInstructionEncoder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebXInstructionEncoder.js","sourceRoot":"","sources":["../../../src/transport/WebXInstructionEncoder.ts"],"names":[],"mappings":";;;AAAA,gDAewB;AACxB,wBAA0C;AAE1C;;;;GAIG;AACH,MAAa,sBAAsB;IAEjC;;;;OAIG;IACI,MAAM,CAAC,WAA4B;QACxC,IAAI,WAAW,CAAC,IAAI,KAAK,iCAAmB,CAAC,KAAK,EAAE,CAAC;YACnD,OAAO,IAAI,CAAC,uBAAuB,CAAC,WAAmC,CAAC,CAAC;QAE3E,CAAC;aAAM,IAAI,WAAW,CAAC,IAAI,KAAK,iCAAmB,CAAC,QAAQ,EAAE,CAAC;YAC7D,OAAO,IAAI,CAAC,0BAA0B,CAAC,WAAsC,CAAC,CAAC;QAEjF,CAAC;aAAM,IAAI,WAAW,CAAC,IAAI,KAAK,iCAAmB,CAAC,YAAY,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC,6BAA6B,CAAC,WAAyC,CAAC,CAAC;QAEvF,C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;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACK,2BAA2B,CAAC,WAAqC;QACvE,MAAM,MAAM,GAAG,CAAC,GAAG,WAAW,CAAC,gBAAgB,CAAC,MAAM,CAAC;QACvD,MAAM,OAAO,GAAG,IAAI,wBAAqB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAC/D,OAAO,OAAO;YACZ,qBAAqB;aACpB,SAAS,CAAC,WAAW,CAAC,gBAAgB,CAAC,MAAM,CAAC;aAC9C,SAAS,CAAC,WAAW,CAAC,gBAAgB,CAAC;aACvC,MAAM,EAAE,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;OAYG;IACK,uBAAuB,CAAC,WAAiC;QAC/D,MAAM,OAAO,GAAG,IAAI,wBAAqB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAC1D,OAAO,OAAO;YACZ,qBAAqB;aACpB,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC;aAC/B,MAAM,EAAE,CAAC;IACd,CAAC;CAEF;AAxSD,wDAwSC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a buffer for encoding and decoding WebX messages.
|
|
3
|
-
*
|
|
4
|
-
* This class provides methods to write and read data in a structured format
|
|
5
|
-
* for communication with the WebX Engine.
|
|
6
|
-
*/
|
|
7
|
-
export declare class WebXMessageBuffer {
|
|
8
|
-
private _buffer;
|
|
9
|
-
/**
|
|
10
|
-
* The length of the message header in bytes.
|
|
11
|
-
*/
|
|
12
|
-
static readonly MESSAGE_HEADER_LENGTH = 48;
|
|
13
|
-
/**
|
|
14
|
-
* The timestamp in milliseconds when the message was created.
|
|
15
|
-
*/
|
|
16
|
-
readonly timestampMs: Uint8Array;
|
|
17
|
-
/**
|
|
18
|
-
* The type ID of the message.
|
|
19
|
-
*/
|
|
20
|
-
readonly messageTypeId: number;
|
|
21
|
-
/**
|
|
22
|
-
* The unique ID of the message.
|
|
23
|
-
*/
|
|
24
|
-
readonly messageId: number;
|
|
25
|
-
/**
|
|
26
|
-
* The total length of the buffer in bytes.
|
|
27
|
-
*/
|
|
28
|
-
readonly bufferLength: number;
|
|
29
|
-
/**
|
|
30
|
-
* Gets the current read offset
|
|
31
|
-
*/
|
|
32
|
-
get readOffset(): number;
|
|
33
|
-
private _readOffset;
|
|
34
|
-
private _encoder;
|
|
35
|
-
/**
|
|
36
|
-
* Creates a new instance of WebXMessageBuffer.
|
|
37
|
-
*
|
|
38
|
-
* @param _buffer The buffer to read from.
|
|
39
|
-
*/
|
|
40
|
-
constructor(_buffer: ArrayBuffer);
|
|
41
|
-
/**
|
|
42
|
-
* Reads a 32-bit signed integer from the buffer.
|
|
43
|
-
*
|
|
44
|
-
* @returns The read value.
|
|
45
|
-
*/
|
|
46
|
-
getInt32(): number;
|
|
47
|
-
/**
|
|
48
|
-
* Reads a 32-bit unsigned integer from the buffer.
|
|
49
|
-
*
|
|
50
|
-
* @returns The read value.
|
|
51
|
-
*/
|
|
52
|
-
getUint32(): number;
|
|
53
|
-
/**
|
|
54
|
-
* Reads a 32-bit floating point number from the buffer.
|
|
55
|
-
*
|
|
56
|
-
* @returns The read value.
|
|
57
|
-
*/
|
|
58
|
-
getFloat(): number;
|
|
59
|
-
/**
|
|
60
|
-
* Reads a Uint8Array from the buffer.
|
|
61
|
-
*
|
|
62
|
-
* @param length The length of the array to read.
|
|
63
|
-
* @returns The read Uint8Array.
|
|
64
|
-
*/
|
|
65
|
-
getUint8Array(length: number): Uint8Array;
|
|
66
|
-
/**
|
|
67
|
-
* Reads a string from the buffer.
|
|
68
|
-
*
|
|
69
|
-
* @param length The length of the string to read.
|
|
70
|
-
* @returns The read string.
|
|
71
|
-
*/
|
|
72
|
-
getString(length: number): string;
|
|
73
|
-
/**
|
|
74
|
-
* Calculates the next read offset, ensuring alignment.
|
|
75
|
-
*
|
|
76
|
-
* @param sizeOfData The size of the data to read.
|
|
77
|
-
* @returns The next read offset.
|
|
78
|
-
*/
|
|
79
|
-
private _getNextReadOffset;
|
|
80
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebXMessageBuffer = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Represents a buffer for encoding and decoding WebX messages.
|
|
6
|
-
*
|
|
7
|
-
* This class provides methods to write and read data in a structured format
|
|
8
|
-
* for communication with the WebX Engine.
|
|
9
|
-
*/
|
|
10
|
-
class WebXMessageBuffer {
|
|
11
|
-
/**
|
|
12
|
-
* Gets the current read offset
|
|
13
|
-
*/
|
|
14
|
-
get readOffset() {
|
|
15
|
-
return this._readOffset;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new instance of WebXMessageBuffer.
|
|
19
|
-
*
|
|
20
|
-
* @param _buffer The buffer to read from.
|
|
21
|
-
*/
|
|
22
|
-
constructor(_buffer) {
|
|
23
|
-
this._buffer = _buffer;
|
|
24
|
-
this._readOffset = 24;
|
|
25
|
-
this._encoder = new TextDecoder('utf-8');
|
|
26
|
-
this._readOffset = 24; // Session Id (16) and client index mask (8)
|
|
27
|
-
this.timestampMs = this.getUint8Array(8);
|
|
28
|
-
this.messageTypeId = this.getUint32();
|
|
29
|
-
this.messageId = this.getUint32();
|
|
30
|
-
this.bufferLength = this.getUint32();
|
|
31
|
-
this._readOffset = WebXMessageBuffer.MESSAGE_HEADER_LENGTH;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Reads a 32-bit signed integer from the buffer.
|
|
35
|
-
*
|
|
36
|
-
* @returns The read value.
|
|
37
|
-
*/
|
|
38
|
-
getInt32() {
|
|
39
|
-
const offset = this._getNextReadOffset(4);
|
|
40
|
-
const typedArray = new Int32Array(this._buffer, offset, 1);
|
|
41
|
-
return typedArray[0];
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Reads a 32-bit unsigned integer from the buffer.
|
|
45
|
-
*
|
|
46
|
-
* @returns The read value.
|
|
47
|
-
*/
|
|
48
|
-
getUint32() {
|
|
49
|
-
const offset = this._getNextReadOffset(4);
|
|
50
|
-
const typedArray = new Uint32Array(this._buffer, offset, 1);
|
|
51
|
-
return typedArray[0];
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Reads a 32-bit floating point number from the buffer.
|
|
55
|
-
*
|
|
56
|
-
* @returns The read value.
|
|
57
|
-
*/
|
|
58
|
-
getFloat() {
|
|
59
|
-
const offset = this._getNextReadOffset(4);
|
|
60
|
-
const typedArray = new Float32Array(this._buffer, offset, 1);
|
|
61
|
-
return typedArray[0];
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Reads a Uint8Array from the buffer.
|
|
65
|
-
*
|
|
66
|
-
* @param length The length of the array to read.
|
|
67
|
-
* @returns The read Uint8Array.
|
|
68
|
-
*/
|
|
69
|
-
getUint8Array(length) {
|
|
70
|
-
const typedArray = new Uint8Array(this._buffer, this._readOffset, length);
|
|
71
|
-
this._readOffset += length;
|
|
72
|
-
return typedArray;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Reads a string from the buffer.
|
|
76
|
-
*
|
|
77
|
-
* @param length The length of the string to read.
|
|
78
|
-
* @returns The read string.
|
|
79
|
-
*/
|
|
80
|
-
getString(length) {
|
|
81
|
-
const array = new Uint8Array(this._buffer, this._readOffset, length);
|
|
82
|
-
this._readOffset += length;
|
|
83
|
-
return this._encoder.decode(array);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Calculates the next read offset, ensuring alignment.
|
|
87
|
-
*
|
|
88
|
-
* @param sizeOfData The size of the data to read.
|
|
89
|
-
* @returns The next read offset.
|
|
90
|
-
*/
|
|
91
|
-
_getNextReadOffset(sizeOfData) {
|
|
92
|
-
// Ensure alignment
|
|
93
|
-
const padding = this._readOffset % sizeOfData > 0 ? sizeOfData - (this._readOffset % sizeOfData) : 0;
|
|
94
|
-
const position = this._readOffset + padding;
|
|
95
|
-
this._readOffset += sizeOfData + padding;
|
|
96
|
-
return position;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.WebXMessageBuffer = WebXMessageBuffer;
|
|
100
|
-
/**
|
|
101
|
-
* The length of the message header in bytes.
|
|
102
|
-
*/
|
|
103
|
-
WebXMessageBuffer.MESSAGE_HEADER_LENGTH = 48;
|
|
104
|
-
//# sourceMappingURL=WebXMessageBuffer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebXMessageBuffer.js","sourceRoot":"","sources":["../../../src/transport/WebXMessageBuffer.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,MAAa,iBAAiB;IA0B5B;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAOD;;;;OAIG;IACH,YAAoB,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;QAVhC,gBAAW,GAAW,EAAE,CAAC;QACzB,aAAQ,GAAgB,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;QAUvD,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC,4CAA4C;QACnE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAClC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,iBAAiB,CAAC,qBAAqB,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACI,QAAQ;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;QAC1C,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAA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UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrG,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAE5C,IAAI,CAAC,WAAW,IAAI,UAAU,GAAG,OAAO,CAAC;QAEzC,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA3HH,8CA4HC;AA3HC;;GAEG;AACoB,uCAAqB,GAAG,EAAE,AAAL,CAAM"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { WebXMessage } from '../message';
|
|
2
|
-
import { WebXTextureFactory } from '../display';
|
|
3
|
-
import { WebXMessageBuffer } from './WebXMessageBuffer';
|
|
4
|
-
/**
|
|
5
|
-
* Decodes binary messages received from the WebX Engine into WebXMessage objects.
|
|
6
|
-
* This class handles various message types and converts them into their respective
|
|
7
|
-
* WebXMessage implementations.
|
|
8
|
-
*/
|
|
9
|
-
export declare class WebXMessageDecoder {
|
|
10
|
-
private _textureFactory;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new instance of WebXMessageDecoder.
|
|
13
|
-
*
|
|
14
|
-
* @param _textureFactory The texture factory used to create textures from image data.
|
|
15
|
-
*/
|
|
16
|
-
constructor(_textureFactory: WebXTextureFactory);
|
|
17
|
-
/**
|
|
18
|
-
* Decodes a binary message buffer into a WebXMessage object.
|
|
19
|
-
*
|
|
20
|
-
* @param buffer The binary message buffer to decode.
|
|
21
|
-
* @returns A promise that resolves to the decoded WebXMessage.
|
|
22
|
-
*/
|
|
23
|
-
decode(buffer: WebXMessageBuffer): Promise<WebXMessage>;
|
|
24
|
-
/**
|
|
25
|
-
* Determines the MIME type of an image based on its type string.
|
|
26
|
-
*
|
|
27
|
-
* @param imageType The image type string (e.g., 'jpg', 'png').
|
|
28
|
-
* @returns The corresponding MIME type.
|
|
29
|
-
*/
|
|
30
|
-
private _determineMimeType;
|
|
31
|
-
/**
|
|
32
|
-
* Creates a WebXNopMessage, which is used for no-operation messages.
|
|
33
|
-
*/
|
|
34
|
-
private _createNopMessage;
|
|
35
|
-
/**
|
|
36
|
-
* Creates a WebXConnectionMessage, which is used for connection-related messages.
|
|
37
|
-
*/
|
|
38
|
-
private _createConnectionMessage;
|
|
39
|
-
/**
|
|
40
|
-
* Decodes a buffer into a WebXImageMessage.
|
|
41
|
-
*
|
|
42
|
-
* @param buffer The binary message buffer to decode.
|
|
43
|
-
* @returns A promise that resolves to a WebXImageMessage.
|
|
44
|
-
*/
|
|
45
|
-
private _createImageMessage;
|
|
46
|
-
/**
|
|
47
|
-
* Decodes a buffer into a WebXSubImagesMessage containing multiple sub-images.
|
|
48
|
-
*
|
|
49
|
-
* @param buffer The binary message buffer to decode.
|
|
50
|
-
* @returns A promise that resolves to a WebXSubImagesMessage.
|
|
51
|
-
*/
|
|
52
|
-
private _createSubImagesMessage;
|
|
53
|
-
/**
|
|
54
|
-
* Decodes a buffer into a WebXMouseMessage, which contains mouse position and cursor ID.
|
|
55
|
-
*
|
|
56
|
-
* @param buffer The binary message buffer to decode.
|
|
57
|
-
* @returns A promise that resolves to a WebXMouseMessage.
|
|
58
|
-
*/
|
|
59
|
-
private _createMouseMessage;
|
|
60
|
-
/**
|
|
61
|
-
* Decodes a buffer into a WebXWindowsMessage, which contains information about multiple windows.
|
|
62
|
-
*
|
|
63
|
-
* @param buffer The binary message buffer to decode.
|
|
64
|
-
* @returns A promise that resolves to a WebXWindowsMessage.
|
|
65
|
-
*/
|
|
66
|
-
private _createWindowsMessage;
|
|
67
|
-
/**
|
|
68
|
-
* Decodes a buffer into a WebXCursorImageMessage, which contains cursor image data.
|
|
69
|
-
*
|
|
70
|
-
* @param buffer The binary message buffer to decode.
|
|
71
|
-
* @returns A promise that resolves to a WebXCursorImageMessage.
|
|
72
|
-
*/
|
|
73
|
-
private _createCursorImageMessage;
|
|
74
|
-
/**
|
|
75
|
-
* Decodes a buffer into a WebXScreenMessage, which contains screen dimensions.
|
|
76
|
-
*
|
|
77
|
-
* @param buffer The binary message buffer to decode.
|
|
78
|
-
* @returns A promise that resolves to a WebXScreenMessage.
|
|
79
|
-
*/
|
|
80
|
-
private _createScreenMessage;
|
|
81
|
-
/**
|
|
82
|
-
* Creates a WebXPingMessage, which is used for pinging purposes.
|
|
83
|
-
*
|
|
84
|
-
* @returns A promise that resolves to a WebXPingMessage.
|
|
85
|
-
*/
|
|
86
|
-
private _createPingMessage;
|
|
87
|
-
/**
|
|
88
|
-
* Decodes a buffer into a WebXQualityMessage, which contains quality metrics.
|
|
89
|
-
*
|
|
90
|
-
* @param buffer The binary message buffer to decode.
|
|
91
|
-
* @returns A promise that resolves to a WebXQualityMessage.
|
|
92
|
-
*/
|
|
93
|
-
private _createQualityMessage;
|
|
94
|
-
/**
|
|
95
|
-
* Decodes a buffer into a WebXClipboardMessage, which contains X11 clipboard content.
|
|
96
|
-
*
|
|
97
|
-
* @param buffer The binary message buffer to decode.
|
|
98
|
-
* @returns A promise that resolves to a WebXClipboardMessage.
|
|
99
|
-
*/
|
|
100
|
-
private _createClipboardMessage;
|
|
101
|
-
/**
|
|
102
|
-
* Decodes a buffer into a WebXShapeMessage.
|
|
103
|
-
*
|
|
104
|
-
* @param buffer The binary message buffer to decode.
|
|
105
|
-
* @returns A promise that resolves to a WebXShapeMessage.
|
|
106
|
-
*/
|
|
107
|
-
private _createShapeMessage;
|
|
108
|
-
}
|