@v5x/serial 0.5.4 → 0.5.5
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 +72 -6
- package/dist/Vex.d.ts +4 -4
- package/dist/VexCRC.d.ts +0 -1
- package/dist/VexConnection.d.ts +81 -23
- package/dist/VexDevice.d.ts +41 -155
- package/{dts/VexDevice.d.ts → dist/VexDeviceState.d.ts} +63 -55
- package/dist/VexError.d.ts +47 -0
- package/dist/VexFirmware.d.ts +45 -0
- package/dist/VexIniConfig.d.ts +1 -1
- package/dist/VexPacket.d.ts +3 -512
- package/dist/VexPacketBase.d.ts +21 -0
- package/dist/VexPacketEncoder.d.ts +55 -0
- package/{dts/VexPacket.d.ts → dist/VexPacketModels.d.ts} +3 -107
- package/dist/VexPacketView.d.ts +3 -3
- package/dist/VexTransfers.d.ts +20 -0
- package/dist/index.cjs +4541 -0
- package/dist/index.cjs.map +25 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.js +4460 -0
- package/dist/index.js.map +25 -0
- package/package.json +39 -71
- package/dist/v5-serial-protocol.cjs.js +0 -4516
- package/dist/v5-serial-protocol.cjs.js.map +0 -1
- package/dist/v5-serial-protocol.es.js +0 -4401
- package/dist/v5-serial-protocol.es.js.map +0 -1
- package/dts/Vex.d.ts +0 -235
- package/dts/Vex.js +0 -189
- package/dts/Vex.js.map +0 -1
- package/dts/VexCRC.d.ts +0 -19
- package/dts/VexCRC.js +0 -89
- package/dts/VexCRC.js.map +0 -1
- package/dts/VexConnection.d.ts +0 -45
- package/dts/VexConnection.js +0 -500
- package/dts/VexConnection.js.map +0 -1
- package/dts/VexDevice.js +0 -944
- package/dts/VexDevice.js.map +0 -1
- package/dts/VexEvent.d.ts +0 -16
- package/dts/VexEvent.js +0 -47
- package/dts/VexEvent.js.map +0 -1
- package/dts/VexFirmwareVersion.d.ts +0 -55
- package/dts/VexFirmwareVersion.js +0 -104
- package/dts/VexFirmwareVersion.js.map +0 -1
- package/dts/VexIniConfig.d.ts +0 -27
- package/dts/VexIniConfig.js +0 -122
- package/dts/VexIniConfig.js.map +0 -1
- package/dts/VexPacket.js +0 -1036
- package/dts/VexPacket.js.map +0 -1
- package/dts/VexPacketView.d.ts +0 -18
- package/dts/VexPacketView.js +0 -84
- package/dts/VexPacketView.js.map +0 -1
- package/dts/index.d.ts +0 -9
- package/dts/index.js +0 -10
- package/dts/index.js.map +0 -1
- package/index.d.ts +0 -1098
|
@@ -1,66 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { VexFirmwareVersion } from "./VexFirmwareVersion";
|
|
5
|
-
export declare class PacketEncoder {
|
|
6
|
-
static HEADERS_LENGTH: number;
|
|
7
|
-
static HEADER_TO_DEVICE: number[];
|
|
8
|
-
static HEADER_TO_HOST: number[];
|
|
9
|
-
static J2000_EPOCH: number;
|
|
10
|
-
vexVersion: number;
|
|
11
|
-
crcgen: CrcGenerator;
|
|
12
|
-
allPacketsTable: Record<string, typeof HostBoundPacket>;
|
|
13
|
-
static getInstance(): AllPackets.PacketEncoder;
|
|
14
|
-
private constructor();
|
|
15
|
-
/**
|
|
16
|
-
* Create the vex CDC header
|
|
17
|
-
* @param buf the bytes to send
|
|
18
|
-
*/
|
|
19
|
-
createHeader(buf: ArrayBuffer | undefined): Uint8Array;
|
|
20
|
-
/**
|
|
21
|
-
* Create the vex CDC simple message
|
|
22
|
-
* @param cmd the CDC command byte
|
|
23
|
-
*/
|
|
24
|
-
cdcCommand(cmd: number): Uint8Array;
|
|
25
|
-
/**
|
|
26
|
-
* Create the vex CDC simple message
|
|
27
|
-
* @param cmd the CDC command byte
|
|
28
|
-
* @param data the data to send
|
|
29
|
-
*/
|
|
30
|
-
cdcCommandWithData(cmd: number, data: Uint8Array): Uint8Array;
|
|
31
|
-
/**
|
|
32
|
-
* Create the vex CDC extended message
|
|
33
|
-
* @param cmd the CDC command byte
|
|
34
|
-
* @param ext the CDC extended command byte
|
|
35
|
-
* @return a message
|
|
36
|
-
*/
|
|
37
|
-
cdc2Command(cmd: number, ext: number): Uint8Array;
|
|
38
|
-
/**
|
|
39
|
-
* Calculate buffer length for new CDC extended command
|
|
40
|
-
* @param data the CDC extended command payload
|
|
41
|
-
* @returns the required buffer length of the command message
|
|
42
|
-
*/
|
|
43
|
-
cdc2CommandBufferLength(data: Uint8Array): number;
|
|
44
|
-
/**
|
|
45
|
-
* Create the vex CDC extended message with some data
|
|
46
|
-
* @param cmd the CDC command byte
|
|
47
|
-
* @param ext the CDC extended command byte
|
|
48
|
-
* @param data the CDC extended command payload
|
|
49
|
-
* @return a message
|
|
50
|
-
*/
|
|
51
|
-
cdc2CommandWithData(cmd: number, ext: number, data: Uint8Array): Uint8Array;
|
|
52
|
-
validateHeader(data: Uint8Array): boolean;
|
|
53
|
-
validateMessageCdc(data: Uint8Array): boolean;
|
|
54
|
-
getPayloadSize(data: Uint8Array): number;
|
|
55
|
-
}
|
|
56
|
-
export declare abstract class Packet {
|
|
57
|
-
data: Uint8Array;
|
|
58
|
-
static ENCODER: PacketEncoder;
|
|
59
|
-
constructor(rawData: DataArray);
|
|
60
|
-
}
|
|
61
|
-
export declare class DeviceBoundPacket extends Packet {
|
|
62
|
-
constructor(payload?: Uint8Array);
|
|
63
|
-
}
|
|
1
|
+
import { type DataArray, type FileDownloadTarget, type FileExitAction, FileInitAction, type FileInitOption, type FileLoadAction, type FileVendor, type IFileEntry, type IFileMetadata, type ISmartDeviceInfo, type MatchMode, type SlotNumber, type SelectDashScreen } from "./Vex.js";
|
|
2
|
+
import { VexFirmwareVersion } from "./VexFirmwareVersion.js";
|
|
3
|
+
import { DeviceBoundPacket, HostBoundPacket } from "./VexPacketBase.js";
|
|
64
4
|
export declare class Query1H2DPacket extends DeviceBoundPacket {
|
|
65
5
|
static COMMAND_ID: number;
|
|
66
6
|
static COMMAND_EXTENDED_ID: undefined;
|
|
@@ -136,11 +76,6 @@ export declare class GetFileMetadataH2DPacket extends DeviceBoundPacket {
|
|
|
136
76
|
static COMMAND_EXTENDED_ID: number;
|
|
137
77
|
constructor(vendor: FileVendor, fileName: string, options: number);
|
|
138
78
|
}
|
|
139
|
-
export declare class SetFileMetadataH2DPacket extends DeviceBoundPacket {
|
|
140
|
-
static COMMAND_ID: number;
|
|
141
|
-
static COMMAND_EXTENDED_ID: number;
|
|
142
|
-
constructor(vendor: FileVendor, fileName: string, fileInfo: IFileMetadata, options: number);
|
|
143
|
-
}
|
|
144
79
|
export declare class EraseFileH2DPacket extends DeviceBoundPacket {
|
|
145
80
|
static COMMAND_ID: number;
|
|
146
81
|
static COMMAND_EXTENDED_ID: number;
|
|
@@ -195,11 +130,6 @@ export declare class GetRadioStatusH2DPacket extends DeviceBoundPacket {
|
|
|
195
130
|
static COMMAND_EXTENDED_ID: number;
|
|
196
131
|
constructor();
|
|
197
132
|
}
|
|
198
|
-
export declare class GetUserDataH2DPacket extends DeviceBoundPacket {
|
|
199
|
-
static COMMAND_ID: number;
|
|
200
|
-
static COMMAND_EXTENDED_ID: number;
|
|
201
|
-
constructor(e?: Uint8Array);
|
|
202
|
-
}
|
|
203
133
|
export declare class ScreenCaptureH2DPacket extends DeviceBoundPacket {
|
|
204
134
|
static COMMAND_ID: number;
|
|
205
135
|
static COMMAND_EXTENDED_ID: number;
|
|
@@ -213,19 +143,8 @@ export declare class SendDashTouchH2DPacket extends DeviceBoundPacket {
|
|
|
213
143
|
export declare class SelectDashH2DPacket extends DeviceBoundPacket {
|
|
214
144
|
static COMMAND_ID: number;
|
|
215
145
|
static COMMAND_EXTENDED_ID: number;
|
|
216
|
-
/** @param port untested */
|
|
217
146
|
constructor(screen: number | SelectDashScreen, port: number);
|
|
218
147
|
}
|
|
219
|
-
export declare class EnableDashH2DPacket extends DeviceBoundPacket {
|
|
220
|
-
static COMMAND_ID: number;
|
|
221
|
-
static COMMAND_EXTENDED_ID: number;
|
|
222
|
-
constructor(unknown1?: number);
|
|
223
|
-
}
|
|
224
|
-
export declare class DisableDashH2DPacket extends DeviceBoundPacket {
|
|
225
|
-
static COMMAND_ID: number;
|
|
226
|
-
static COMMAND_EXTENDED_ID: number;
|
|
227
|
-
constructor();
|
|
228
|
-
}
|
|
229
148
|
export declare class ReadKeyValueH2DPacket extends DeviceBoundPacket {
|
|
230
149
|
static COMMAND_ID: number;
|
|
231
150
|
static COMMAND_EXTENDED_ID: number;
|
|
@@ -255,13 +174,6 @@ export declare class FactoryEnableH2DPacket extends DeviceBoundPacket {
|
|
|
255
174
|
static COMMAND_EXTENDED_ID: number;
|
|
256
175
|
constructor();
|
|
257
176
|
}
|
|
258
|
-
export declare class HostBoundPacket extends Packet {
|
|
259
|
-
ack: AckType;
|
|
260
|
-
payloadSize: number;
|
|
261
|
-
ackIndex: number;
|
|
262
|
-
constructor(data: DataArray);
|
|
263
|
-
static isValidPacket(data: Uint8Array, n: number): boolean;
|
|
264
|
-
}
|
|
265
177
|
export declare class Query1ReplyD2HPacket extends HostBoundPacket {
|
|
266
178
|
static COMMAND_ID: number;
|
|
267
179
|
static COMMAND_EXTENDED_ID: undefined;
|
|
@@ -363,10 +275,6 @@ export declare class GetFileMetadataReplyD2HPacket extends HostBoundPacket {
|
|
|
363
275
|
file?: IFileMetadata;
|
|
364
276
|
constructor(data: DataArray);
|
|
365
277
|
}
|
|
366
|
-
export declare class SetFileMetadataReplyD2HPacket extends HostBoundPacket {
|
|
367
|
-
static COMMAND_ID: number;
|
|
368
|
-
static COMMAND_EXTENDED_ID: number;
|
|
369
|
-
}
|
|
370
278
|
export declare class EraseFileReplyD2HPacket extends HostBoundPacket {
|
|
371
279
|
static COMMAND_ID: number;
|
|
372
280
|
static COMMAND_EXTENDED_ID: number;
|
|
@@ -452,10 +360,6 @@ export declare class GetRadioStatusReplyD2HPacket extends HostBoundPacket {
|
|
|
452
360
|
timeslot: number;
|
|
453
361
|
constructor(data: DataArray);
|
|
454
362
|
}
|
|
455
|
-
export declare class GetUserDataReplyD2HPacket extends HostBoundPacket {
|
|
456
|
-
static COMMAND_ID: number;
|
|
457
|
-
static COMMAND_EXTENDED_ID: number;
|
|
458
|
-
}
|
|
459
363
|
export declare class ScreenCaptureReplyD2HPacket extends HostBoundPacket {
|
|
460
364
|
static COMMAND_ID: number;
|
|
461
365
|
static COMMAND_EXTENDED_ID: number;
|
|
@@ -468,14 +372,6 @@ export declare class SelectDashReplyD2HPacket extends HostBoundPacket {
|
|
|
468
372
|
static COMMAND_ID: number;
|
|
469
373
|
static COMMAND_EXTENDED_ID: number;
|
|
470
374
|
}
|
|
471
|
-
export declare class EnableDashReplyD2HPacket extends HostBoundPacket {
|
|
472
|
-
static COMMAND_ID: number;
|
|
473
|
-
static COMMAND_EXTENDED_ID: number;
|
|
474
|
-
}
|
|
475
|
-
export declare class DisableDashReplyD2HPacket extends HostBoundPacket {
|
|
476
|
-
static COMMAND_ID: number;
|
|
477
|
-
static COMMAND_EXTENDED_ID: number;
|
|
478
|
-
}
|
|
479
375
|
export declare class ReadKeyValueReplyD2HPacket extends HostBoundPacket {
|
|
480
376
|
static COMMAND_ID: number;
|
|
481
377
|
static COMMAND_EXTENDED_ID: number;
|
package/dist/VexPacketView.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { VexFirmwareVersion } from "./VexFirmwareVersion";
|
|
2
|
-
import { type HostBoundPacket } from "./VexPacket";
|
|
3
|
-
export declare class PacketView extends DataView {
|
|
1
|
+
import { VexFirmwareVersion } from "./VexFirmwareVersion.js";
|
|
2
|
+
import { type HostBoundPacket } from "./VexPacket.js";
|
|
3
|
+
export declare class PacketView extends DataView<ArrayBuffer> {
|
|
4
4
|
position: number;
|
|
5
5
|
littleEndianDefault: boolean;
|
|
6
6
|
constructor(buffer: ArrayBuffer, offset?: number, length?: number);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type IFileBasicInfo, type IFileHandle, FileVendor, type IProgramInfo, type IFileWriteRequest, FileDownloadTarget } from "./Vex.js";
|
|
2
|
+
import { type ProgramIniConfig } from "./VexIniConfig.js";
|
|
3
|
+
import type { V5SerialDeviceState } from "./VexDeviceState.js";
|
|
4
|
+
import { VexSerialError } from "./VexError.js";
|
|
5
|
+
import { ResultAsync } from "neverthrow";
|
|
6
|
+
export declare function getValue(state: V5SerialDeviceState, key: string): ResultAsync<string | undefined, VexSerialError>;
|
|
7
|
+
export declare function setValue(state: V5SerialDeviceState, key: string, value: string): ResultAsync<void, VexSerialError>;
|
|
8
|
+
export declare function listFiles(state: V5SerialDeviceState, vendor?: FileVendor): ResultAsync<IFileHandle[], VexSerialError>;
|
|
9
|
+
export declare function listProgram(state: V5SerialDeviceState): ResultAsync<IProgramInfo[], VexSerialError>;
|
|
10
|
+
export declare function readFile(state: V5SerialDeviceState, request: IFileBasicInfo | string, downloadTarget?: FileDownloadTarget, progressCallback?: (current: number, total: number) => void): ResultAsync<Uint8Array, VexSerialError>;
|
|
11
|
+
export declare function removeFile(state: V5SerialDeviceState, request: IFileBasicInfo | string): ResultAsync<void, VexSerialError>;
|
|
12
|
+
export declare function removeAllFiles(state: V5SerialDeviceState): ResultAsync<void, VexSerialError>;
|
|
13
|
+
export declare function uploadProgram(state: V5SerialDeviceState, iniConfig: ProgramIniConfig, binFileBuf: Uint8Array, coldFileBuf: Uint8Array | undefined, progressCallback: (state: string, current: number, total: number) => void): ResultAsync<boolean, VexSerialError>;
|
|
14
|
+
export declare function writeFile(state: V5SerialDeviceState, request: IFileWriteRequest, progressCallback?: (current: number, total: number) => void): ResultAsync<boolean, VexSerialError>;
|
|
15
|
+
/**
|
|
16
|
+
* @param progressCallback Informs the progress of the download.
|
|
17
|
+
* @returns array of bytes where each pixel is represented by 3 consecutive bytes (rgb).
|
|
18
|
+
* This array's length is 272 width * 480 height * 3 channels = 391680 bytes.
|
|
19
|
+
*/
|
|
20
|
+
export declare function captureScreen(state: V5SerialDeviceState, progressCallback?: (current: number, total: number) => void): ResultAsync<Uint8Array, VexSerialError>;
|