spice-html5-react 0.1.0
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/README.md +262 -0
- package/dist/components/SpiceDisplay.d.ts +109 -0
- package/dist/components/SpiceDisplay.d.ts.map +1 -0
- package/dist/hooks/useSpice.d.ts +107 -0
- package/dist/hooks/useSpice.d.ts.map +1 -0
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +6745 -0
- package/dist/index.mjs.map +1 -0
- package/dist/protocol/bitmap.d.ts +20 -0
- package/dist/protocol/bitmap.d.ts.map +1 -0
- package/dist/protocol/cursor.d.ts +16 -0
- package/dist/protocol/cursor.d.ts.map +1 -0
- package/dist/protocol/display.d.ts +311 -0
- package/dist/protocol/display.d.ts.map +1 -0
- package/dist/protocol/enums.d.ts +677 -0
- package/dist/protocol/enums.d.ts.map +1 -0
- package/dist/protocol/filexfer.d.ts +61 -0
- package/dist/protocol/filexfer.d.ts.map +1 -0
- package/dist/protocol/index.d.ts +34 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/inputs.d.ts +95 -0
- package/dist/protocol/inputs.d.ts.map +1 -0
- package/dist/protocol/lz.d.ts +24 -0
- package/dist/protocol/lz.d.ts.map +1 -0
- package/dist/protocol/main.d.ts +205 -0
- package/dist/protocol/main.d.ts.map +1 -0
- package/dist/protocol/playback.d.ts +51 -0
- package/dist/protocol/playback.d.ts.map +1 -0
- package/dist/protocol/png.d.ts +14 -0
- package/dist/protocol/png.d.ts.map +1 -0
- package/dist/protocol/port.d.ts +46 -0
- package/dist/protocol/port.d.ts.map +1 -0
- package/dist/protocol/quic.d.ts +105 -0
- package/dist/protocol/quic.d.ts.map +1 -0
- package/dist/protocol/resize.d.ts +61 -0
- package/dist/protocol/resize.d.ts.map +1 -0
- package/dist/protocol/simulatecursor.d.ts +49 -0
- package/dist/protocol/simulatecursor.d.ts.map +1 -0
- package/dist/protocol/spicearraybuffer.d.ts +44 -0
- package/dist/protocol/spicearraybuffer.d.ts.map +1 -0
- package/dist/protocol/spiceconn.d.ts +118 -0
- package/dist/protocol/spiceconn.d.ts.map +1 -0
- package/dist/protocol/spicedataview.d.ts +144 -0
- package/dist/protocol/spicedataview.d.ts.map +1 -0
- package/dist/protocol/spicemsg.d.ts +435 -0
- package/dist/protocol/spicemsg.d.ts.map +1 -0
- package/dist/protocol/spicetype.d.ts +166 -0
- package/dist/protocol/spicetype.d.ts.map +1 -0
- package/dist/protocol/ticket.d.ts +14 -0
- package/dist/protocol/ticket.d.ts.map +1 -0
- package/dist/protocol/webm.d.ts +118 -0
- package/dist/protocol/webm.d.ts.map +1 -0
- package/dist/protocol/wire.d.ts +81 -0
- package/dist/protocol/wire.d.ts.map +1 -0
- package/dist/utils/atKeynames.d.ts +96 -0
- package/dist/utils/atKeynames.d.ts.map +1 -0
- package/dist/utils/codeToScancode.d.ts +2 -0
- package/dist/utils/codeToScancode.d.ts.map +1 -0
- package/dist/utils/debug.d.ts +84 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages the progress bar DOM element for a single file transfer.
|
|
3
|
+
*
|
|
4
|
+
* The caller creates an instance with a task ID and File, then calls
|
|
5
|
+
* `createProgressbar()` to inject the DOM elements, `updateProgressbar()`
|
|
6
|
+
* as data is transferred, and `removeProgressbar()` when done.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SpiceFileXferTask {
|
|
9
|
+
/** Unique task ID (matches main channel's fileXferTasks key). */
|
|
10
|
+
readonly id: number;
|
|
11
|
+
/** The file being transferred. */
|
|
12
|
+
readonly file: File;
|
|
13
|
+
/** Whether the user has cancelled via the cancel button. */
|
|
14
|
+
cancelled: boolean;
|
|
15
|
+
/** Container div holding the progress bar and cancel button. */
|
|
16
|
+
private progressbarContainer;
|
|
17
|
+
/** The <progress> element. */
|
|
18
|
+
private progressbar;
|
|
19
|
+
constructor(id: number, file: File);
|
|
20
|
+
/**
|
|
21
|
+
* Create and append the progress bar UI to the transfer area.
|
|
22
|
+
*
|
|
23
|
+
* Looks for an element with id `spice-xfer-area` in the document.
|
|
24
|
+
* If not found, the progress bar is not created.
|
|
25
|
+
*
|
|
26
|
+
* @param xferAreaId - Optional custom container element ID
|
|
27
|
+
* (defaults to 'spice-xfer-area')
|
|
28
|
+
*/
|
|
29
|
+
createProgressbar(xferAreaId?: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Update the progress bar value.
|
|
32
|
+
*
|
|
33
|
+
* @param value - Bytes transferred so far
|
|
34
|
+
*/
|
|
35
|
+
updateProgressbar(value: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove the progress bar from the DOM.
|
|
38
|
+
*/
|
|
39
|
+
removeProgressbar(): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Interface for the connection object that supports file transfer.
|
|
43
|
+
* Avoids importing SpiceMainConn directly to prevent circular deps.
|
|
44
|
+
*/
|
|
45
|
+
export interface FileXferConnection {
|
|
46
|
+
fileXferStart(file: File): void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Handle dragover events on the drop target.
|
|
50
|
+
* Prevents default to allow dropping and sets the drop effect to 'copy'.
|
|
51
|
+
*/
|
|
52
|
+
export declare function handleFileDragover(e: DragEvent): void;
|
|
53
|
+
/**
|
|
54
|
+
* Handle drop events on the drop target.
|
|
55
|
+
* Initiates a file transfer for each dropped file (skipping directories).
|
|
56
|
+
*
|
|
57
|
+
* @param e - The drop event
|
|
58
|
+
* @param connection - The SPICE main connection to start transfers on
|
|
59
|
+
*/
|
|
60
|
+
export declare function handleFileDrop(e: DragEvent, connection: FileXferConnection): void;
|
|
61
|
+
//# sourceMappingURL=filexfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filexfer.d.ts","sourceRoot":"","sources":["../../src/protocol/filexfer.ts"],"names":[],"mappings":"AAyBA;;;;;;GAMG;AACH,qBAAa,iBAAiB;IAE1B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAEpB,4DAA4D;IAC5D,SAAS,UAAS;IAElB,gEAAgE;IAChE,OAAO,CAAC,oBAAoB,CAAyC;IAErE,8BAA8B;IAC9B,OAAO,CAAC,WAAW,CAA8C;gBAErD,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI;IAMlC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,UAAU,GAAE,MAAqB,GAAG,IAAI;IA2C1D;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQtC;;OAEG;IACH,iBAAiB,IAAI,IAAI;CAS5B;AAMD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAE/B,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,CAQrD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,GAAG,IAAI,CAmBjF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { SPICE_MAGIC, SPICE_VERSION_MAJOR, SPICE_VERSION_MINOR, SPICE_CONNECT_TIMEOUT, SPICE_TICKET_KEY_PAIR_LENGTH, SPICE_TICKET_PUBKEY_BYTES, SPICE_SURFACE_FLAGS_PRIMARY, SPICE_INPUT_MOTION_ACK_BUNCH, SpiceCommonCap, SpiceLinkErr, SpiceMsg, SpiceMsgMain, SpiceMsgc, SpiceMsgcMain, SpiceMsgDisplay, SpiceMsgcDisplay, SpiceMsgInputs, SpiceMsgcInputs, SpiceMsgCursor, SpiceMsgPlayback, SpiceMsgPort, SpiceMsgcPort, SpicePlaybackCap, SpiceMainCap, SpiceDisplayCap, SpiceAudioDataMode, SpiceAudioFmt, SpiceChannel, SpiceNotifySeverity, SpiceMouseMode, SpiceClipType, SpiceImageType, SpiceImageFlags, SpiceBitmapFlags, SpiceBitmapFmt, SpiceCursorFlags, SpiceMouseButtonMask, SpiceMouseButton, SpiceBrushType, SpiceSurfaceFmt, SpiceRopd, LzImageType, SpiceCursorType, SpiceVideoCodecType, VD_AGENT_PROTOCOL, VD_AGENT_MAX_DATA_SIZE, VdAgentMsg, VdAgentCap, VdAgentFileXferStatus, VdAgentClipboard, Constants, } from './enums';
|
|
2
|
+
export { ConnectionState, SpiceConn, } from './spiceconn';
|
|
3
|
+
export type { ConnectionStateValue, SpiceConnOptions, } from './spiceconn';
|
|
4
|
+
export { FileXferState, SpiceMainConn, registerChannelFactory, } from './main';
|
|
5
|
+
export type { FileXferStateValue, FileXferTask, FileXferProgressCallback, FileXferCompleteCallback, ClipboardCallback, ChannelConstructor, ChannelMap, SpiceInputsLike, } from './main';
|
|
6
|
+
export { SpiceDisplayConn, } from './display';
|
|
7
|
+
export type { SurfaceEntry, ImageCache, StreamEntry, DisplaySurfaceCallback, } from './display';
|
|
8
|
+
export { SpiceInputsConn, } from './inputs';
|
|
9
|
+
export { SpiceCursorConn, } from './cursor';
|
|
10
|
+
export { SpicePlaybackConn, } from './playback';
|
|
11
|
+
export { SpicePortConn, } from './port';
|
|
12
|
+
export type { PortInitCallback, PortEventCallback, PortDataCallback, SpicePortConnOptions, } from './port';
|
|
13
|
+
export { SpiceFileXferTask, handleFileDragover, handleFileDrop, } from './filexfer';
|
|
14
|
+
export type { FileXferConnection, } from './filexfer';
|
|
15
|
+
export { resizeHelper, SpiceResizeHandler, observeContainerResize, } from './resize';
|
|
16
|
+
export type { ResizableConnection, } from './resize';
|
|
17
|
+
export { SpiceSimulateCursor, } from './simulatecursor';
|
|
18
|
+
export type { CursorData, CursorOwner, } from './simulatecursor';
|
|
19
|
+
export { SpiceWireReader, } from './wire';
|
|
20
|
+
export type { WireCallback, WireOwner, } from './wire';
|
|
21
|
+
export { SpiceLinkHeader, SpiceLinkMess, SpiceLinkReply, SpiceLinkAuthTicket, SpiceLinkAuthReply, SpiceMiniData, SpiceMsgChannels, SpiceMsgClipboardGrab, SpiceMsgClipboardReceive, SpiceMsgClipboardRequest, SpiceMsgClipboardSend, SpiceMsgMainInit, SpiceMsgMainMouseMode, SpiceMsgMainAgentData, SpiceMsgMainAgentTokens, SpiceMsgSetAck, SpiceMsgcAckSync, SpiceMsgcMainMouseModeRequest, SpiceMsgcMainAgentStart, SpiceMsgcMainAgentData, VDAgentAnnounceCapabilities, VDAgentMonitorsConfig, VDAgentFileXferStatusMessage, VDAgentFileXferStartMessage, VDAgentFileXferDataMessage, SpiceMsgNotify, SpiceMsgcDisplayInit, SpiceMsgDisplayBase, SpiceMsgDisplayDrawCopy, SpiceMsgDisplayDrawFill, SpiceMsgDisplayCopyBits, SpiceMsgSurfaceCreate, SpiceMsgSurfaceDestroy, SpiceMsgInputsInit, SpiceMsgInputsKeyModifiers, SpiceMsgCursorInit, SpiceMsgPlaybackData, SpiceMsgPlaybackMode, SpiceMsgPlaybackStart, SpiceMsgCursorSet, SpiceMsgcMousePosition, SpiceMsgcMouseMotion, SpiceMsgcMousePress, SpiceMsgcMouseRelease, SpiceMsgcKeyDown, SpiceMsgcKeyUp, SpiceMsgDisplayStreamCreate, SpiceStreamDataHeader, SpiceMsgDisplayStreamData, SpiceMsgDisplayStreamDataSized, SpiceMsgDisplayStreamClip, SpiceMsgDisplayStreamDestroy, SpiceMsgDisplayStreamActivateReport, SpiceMsgcDisplayStreamReport, SpiceMsgDisplayInvalList, SpiceMsgPortInit, } from './spicemsg';
|
|
22
|
+
export type { Serializable, InvalResource, } from './spicemsg';
|
|
23
|
+
export { SpiceChannelId, SpiceRect, SpiceClipRects, SpiceClip, SpiceImageDescriptor, SpicePalette, SpiceBitmap, SpicePoint, SpicePoint16, SpiceImage, SpiceQMask, SpicePattern, SpiceBrush, SpiceFill, SpiceCopy, SpiceCursorHeader, SpiceCursor, SpiceSurface, registerSpiceQuicFactory, } from './spicetype';
|
|
24
|
+
export type { SpiceQuicData, LzRgbHeader, JpegData, JpegAlphaData, } from './spicetype';
|
|
25
|
+
export { QuicImageType, SpiceQuic, convertSpiceQuicToWeb, } from './quic';
|
|
26
|
+
export type { QuicImageTypeValue, } from './quic';
|
|
27
|
+
export { convertSpiceLzToWeb } from './lz';
|
|
28
|
+
export { convertSpiceBitmapToWeb } from './bitmap';
|
|
29
|
+
export { createRgbaPng } from './png';
|
|
30
|
+
export { WebmConstants, WebmAudio, WebmVideo, WebmAudioTrackEntry, WebmVideoTrackEntry, WebmTracks, WebmCluster, WebmSimpleBlock, WebmHeader, } from './webm';
|
|
31
|
+
export { arrayBufferSlice, concatArrayBuffers, arrayBufferFromUint8Array, arrayBuffersEqual, } from './spicearraybuffer';
|
|
32
|
+
export { SpiceDataView, createSpiceDataView, createDataView, } from './spicedataview';
|
|
33
|
+
export { rsaEncrypt, } from './ticket';
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocol/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb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T,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,wBAAwB,GAC3B,MAAM,aAAa,CAAC;AAErB,YAAY,EACR,aAAa,EACb,WAAW,EACX,QAAQ,EACR,aAAa,GAChB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACH,aAAa,EACb,SAAS,EACT,qBAAqB,GACxB,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACR,kBAAkB,GACrB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAGnD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EACH,aAAa,EACb,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,eAAe,EACf,UAAU,GACb,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACH,aAAa,EACb,mBAAmB,EACnB,cAAc,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACH,UAAU,GACb,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { SpiceConn, SpiceConnOptions } from './spiceconn';
|
|
2
|
+
import { SpiceMiniData } from './spicemsg';
|
|
3
|
+
|
|
4
|
+
export declare class SpiceInputsConn extends SpiceConn {
|
|
5
|
+
mouseX: number | undefined;
|
|
6
|
+
mouseY: number | undefined;
|
|
7
|
+
buttonState: number;
|
|
8
|
+
waitingForAck: number;
|
|
9
|
+
mouseMode: number;
|
|
10
|
+
keyboardModifiers: number;
|
|
11
|
+
private modifiers;
|
|
12
|
+
constructor(options: SpiceConnOptions);
|
|
13
|
+
protected processChannelMessage(msg: SpiceMiniData): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Handle a DOM `keydown` event.
|
|
16
|
+
*
|
|
17
|
+
* Translates the browser key event to an AT scancode and sends
|
|
18
|
+
* SPICE_MSGC_INPUTS_KEY_DOWN. Also checks and syncs modifier
|
|
19
|
+
* key state.
|
|
20
|
+
*/
|
|
21
|
+
handleKeyDown(e: KeyboardEvent): void;
|
|
22
|
+
/**
|
|
23
|
+
* Handle a DOM `keyup` event.
|
|
24
|
+
*
|
|
25
|
+
* Translates the browser key event to an AT break scancode and
|
|
26
|
+
* sends SPICE_MSGC_INPUTS_KEY_UP.
|
|
27
|
+
*/
|
|
28
|
+
handleKeyUp(e: KeyboardEvent): void;
|
|
29
|
+
/**
|
|
30
|
+
* Send the Ctrl+Alt+Del key sequence to the guest.
|
|
31
|
+
*
|
|
32
|
+
* Temporarily presses Ctrl and Alt (if not already held), sends
|
|
33
|
+
* Delete press/release, then restores original modifier state.
|
|
34
|
+
*/
|
|
35
|
+
sendCtrlAltDel(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Send a single modifier key press or release.
|
|
38
|
+
*
|
|
39
|
+
* @param state - true = press, false = release
|
|
40
|
+
* @param code - AT make scancode for the modifier key
|
|
41
|
+
*/
|
|
42
|
+
private updateModifier;
|
|
43
|
+
/**
|
|
44
|
+
* Check the DOM event's modifier flags against our tracked state.
|
|
45
|
+
* If they're out of sync (e.g. because the user alt-tabbed away
|
|
46
|
+
* and released a modifier while we didn't have focus), send
|
|
47
|
+
* corrective press/release messages.
|
|
48
|
+
*
|
|
49
|
+
* @param e - The KeyboardEvent from the browser
|
|
50
|
+
* @param code - The AT scancode (make or break) for the key event
|
|
51
|
+
*/
|
|
52
|
+
private checkAndUpdateModifiers;
|
|
53
|
+
/**
|
|
54
|
+
* Handle a DOM `mousemove` event.
|
|
55
|
+
*
|
|
56
|
+
* In client mode, sends absolute mouse position.
|
|
57
|
+
* In server mode, sends relative mouse motion (using movementX/Y
|
|
58
|
+
* which requires Pointer Lock API).
|
|
59
|
+
*
|
|
60
|
+
* @param e - The MouseEvent from the browser
|
|
61
|
+
* @param displayId - The display ID (usually 0)
|
|
62
|
+
*/
|
|
63
|
+
handleMouseMove(e: MouseEvent, displayId?: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* Handle a DOM `mousedown` event.
|
|
66
|
+
*
|
|
67
|
+
* Translates the DOM button number to a SPICE mouse button,
|
|
68
|
+
* updates the local button state mask, and sends a mouse press.
|
|
69
|
+
*
|
|
70
|
+
* @param e - The MouseEvent from the browser
|
|
71
|
+
*/
|
|
72
|
+
handleMouseDown(e: MouseEvent): void;
|
|
73
|
+
/**
|
|
74
|
+
* Handle a DOM `mouseup` event.
|
|
75
|
+
*
|
|
76
|
+
* @param e - The MouseEvent from the browser
|
|
77
|
+
*/
|
|
78
|
+
handleMouseUp(e: MouseEvent): void;
|
|
79
|
+
/**
|
|
80
|
+
* Handle a DOM `wheel` event (scroll up/down).
|
|
81
|
+
*
|
|
82
|
+
* Sends both a press and immediate release for the scroll button.
|
|
83
|
+
*
|
|
84
|
+
* @param e - The WheelEvent from the browser
|
|
85
|
+
*/
|
|
86
|
+
handleMouseWheel(e: WheelEvent): void;
|
|
87
|
+
/**
|
|
88
|
+
* Handle a DOM `contextmenu` event (right-click menu).
|
|
89
|
+
* Simply prevents the default browser context menu.
|
|
90
|
+
*
|
|
91
|
+
* @param e - The MouseEvent from the browser
|
|
92
|
+
*/
|
|
93
|
+
handleContextMenu(e: MouseEvent): void;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/protocol/inputs.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CA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PE_RGB32 (opaque), LZ_IMAGE_TYPE_RGBA
|
|
7
|
+
* (two-pass: RGB then alpha), and LZ_IMAGE_TYPE_XXXA (alpha-only).
|
|
8
|
+
*
|
|
9
|
+
* The RGB pass decodes BGR pixels with a channel swap to produce RGB
|
|
10
|
+
* in the output ImageData. For RGBA images, a second alpha-only pass
|
|
11
|
+
* fills in the alpha channel. Bottom-up images (the SPICE default)
|
|
12
|
+
* are flipped after the RGB pass so the alpha pass references correct
|
|
13
|
+
* pixel positions.
|
|
14
|
+
*
|
|
15
|
+
* @param context A 2D canvas rendering context (used only to call
|
|
16
|
+
* createImageData for the correct backing store).
|
|
17
|
+
* @param lzImage The deserialized LZ header from the protocol,
|
|
18
|
+
* containing type, width, height, top_down flag,
|
|
19
|
+
* and compressed data.
|
|
20
|
+
* @returns An ImageData with RGBA pixels, or undefined if the LZ
|
|
21
|
+
* image type is not supported.
|
|
22
|
+
*/
|
|
23
|
+
export declare function convertSpiceLzToWeb(context: CanvasRenderingContext2D, lzImage: LzRgbHeader): ImageData | undefined;
|
|
24
|
+
//# sourceMappingURL=lz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lz.d.ts","sourceRoot":"","sources":["../../src/protocol/lz.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA2J7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,WAAW,GACrB,SAAS,GAAG,SAAS,CAoCvB"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { SpiceMiniData, SpiceMsgMainInit, Serializable } from './spicemsg';
|
|
2
|
+
import { SpiceConn, SpiceConnOptions } from './spiceconn';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* State of an individual file transfer task.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FileXferState: {
|
|
8
|
+
readonly PENDING: "pending";
|
|
9
|
+
readonly TRANSFERRING: "transferring";
|
|
10
|
+
readonly COMPLETED: "completed";
|
|
11
|
+
readonly FAILED: "failed";
|
|
12
|
+
readonly CANCELLED: "cancelled";
|
|
13
|
+
};
|
|
14
|
+
export type FileXferStateValue = typeof FileXferState[keyof typeof FileXferState];
|
|
15
|
+
/**
|
|
16
|
+
* Represents a file transfer task managed by the main channel.
|
|
17
|
+
* Tracks state, progress, and the file being transferred.
|
|
18
|
+
*/
|
|
19
|
+
export interface FileXferTask {
|
|
20
|
+
/** Unique task ID assigned by the client */
|
|
21
|
+
id: number;
|
|
22
|
+
/** The File object being transferred */
|
|
23
|
+
file: File;
|
|
24
|
+
/** Current state of the transfer */
|
|
25
|
+
state: FileXferStateValue;
|
|
26
|
+
/** Whether the user has cancelled this transfer */
|
|
27
|
+
cancelled: boolean;
|
|
28
|
+
/** Byte offset for next read (used when re-queued after token exhaustion) */
|
|
29
|
+
readBytes: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Callback for file transfer progress events.
|
|
33
|
+
*/
|
|
34
|
+
export interface FileXferProgressCallback {
|
|
35
|
+
(taskId: number, bytesTransferred: number, totalBytes: number, filename: string): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Callback for file transfer completion events.
|
|
39
|
+
*/
|
|
40
|
+
export interface FileXferCompleteCallback {
|
|
41
|
+
(taskId: number, filename: string, error?: string): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Callback for clipboard events (text received from guest).
|
|
45
|
+
*/
|
|
46
|
+
export interface ClipboardCallback {
|
|
47
|
+
(text: string): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Interface for sub-channel constructors.
|
|
51
|
+
* Each sub-channel class must accept SpiceConnOptions and extend SpiceConn.
|
|
52
|
+
*/
|
|
53
|
+
export interface ChannelConstructor {
|
|
54
|
+
new (options: SpiceConnOptions): SpiceConn;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Typed map of spawned sub-channels, keyed by channel role.
|
|
58
|
+
*/
|
|
59
|
+
export interface ChannelMap {
|
|
60
|
+
display: SpiceConn | undefined;
|
|
61
|
+
inputs: SpiceInputsLike | undefined;
|
|
62
|
+
cursor: SpiceConn | undefined;
|
|
63
|
+
playback: SpiceConn | undefined;
|
|
64
|
+
ports: SpiceConn[];
|
|
65
|
+
extra: SpiceConn[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Minimal interface for an inputs channel that supports mouse mode.
|
|
69
|
+
* Avoids importing the concrete SpiceInputsConn class to prevent
|
|
70
|
+
* circular dependencies.
|
|
71
|
+
*/
|
|
72
|
+
export interface SpiceInputsLike extends SpiceConn {
|
|
73
|
+
mouseMode: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Register a channel constructor for a given SPICE channel type.
|
|
77
|
+
*
|
|
78
|
+
* @param type - The SpiceChannel.* constant (e.g., SpiceChannel.DISPLAY)
|
|
79
|
+
* @param ctor - The constructor function for that channel type
|
|
80
|
+
*/
|
|
81
|
+
export declare function registerChannelFactory(type: number, ctor: ChannelConstructor): void;
|
|
82
|
+
/**
|
|
83
|
+
* The main SPICE connection channel. Handles session init, channel
|
|
84
|
+
* list, mouse mode negotiation, and sub-channel spawning.
|
|
85
|
+
*
|
|
86
|
+
* Invocation: pass a SpiceConnOptions object with at least `uri` and
|
|
87
|
+
* `password`. Optional: `screenId`, `dumpId`, `messageId`, `onerror`,
|
|
88
|
+
* `onsuccess`, `onagent`.
|
|
89
|
+
*/
|
|
90
|
+
export declare class SpiceMainConn extends SpiceConn {
|
|
91
|
+
mainInit: SpiceMsgMainInit | undefined;
|
|
92
|
+
mouseMode: number;
|
|
93
|
+
ourMmTime: number;
|
|
94
|
+
mmTime: number;
|
|
95
|
+
channels: ChannelMap;
|
|
96
|
+
agentConnected: boolean;
|
|
97
|
+
agentTokens: number;
|
|
98
|
+
agentMsgQueue: SpiceMiniData[];
|
|
99
|
+
agentCaps: number[];
|
|
100
|
+
fileXferTasks: Record<number, FileXferTask>;
|
|
101
|
+
fileXferTaskId: number;
|
|
102
|
+
fileXferReadQueue: FileXferTask[];
|
|
103
|
+
onFileXferProgress: FileXferProgressCallback | undefined;
|
|
104
|
+
onFileXferComplete: FileXferCompleteCallback | undefined;
|
|
105
|
+
onClipboard: ClipboardCallback | undefined;
|
|
106
|
+
constructor(options: SpiceConnOptions);
|
|
107
|
+
protected processChannelMessage(msg: SpiceMiniData): boolean;
|
|
108
|
+
private handleInit;
|
|
109
|
+
private handleChannelsList;
|
|
110
|
+
/**
|
|
111
|
+
* Create a sub-channel using the registered factory, or fall back
|
|
112
|
+
* to a generic SpiceConn if no factory is registered.
|
|
113
|
+
*/
|
|
114
|
+
private createChannel;
|
|
115
|
+
private handleMouseModeMsg;
|
|
116
|
+
/**
|
|
117
|
+
* Handle mouse mode: prefer client mode, update inputs channel.
|
|
118
|
+
*/
|
|
119
|
+
private handleMouseMode;
|
|
120
|
+
/**
|
|
121
|
+
* Connect to the VD agent. Sends AGENT_START and announces
|
|
122
|
+
* capabilities. Calls the onagent callback if provided.
|
|
123
|
+
*/
|
|
124
|
+
connectAgent(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Announce agent capabilities to the server.
|
|
127
|
+
*/
|
|
128
|
+
announceAgentCapabilities(request: number): void;
|
|
129
|
+
/**
|
|
130
|
+
* Queue a message for delivery to the VD agent, respecting token flow
|
|
131
|
+
* control.
|
|
132
|
+
*/
|
|
133
|
+
sendAgentMessageQueue(message?: SpiceMiniData): void;
|
|
134
|
+
/**
|
|
135
|
+
* Send a typed message to the VD agent, splitting into chunks if
|
|
136
|
+
* the message exceeds the maximum agent data size.
|
|
137
|
+
*/
|
|
138
|
+
sendAgentMessage(type: number, message: Serializable): void;
|
|
139
|
+
private handleAgentToken;
|
|
140
|
+
/**
|
|
141
|
+
* Handle incoming VD agent data. Dispatches to clipboard and file
|
|
142
|
+
* transfer handlers based on agent message type.
|
|
143
|
+
*/
|
|
144
|
+
private handleAgentData;
|
|
145
|
+
/**
|
|
146
|
+
* Start a file transfer to the guest. Creates a tracking task and
|
|
147
|
+
* sends the VD_AGENT_FILE_XFER_START message to the agent.
|
|
148
|
+
*/
|
|
149
|
+
fileXferStart(file: File): void;
|
|
150
|
+
/**
|
|
151
|
+
* Handle a file transfer status message from the agent.
|
|
152
|
+
* Dispatches based on status result code.
|
|
153
|
+
*/
|
|
154
|
+
private handleFileXferStatus;
|
|
155
|
+
/**
|
|
156
|
+
* Read a chunk of file data and send it to the agent.
|
|
157
|
+
* If no agent tokens are available, queues the task for later.
|
|
158
|
+
*/
|
|
159
|
+
private fileXferRead;
|
|
160
|
+
/**
|
|
161
|
+
* Mark a file transfer as completed (success or failure) and
|
|
162
|
+
* clean up the task.
|
|
163
|
+
*/
|
|
164
|
+
private fileXferCompleted;
|
|
165
|
+
/**
|
|
166
|
+
* Cancel an in-progress file transfer by task ID.
|
|
167
|
+
* The transfer will be cancelled on the next read attempt.
|
|
168
|
+
*/
|
|
169
|
+
cancelFileXfer(taskId: number): void;
|
|
170
|
+
/**
|
|
171
|
+
* Handle clipboard grab from the agent. The agent is indicating
|
|
172
|
+
* that it has clipboard data; we respond by requesting it.
|
|
173
|
+
*/
|
|
174
|
+
private handleClipboardGrab;
|
|
175
|
+
/**
|
|
176
|
+
* Handle clipboard data received from the agent.
|
|
177
|
+
* Writes UTF-8 text to the browser clipboard if available.
|
|
178
|
+
*/
|
|
179
|
+
private handleClipboardReceive;
|
|
180
|
+
/**
|
|
181
|
+
* Handle clipboard data request from the agent. The agent wants
|
|
182
|
+
* the browser's clipboard data; we read it and send it back.
|
|
183
|
+
*/
|
|
184
|
+
private handleClipboardSend;
|
|
185
|
+
/**
|
|
186
|
+
* Send a clipboard grab to the agent. Tells the agent that the
|
|
187
|
+
* browser has clipboard data and the agent should request it.
|
|
188
|
+
*/
|
|
189
|
+
sendClipboardGrab(): void;
|
|
190
|
+
/**
|
|
191
|
+
* Send a monitor configuration message to resize the guest display.
|
|
192
|
+
*/
|
|
193
|
+
resizeWindow(flags: number, width: number, height: number, depth: number, x: number, y: number): void;
|
|
194
|
+
/**
|
|
195
|
+
* Shift current time to attempt to get a time matching that of the
|
|
196
|
+
* server.
|
|
197
|
+
*/
|
|
198
|
+
relativeNow(): number;
|
|
199
|
+
/**
|
|
200
|
+
* Stop the main connection and all sub-channels.
|
|
201
|
+
*/
|
|
202
|
+
stop(): void;
|
|
203
|
+
}
|
|
204
|
+
export { SpiceMainConn as default };
|
|
205
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/protocol/main.ts"],"names":[],"mappings":"AAwBA,OAAO,EACH,aAAa,EACb,gBAAgB,EAiBhB,YAAY,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAmB,MAAM,aAAa,CAAC;AAO3E;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,OAAO,aAAa,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAElF;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,IAAI,EAAE,IAAI,CAAC;IACX,oCAAoC;IACpC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,mDAAmD;IACnD,SAAS,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1F;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;I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AAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACV,IAAI;IAiBP;;;OAGG;IACH,WAAW,IAAI,MAAM;IASrB;;OAEG;IACH,IAAI,IAAI,IAAI;CA0Cf;AAED,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SpiceConn, SpiceConnOptions } from './spiceconn';
|
|
2
|
+
import { SpiceMiniData } from './spicemsg';
|
|
3
|
+
|
|
4
|
+
export declare class SpicePlaybackConn extends SpiceConn {
|
|
5
|
+
/** Queued ArrayBuffers waiting to be appended to the SourceBuffer. */
|
|
6
|
+
private queue;
|
|
7
|
+
/** Whether the SourceBuffer is ready for a new appendBuffer call. */
|
|
8
|
+
private appendOkay;
|
|
9
|
+
/** Timestamp of the first audio packet (ms), used as WebM time base. */
|
|
10
|
+
private startTime;
|
|
11
|
+
/** Timestamp of the start of the current WebM cluster (ms). */
|
|
12
|
+
private clusterTime;
|
|
13
|
+
/** Last received data timestamp, for gap detection / smoothing. */
|
|
14
|
+
private lastDataTime;
|
|
15
|
+
/** Total bytes written to the WebM stream (for debug). */
|
|
16
|
+
private bytesWritten;
|
|
17
|
+
/** The MediaSource driving the <audio> element. */
|
|
18
|
+
private mediaSource;
|
|
19
|
+
/** The SourceBuffer for appending WebM data. */
|
|
20
|
+
private sourceBuffer;
|
|
21
|
+
/** The <audio> element used for playback. */
|
|
22
|
+
private audioElement;
|
|
23
|
+
private readonly onSourceOpen;
|
|
24
|
+
private readonly onSourceEnded;
|
|
25
|
+
private readonly onSourceClosed;
|
|
26
|
+
private readonly onSourceBufferError;
|
|
27
|
+
private readonly onAppendBufferDone;
|
|
28
|
+
constructor(options: SpiceConnOptions);
|
|
29
|
+
protected processChannelMessage(msg: SpiceMiniData): boolean;
|
|
30
|
+
/** Begin playback: write the WebM header + tracks, then start the first cluster. */
|
|
31
|
+
private startPlayback;
|
|
32
|
+
/** Start a new WebM cluster at the given data's timestamp. */
|
|
33
|
+
private newCluster;
|
|
34
|
+
/** Write a simple block for a single audio packet. */
|
|
35
|
+
private simpleBlock;
|
|
36
|
+
/** Safely call appendBuffer, marking appendOkay false. */
|
|
37
|
+
private appendBuffer;
|
|
38
|
+
/** Stop playback: remove audio element, release resources. */
|
|
39
|
+
private stopPlayback;
|
|
40
|
+
private handleSourceOpen;
|
|
41
|
+
private handleSourceEnded;
|
|
42
|
+
private handleSourceClosed;
|
|
43
|
+
private handleSourceBufferError;
|
|
44
|
+
private handleAppendBufferDone;
|
|
45
|
+
private logPlaybackDebugEvent;
|
|
46
|
+
/** Attach debug event listeners to the <audio> element. */
|
|
47
|
+
private listenForAudioEvents;
|
|
48
|
+
private removeMediaSourceListeners;
|
|
49
|
+
cleanup(): void;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=playback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback.d.ts","sourceRoot":"","sources":["../../src/protocol/playback.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQ/D,OAAO,EACH,aAAa,EAIhB,MAAM,YAAY,CAAC;AAqDpB,qBAAa,iBAAkB,SAAQ,SAAS;IAE5C,sEAAsE;IACtE,OAAO,CAAC,KAAK,CAAqB;IAElC,qEAAqE;IACrE,OAAO,CAAC,UAAU,CAAS;IAE3B,wEAAwE;IACxE,OAAO,CAAC,SAAS,CAAK;IAEtB,+DAA+D;IAC/D,OAAO,CAAC,WAAW,CAAK;IAExB,mEAAmE;IACnE,OAAO,CAAC,YAAY,CAAK;IAEzB,0DAA0D;IAC1D,OAAO,CAAC,YAAY,CAAK;IAEzB,mDAAmD;IACnD,OAAO,CAAC,WAAW,CAAsC;IAEzD,gDAAgD;IAChD,OAAO,CAAC,YAAY,CAAuC;IAE3D,6CAA6C;IAC7C,OAAO,CAAC,YAAY,CAA2C;IAI/D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4C;IACzE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6C;IAC3E,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA8C;IAC7E,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA4D;IAChG,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAkD;gBAEzE,OAAO,EAAE,gBAAgB;cASlB,qBAAqB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO;IAqMrE,oFAAoF;IACpF,OAAO,CAAC,aAAa;IAyBrB,8DAA8D;IAC9D,OAAO,CAAC,UAAU;IAqBlB,sDAAsD;IACtD,OAAO,CAAC,WAAW;IA8BnB,0DAA0D;IAC1D,OAAO,CAAC,YAAY;IAmBpB,8DAA8D;IAC9D,OAAO,CAAC,YAAY;IAqCpB,OAAO,CAAC,gBAAgB;IA4BxB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,sBAAsB;IAmB9B,OAAO,CAAC,qBAAqB;IA6B7B,2DAA2D;IAC3D,OAAO,CAAC,oBAAoB;IAsD5B,OAAO,CAAC,0BAA0B;IAczB,OAAO,IAAI,IAAI;CAQ3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a PNG data URI from raw RGBA pixel data.
|
|
3
|
+
*
|
|
4
|
+
* Returns a full `data:image/png;base64,...` string suitable for use
|
|
5
|
+
* as a CSS `url()` value or an `<img>` element's `src` attribute.
|
|
6
|
+
*
|
|
7
|
+
* @param width - Image width in pixels
|
|
8
|
+
* @param height - Image height in pixels
|
|
9
|
+
* @param bytes - Raw RGBA pixel data (4 bytes per pixel, row-major)
|
|
10
|
+
* @returns A data URI string containing the PNG image
|
|
11
|
+
*/
|
|
12
|
+
declare function createRgbaPng(width: number, height: number, bytes: ArrayBuffer): string;
|
|
13
|
+
export { createRgbaPng, };
|
|
14
|
+
//# sourceMappingURL=png.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../../src/protocol/png.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;GAUG;AACH,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAqBhF;AAED,OAAO,EACH,aAAa,GAChB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SpiceMiniData } from './spicemsg';
|
|
2
|
+
import { SpiceConn, SpiceConnOptions } from './spiceconn';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Callback invoked when the port channel receives initialization data.
|
|
6
|
+
*/
|
|
7
|
+
export interface PortInitCallback {
|
|
8
|
+
(portName: string, opened: boolean): void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Callback invoked when the port channel receives a port event.
|
|
12
|
+
*/
|
|
13
|
+
export interface PortEventCallback {
|
|
14
|
+
(portName: string, eventData: Uint8Array): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Callback invoked when the port channel receives data.
|
|
18
|
+
*/
|
|
19
|
+
export interface PortDataCallback {
|
|
20
|
+
(portName: string, data: ArrayBuffer): void;
|
|
21
|
+
}
|
|
22
|
+
export interface SpicePortConnOptions extends SpiceConnOptions {
|
|
23
|
+
onPortInit?: PortInitCallback;
|
|
24
|
+
onPortEvent?: PortEventCallback;
|
|
25
|
+
onPortData?: PortDataCallback;
|
|
26
|
+
}
|
|
27
|
+
export declare class SpicePortConn extends SpiceConn {
|
|
28
|
+
portName: string | null;
|
|
29
|
+
portOpened: boolean;
|
|
30
|
+
onPortInit: PortInitCallback | undefined;
|
|
31
|
+
onPortEvent: PortEventCallback | undefined;
|
|
32
|
+
onPortData: PortDataCallback | undefined;
|
|
33
|
+
constructor(options: SpiceConnOptions);
|
|
34
|
+
protected processChannelMessage(msg: SpiceMiniData): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Send data to the port channel.
|
|
37
|
+
*/
|
|
38
|
+
sendPortData(data: ArrayBuffer): void;
|
|
39
|
+
/**
|
|
40
|
+
* Send a port event.
|
|
41
|
+
*/
|
|
42
|
+
sendPortEvent(eventData: ArrayBuffer): void;
|
|
43
|
+
cleanup(): void;
|
|
44
|
+
}
|
|
45
|
+
export { SpicePortConn as default };
|
|
46
|
+
//# sourceMappingURL=port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/protocol/port.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAoB,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQ1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;CAC/C;AAMD,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC1D,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAMD,qBAAa,aAAc,SAAQ,SAAS;IAExC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC/B,UAAU,EAAE,OAAO,CAAS;IAE5B,UAAU,EAAE,gBAA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