@v5x/serial 0.5.4 → 0.5.6
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 +73 -9
- package/dist/Vex.d.ts +4 -4
- package/dist/VexCRC.d.ts +0 -12
- package/dist/VexConnection.d.ts +106 -26
- package/dist/VexDevice.d.ts +52 -157
- package/{dts/VexDevice.d.ts → dist/VexDeviceState.d.ts} +79 -62
- package/dist/VexError.d.ts +50 -0
- package/dist/VexEvent.d.ts +15 -10
- package/dist/VexFirmware.d.ts +47 -0
- package/dist/VexFirmwareVersion.d.ts +4 -43
- package/dist/VexIniConfig.d.ts +1 -2
- package/dist/VexPacket.d.ts +3 -512
- package/dist/VexPacketBase.d.ts +24 -0
- package/dist/VexPacketEncoder.d.ts +36 -0
- package/{dts/VexPacket.d.ts → dist/VexPacketModels.d.ts} +3 -118
- package/dist/VexPacketView.d.ts +5 -3
- package/dist/VexTransfers.d.ts +20 -0
- package/dist/index.cjs +4175 -0
- package/dist/index.cjs.map +25 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.js +4093 -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,25 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
import { type
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { type MatchMode, SerialDeviceType, type SlotNumber, type ISmartDeviceInfo, SmartDeviceType, FileVendor, type IProgramInfo, type IFileHandle, type IFileBasicInfo, type IFileWriteRequest, FileDownloadTarget, RadioChannelType } from "./Vex.js";
|
|
2
|
+
import { type V5SerialConnection } from "./VexConnection.js";
|
|
3
|
+
import { VexEventTarget } from "./VexEvent.js";
|
|
4
|
+
import { VexFirmwareVersion } from "./VexFirmwareVersion.js";
|
|
5
|
+
import { type ProgramIniConfig } from "./VexIniConfig.js";
|
|
6
|
+
import { VexSerialError } from "./VexError.js";
|
|
7
|
+
import { ResultAsync } from "neverthrow";
|
|
8
|
+
import type { V5SerialDevice } from "./VexDevice.js";
|
|
9
|
+
export interface VexSerialDeviceEvents {
|
|
10
|
+
disconnected: undefined;
|
|
11
|
+
error: unknown;
|
|
12
|
+
}
|
|
13
|
+
export declare abstract class VexSerialDevice extends VexEventTarget<VexSerialDeviceEvents> {
|
|
12
14
|
connection: V5SerialConnection | undefined;
|
|
13
15
|
defaultSerial: Serial;
|
|
14
16
|
get isConnected(): boolean;
|
|
15
17
|
get deviceType(): SerialDeviceType | undefined;
|
|
16
18
|
constructor(defaultSerial: Serial);
|
|
17
|
-
abstract connect(conn?: V5SerialConnection):
|
|
18
|
-
abstract disconnect(): void
|
|
19
|
+
abstract connect(conn?: V5SerialConnection): ResultAsync<void, VexSerialError>;
|
|
20
|
+
abstract disconnect(): Promise<void>;
|
|
19
21
|
}
|
|
20
|
-
declare class V5SerialDeviceState {
|
|
22
|
+
export declare class V5SerialDeviceState {
|
|
21
23
|
_instance: V5SerialDevice;
|
|
22
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Counter used only to pause automatic refresh while a file transfer
|
|
26
|
+
* is in flight. This is not a mutex: serialization of transfer
|
|
27
|
+
* operations lives on the {@link V5SerialConnection} transaction queue.
|
|
28
|
+
*/
|
|
29
|
+
private refreshPauseDepth;
|
|
30
|
+
get isRefreshPaused(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use {@link isRefreshPaused}. This flag only means that
|
|
33
|
+
* automatic refresh is paused, not that transfer operations are locked.
|
|
34
|
+
*/
|
|
35
|
+
get isFileTransferring(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Increment the refresh-pause depth, run the operation, and decrement
|
|
38
|
+
* the depth again. The actual transfer mutex lives on the connection.
|
|
39
|
+
*/
|
|
40
|
+
withRefreshPaused<T>(operation: () => PromiseLike<T>): Promise<T>;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use {@link withRefreshPaused}. This only pauses automatic
|
|
43
|
+
* refresh and does not lock file transfers.
|
|
44
|
+
*/
|
|
45
|
+
withFileTransfer<T>(operation: () => PromiseLike<T>): Promise<T>;
|
|
23
46
|
brain: {
|
|
24
47
|
activeProgram: number;
|
|
25
48
|
battery: {
|
|
@@ -41,15 +64,11 @@ declare class V5SerialDeviceState {
|
|
|
41
64
|
systemVersion: VexFirmwareVersion;
|
|
42
65
|
uniqueId: number;
|
|
43
66
|
};
|
|
44
|
-
controllers:
|
|
67
|
+
controllers: {
|
|
45
68
|
battery: number;
|
|
46
69
|
isAvailable: boolean;
|
|
47
70
|
isCharging: boolean;
|
|
48
|
-
}
|
|
49
|
-
battery: number;
|
|
50
|
-
isAvailable: boolean;
|
|
51
|
-
isCharging?: undefined;
|
|
52
|
-
})[];
|
|
71
|
+
}[];
|
|
53
72
|
devices: Array<ISmartDeviceInfo | undefined>;
|
|
54
73
|
isFieldControllerConnected: boolean;
|
|
55
74
|
matchMode: MatchMode;
|
|
@@ -67,10 +86,37 @@ declare class V5SerialDeviceState {
|
|
|
67
86
|
}
|
|
68
87
|
export declare class V5Brain {
|
|
69
88
|
private readonly state;
|
|
89
|
+
private readonly batteryFacade;
|
|
90
|
+
private readonly buttonFacade;
|
|
91
|
+
private readonly settingsFacade;
|
|
70
92
|
constructor(state: V5SerialDeviceState);
|
|
71
93
|
get isRunningProgram(): boolean;
|
|
72
94
|
get activeProgram(): number;
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated Setting this property dispatches a fire-and-forget
|
|
97
|
+
* request that cannot be awaited. Use {@link setActiveProgram}
|
|
98
|
+
* instead, which returns a {@link ResultAsync} that resolves to an
|
|
99
|
+
* error result when the device refuses or is disconnected.
|
|
100
|
+
*/
|
|
73
101
|
set activeProgram(value: number);
|
|
102
|
+
/**
|
|
103
|
+
* Load a program slot on the brain, or stop the currently running
|
|
104
|
+
* program when called with `0`. Resolves to an error result when the
|
|
105
|
+
* device refuses, the request times out, or no connection is open.
|
|
106
|
+
*/
|
|
107
|
+
setActiveProgram(value: SlotNumber | 0): ResultAsync<void, VexSerialError>;
|
|
108
|
+
/**
|
|
109
|
+
* Request that the brain start running the program in the given slot.
|
|
110
|
+
* Resolves to an error result when the device refuses, the request
|
|
111
|
+
* times out, or no connection is open.
|
|
112
|
+
*/
|
|
113
|
+
runProgram(slot: SlotNumber | string): ResultAsync<void, VexSerialError>;
|
|
114
|
+
/**
|
|
115
|
+
* Request that the brain stop the currently running program. Resolves
|
|
116
|
+
* to an error result when the device refuses, the request times out,
|
|
117
|
+
* or no connection is open.
|
|
118
|
+
*/
|
|
119
|
+
stopProgram(): ResultAsync<void, VexSerialError>;
|
|
74
120
|
get battery(): V5Battery;
|
|
75
121
|
get button(): V5BrainButton;
|
|
76
122
|
get cpu0Version(): VexFirmwareVersion;
|
|
@@ -79,23 +125,23 @@ export declare class V5Brain {
|
|
|
79
125
|
get settings(): V5BrainSettings;
|
|
80
126
|
get systemVersion(): VexFirmwareVersion;
|
|
81
127
|
get uniqueId(): number;
|
|
82
|
-
getValue(key: string):
|
|
83
|
-
setValue(key: string, value: string):
|
|
84
|
-
listFiles(vendor?: FileVendor):
|
|
85
|
-
listProgram():
|
|
86
|
-
readFile(request: IFileBasicInfo | string, downloadTarget?: FileDownloadTarget, progressCallback?: (current: number, total: number) => void):
|
|
87
|
-
removeFile(request: IFileBasicInfo | string):
|
|
88
|
-
removeAllFiles():
|
|
89
|
-
uploadFirmware(publicUrl?: string, usingVersion?: string, progressCallback?: (state: string, current: number, total: number) => void):
|
|
90
|
-
uploadProgram(iniConfig: ProgramIniConfig, binFileBuf: Uint8Array, coldFileBuf: Uint8Array | undefined, progressCallback: (state: string, current: number, total: number) => void):
|
|
91
|
-
writeFile(request: IFileWriteRequest, progressCallback?: (current: number, total: number) => void):
|
|
128
|
+
getValue(key: string): ResultAsync<string | undefined, VexSerialError>;
|
|
129
|
+
setValue(key: string, value: string): ResultAsync<void, VexSerialError>;
|
|
130
|
+
listFiles(vendor?: FileVendor): ResultAsync<IFileHandle[], VexSerialError>;
|
|
131
|
+
listProgram(): ResultAsync<IProgramInfo[], VexSerialError>;
|
|
132
|
+
readFile(request: IFileBasicInfo | string, downloadTarget?: FileDownloadTarget, progressCallback?: (current: number, total: number) => void): ResultAsync<Uint8Array, VexSerialError>;
|
|
133
|
+
removeFile(request: IFileBasicInfo | string): ResultAsync<void, VexSerialError>;
|
|
134
|
+
removeAllFiles(): ResultAsync<void, VexSerialError>;
|
|
135
|
+
uploadFirmware(publicUrl?: string, usingVersion?: string, progressCallback?: (state: string, current: number, total: number) => void): ResultAsync<boolean, VexSerialError>;
|
|
136
|
+
uploadProgram(iniConfig: ProgramIniConfig, binFileBuf: Uint8Array, coldFileBuf: Uint8Array | undefined, progressCallback: (state: string, current: number, total: number) => void): ResultAsync<boolean, VexSerialError>;
|
|
137
|
+
writeFile(request: IFileWriteRequest, progressCallback?: (current: number, total: number) => void): ResultAsync<boolean, VexSerialError>;
|
|
92
138
|
/**
|
|
93
139
|
*
|
|
94
140
|
* @param progressCallback Informs the progress of the download.
|
|
95
141
|
* @returns array of bytes where each pixel is represented by 3 consecutive bytes (rgb).
|
|
96
142
|
* This array's length is 272 width * 480 height * 3 channels = 391680 bytes.
|
|
97
143
|
*/
|
|
98
|
-
captureScreen(progressCallback?: (current: number, total: number) => void):
|
|
144
|
+
captureScreen(progressCallback?: (current: number, total: number) => void): ResultAsync<Uint8Array, VexSerialError>;
|
|
99
145
|
}
|
|
100
146
|
export declare class V5Battery {
|
|
101
147
|
private readonly state;
|
|
@@ -144,34 +190,5 @@ export declare class V5Radio {
|
|
|
144
190
|
get isVexNet(): boolean;
|
|
145
191
|
get isRadioData(): boolean;
|
|
146
192
|
get latency(): number;
|
|
147
|
-
changeChannel(channel: RadioChannelType):
|
|
148
|
-
}
|
|
149
|
-
export declare class V5SerialDevice extends VexSerialDevice {
|
|
150
|
-
autoReconnect: boolean;
|
|
151
|
-
autoRefresh: boolean;
|
|
152
|
-
pauseRefreshOnFileTransfer: boolean;
|
|
153
|
-
protected _isReconnecting: boolean;
|
|
154
|
-
private _refreshInterval;
|
|
155
|
-
state: V5SerialDeviceState;
|
|
156
|
-
constructor(defaultSerial: Serial);
|
|
157
|
-
get isV5Controller(): boolean;
|
|
158
|
-
get brain(): V5Brain;
|
|
159
|
-
get controllers(): [V5Controller, V5Controller];
|
|
160
|
-
get devices(): V5SmartDevice[];
|
|
161
|
-
get isFieldControllerConnected(): boolean;
|
|
162
|
-
get matchMode(): MatchMode;
|
|
163
|
-
set matchMode(value: MatchMode);
|
|
164
|
-
get radio(): V5Radio;
|
|
165
|
-
mockTouch(x: number, y: number, press: boolean): Promise<boolean>;
|
|
166
|
-
connect(conn?: V5SerialConnection): Promise<boolean>;
|
|
167
|
-
disconnect(): Promise<void>;
|
|
168
|
-
dispose(): Promise<void>;
|
|
169
|
-
/**
|
|
170
|
-
* @param timeout defaults to 0. If timeout is 0, then it will attempt to reconnect forever
|
|
171
|
-
* @returns
|
|
172
|
-
*/
|
|
173
|
-
reconnect(timeout?: number): Promise<boolean>;
|
|
174
|
-
private doAfterConnect;
|
|
175
|
-
refresh(): Promise<boolean>;
|
|
193
|
+
changeChannel(channel: RadioChannelType): ResultAsync<void, VexSerialError>;
|
|
176
194
|
}
|
|
177
|
-
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type AckType } from "./Vex.js";
|
|
2
|
+
/**
|
|
3
|
+
* Typed error hierarchy for the serial protocol package.
|
|
4
|
+
*
|
|
5
|
+
* Every public async API that can fail returns a {@link Result} (or
|
|
6
|
+
* {@link ResultAsync}) whose error channel is a {@link VexSerialError}.
|
|
7
|
+
* Each error carries a stable {@link VexSerialError.kind} discriminator
|
|
8
|
+
* so callers can branch on the failure category without parsing messages.
|
|
9
|
+
*/
|
|
10
|
+
export type VexSerialErrorKind = "not-connected" | "invalid-argument" | "protocol" | "transfer" | "download" | "firmware" | "io";
|
|
11
|
+
/** Base class for every failure surfaced by the serial package. */
|
|
12
|
+
export declare class VexSerialError extends Error {
|
|
13
|
+
readonly kind: VexSerialErrorKind;
|
|
14
|
+
readonly ackType: AckType | undefined;
|
|
15
|
+
constructor(kind: VexSerialErrorKind, message: string);
|
|
16
|
+
}
|
|
17
|
+
/** No connection is currently open to a device. */
|
|
18
|
+
export declare class VexNotConnectedError extends VexSerialError {
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
/** A caller supplied an invalid argument value. */
|
|
22
|
+
export declare class VexInvalidArgumentError extends VexSerialError {
|
|
23
|
+
constructor(message: string);
|
|
24
|
+
}
|
|
25
|
+
/** The device refused, timed out, or replied unexpectedly to a command. */
|
|
26
|
+
export declare class VexProtocolError extends VexSerialError {
|
|
27
|
+
readonly ackType: AckType | undefined;
|
|
28
|
+
constructor(message: string, ackType?: AckType);
|
|
29
|
+
}
|
|
30
|
+
/** A file-transfer handshake, read, write, or exit failed. */
|
|
31
|
+
export declare class VexTransferError extends VexSerialError {
|
|
32
|
+
constructor(message: string);
|
|
33
|
+
}
|
|
34
|
+
/** A remote resource download (catalog/VEXos) failed. */
|
|
35
|
+
export declare class VexDownloadError extends VexSerialError {
|
|
36
|
+
constructor(message: string);
|
|
37
|
+
}
|
|
38
|
+
/** A firmware archive was malformed, oversized, or incomplete. */
|
|
39
|
+
export declare class VexFirmwareError extends VexSerialError {
|
|
40
|
+
constructor(message: string);
|
|
41
|
+
}
|
|
42
|
+
/** An underlying transport (serial port, stream) error. */
|
|
43
|
+
export declare class VexIoError extends VexSerialError {
|
|
44
|
+
constructor(message: string);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Coerce an arbitrary thrown value into a {@link VexSerialError} so it
|
|
48
|
+
* can be returned through the {@link Result} error channel.
|
|
49
|
+
*/
|
|
50
|
+
export declare function toVexSerialError(error: unknown, fallback?: VexSerialErrorKind): VexSerialError;
|
package/dist/VexEvent.d.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type EventName = string | symbol;
|
|
2
|
+
type EventMapKey<TEvents> = Extract<keyof TEvents, EventName>;
|
|
3
|
+
type EventListener<TValue> = (data: TValue) => void;
|
|
4
|
+
export declare class VexEventEmitter<TEvents extends object = Record<EventName, unknown>> {
|
|
5
|
+
handlerMap: Map<EventName, Array<EventListener<unknown>>>;
|
|
3
6
|
constructor();
|
|
4
|
-
on(eventName:
|
|
5
|
-
remove(eventName:
|
|
6
|
-
emit(eventName:
|
|
7
|
+
on<K extends EventMapKey<TEvents>>(eventName: K, listener: EventListener<TEvents[K]>): void;
|
|
8
|
+
remove<K extends EventMapKey<TEvents>>(eventName: K, listener: EventListener<TEvents[K]>): void;
|
|
9
|
+
emit<K extends EventMapKey<TEvents>>(eventName: K, data: TEvents[K]): void;
|
|
7
10
|
clearListeners(): void;
|
|
8
11
|
}
|
|
9
|
-
export declare class VexEventTarget {
|
|
10
|
-
emitter: VexEventEmitter
|
|
12
|
+
export declare class VexEventTarget<TEvents extends object = Record<EventName, unknown>> {
|
|
13
|
+
emitter: VexEventEmitter<TEvents>;
|
|
11
14
|
constructor();
|
|
12
|
-
emit(eventName:
|
|
13
|
-
on(eventName:
|
|
14
|
-
remove(eventName:
|
|
15
|
+
emit<K extends EventMapKey<TEvents>>(eventName: K, data: TEvents[K]): void;
|
|
16
|
+
on<K extends EventMapKey<TEvents>>(eventName: K, listener: EventListener<TEvents[K]>): void;
|
|
17
|
+
remove<K extends EventMapKey<TEvents>>(eventName: K, listener: EventListener<TEvents[K]>): void;
|
|
15
18
|
clearListeners(): void;
|
|
19
|
+
private normalizeEventName;
|
|
16
20
|
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { V5SerialDeviceState } from "./VexDeviceState.js";
|
|
2
|
+
import { VexSerialError } from "./VexError.js";
|
|
3
|
+
import { ResultAsync } from "neverthrow";
|
|
4
|
+
export interface DownloadFileFromInternetOptions {
|
|
5
|
+
/** Maximum total bytes to read from the response body. */
|
|
6
|
+
maxBytes?: number;
|
|
7
|
+
/** Request timeout in milliseconds. */
|
|
8
|
+
timeout?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Download a remote resource while enforcing a maximum body size. The
|
|
12
|
+
* declared `Content-Length` header is validated up front, and the body
|
|
13
|
+
* is streamed so an oversized payload is rejected before it is fully
|
|
14
|
+
* read into memory. Failures are returned as a {@link VexDownloadError}
|
|
15
|
+
* (or {@link VexInvalidArgumentError} for bad options) instead of
|
|
16
|
+
* thrown.
|
|
17
|
+
*/
|
|
18
|
+
export declare function downloadFileFromInternet(link: string, options?: DownloadFileFromInternetOptions): ResultAsync<ArrayBuffer, VexSerialError>;
|
|
19
|
+
/**
|
|
20
|
+
* Poll an async predicate until it returns true or the timeout elapses.
|
|
21
|
+
* Argument errors are returned as {@link VexInvalidArgumentError}; a
|
|
22
|
+
* throwing predicate surfaces its error through the {@link Result}
|
|
23
|
+
* error channel.
|
|
24
|
+
*/
|
|
25
|
+
export declare function sleepUntilAsync(f: () => Promise<boolean>, timeout: number, interval?: number): ResultAsync<boolean, VexSerialError>;
|
|
26
|
+
/**
|
|
27
|
+
* Poll a synchronous predicate until it returns true or the timeout
|
|
28
|
+
* elapses. The implementation uses a loop with `sleep` rather than
|
|
29
|
+
* `setInterval` so the timer is cleared as soon as the predicate
|
|
30
|
+
* resolves, and so predicate exceptions are surfaced without leaving a
|
|
31
|
+
* pending interval behind.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sleepUntil(f: () => boolean, timeout: number, interval?: number): ResultAsync<boolean, VexSerialError>;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve after `ms` milliseconds. Returns a {@link VexInvalidArgumentError}
|
|
36
|
+
* when `ms` is negative.
|
|
37
|
+
*/
|
|
38
|
+
export declare function sleep(ms: number): ResultAsync<void, VexSerialError>;
|
|
39
|
+
type FirmwareProgressCallback = (state: string, current: number, total: number) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Upload a VEXos firmware archive to a connected brain. Network and
|
|
42
|
+
* archive validation failures are returned as {@link VexSerialError}
|
|
43
|
+
* values rather than thrown; a device that refuses a step or a missing
|
|
44
|
+
* connection surfaces as {@link VexFirmwareError} / {@link VexNotConnectedError}.
|
|
45
|
+
*/
|
|
46
|
+
export declare function uploadFirmware(state: V5SerialDeviceState, publicUrl?: string, usingVersion?: string, progressCallback?: FirmwareProgressCallback): ResultAsync<boolean, VexSerialError>;
|
|
47
|
+
export {};
|
|
@@ -1,55 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a class to make it easier to handle passing the VEXos version
|
|
3
|
-
* information around in the application. This provides ways to get any
|
|
4
|
-
* form of the string representation and quickly compare versions.
|
|
5
|
-
*/
|
|
6
1
|
export declare class VexFirmwareVersion {
|
|
7
|
-
major: number;
|
|
8
|
-
minor: number;
|
|
9
|
-
build: number;
|
|
10
|
-
beta: number;
|
|
2
|
+
readonly major: number;
|
|
3
|
+
readonly minor: number;
|
|
4
|
+
readonly build: number;
|
|
5
|
+
readonly beta: number;
|
|
11
6
|
constructor(major: number, minor: number, build: number, beta: number);
|
|
12
|
-
/**
|
|
13
|
-
* Take a a string of MAJOR.MINOR.BUILD.bBETA and converts it to a
|
|
14
|
-
* VexFirmwareVersion instance
|
|
15
|
-
* @param version the string to process
|
|
16
|
-
* @returns a VexFirmwareVersion representing the provided string
|
|
17
|
-
*/
|
|
18
7
|
static fromString(version: string): VexFirmwareVersion;
|
|
19
|
-
/**
|
|
20
|
-
* Take a a Uint8Array and converts it to a VexFirmwareVersion instance
|
|
21
|
-
* @param data the array to process
|
|
22
|
-
* @param offset the offset to start at
|
|
23
|
-
* @returns a VexFirmwareVersion representing the provided string
|
|
24
|
-
*/
|
|
25
8
|
static fromUint8Array(data: Uint8Array, offset?: number, reverse?: boolean): VexFirmwareVersion;
|
|
26
9
|
static allZero(): VexFirmwareVersion;
|
|
27
|
-
/**
|
|
28
|
-
* Take a a string of MAJOR_MINOR_BUILD_BETA and converts it to a
|
|
29
|
-
* VexFirmwareVersion instance
|
|
30
|
-
* @param version the string to process
|
|
31
|
-
* @returns a VexFirmwareVersion representing the provided string
|
|
32
|
-
*/
|
|
33
10
|
static fromCatalogString(version: string): VexFirmwareVersion;
|
|
34
11
|
isBeta(): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* returns version as Uint Array
|
|
37
|
-
*/
|
|
38
12
|
toUint8Array(reverse?: boolean): Uint8Array;
|
|
39
|
-
/**
|
|
40
|
-
* returns version as major.minor.build
|
|
41
|
-
*/
|
|
42
13
|
toUserString(): string;
|
|
43
|
-
/**
|
|
44
|
-
* returns version as ${major}.${minor}.{build}.b${beta}
|
|
45
|
-
*/
|
|
46
14
|
toInternalString(): string;
|
|
47
|
-
/**
|
|
48
|
-
* compares this version to the provided version.
|
|
49
|
-
* * if this < b: negative
|
|
50
|
-
* * if this = b: 0
|
|
51
|
-
* * if this > b: positive
|
|
52
|
-
* @param that the version to compare again
|
|
53
|
-
*/
|
|
54
15
|
compare(that: VexFirmwareVersion): number;
|
|
55
16
|
}
|
package/dist/VexIniConfig.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ZerobaseSlotNumber } from "./Vex";
|
|
1
|
+
import { type ZerobaseSlotNumber } from "./Vex.js";
|
|
2
2
|
export declare class ProgramIniConfig {
|
|
3
3
|
baseName: string;
|
|
4
4
|
autorun: boolean;
|
|
@@ -20,7 +20,6 @@ export declare class ProgramIniConfig {
|
|
|
20
20
|
config: Record<number, string>;
|
|
21
21
|
controller1: Record<string, string>;
|
|
22
22
|
controller2: Record<string, string>;
|
|
23
|
-
constructor();
|
|
24
23
|
setProgramDate(date: Date): void;
|
|
25
24
|
createIni(): string;
|
|
26
25
|
dec2(value: number): string;
|