-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.d.ts
110 lines (97 loc) · 2.5 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Type definitions for fsuipc
export const enum Type {
Byte = 0,
SByte = 1,
Int16 = 2,
Int32 = 3,
Int64 = 4,
UInt16 = 5,
UInt32 = 6,
UInt64 = 7,
Double = 8,
Single = 9,
ByteArray = 10,
String = 11,
BitArray = 12,
}
interface Offset {
name: string;
offset: number;
type: Type;
length: number;
test: Type.Byte;
}
export enum Simulator {
ANY,
FS98,
FS2K,
CFS2,
CFS1,
FLY,
FS2K2,
FS2K4,
FSX,
ESP,
P3D,
FSX64,
P3D64,
MSFS,
}
type FixedSizedNumberType = Type.Byte|Type.SByte|Type.Int16|Type.Int32|Type.UInt16|Type.UInt32|Type.Double|Type.Single;
type Int64Type = Type.Int64|Type.UInt64;
type VariableSizedType = Type.ByteArray|Type.String|Type.BitArray;
export class FSUIPC {
constructor();
open(requestedSimulator?: Simulator): Promise<FSUIPC>;
close(): Promise<FSUIPC>;
process(): Promise<object>;
add(name: string, offset: number, type: FixedSizedNumberType | Int64Type): Offset;
add(name: string, offset: number, type: VariableSizedType, length: number): Offset;
remove(name: string): Offset;
write(offset: number, type: FixedSizedNumberType | Int64Type, value: number): void;
write(offset: number, type: Int64Type, value: string): void;
write(offset: number, type: Int64Type, value: bigint): void;
// Experimental
write(offset: number, type: Type.String, length: number, value: string): void;
// Experimental
write(offset: number, type: Type.ByteArray, length: number, value: ArrayBufferView): void;
}
export enum ErrorCode {
OK,
// Attempt to Open when already Open
OPEN,
// Cannot link to FSUIPC or WideClient
NOFS,
// Failed to Register common message with Windows
REGMSG,
// Failed to create Atom for mapping filename
ATOM,
// Failed to create a file mapping object
MAP,
// Failed to open a view to the file map
VIEW,
// Incorrect version of FSUIPC, or not FSUIPC
VERSION,
// Sim is not version requested
WRONGFS,
// Call cannot execute, link not Open
NOTOPEN,
// Call cannot execute: no requests accumulated
NODATA,
// IPC timed out all retries
TIMEOUT,
// IPC sendmessage failed all retries
SENDMSG,
// IPC request contains bad data
DATA,
// Maybe running on WideClient, but FS not running on Server, or wrong FSUIPC
RUNNING,
// Read or Write request cannot be added, memory for Process is full
SIZE,
// User does not have permission to connect to FSUIPC
NOPERMISSION
}
export class FSUIPCError extends Error {
constructor(message: string, code: ErrorCode);
code: ErrorCode;
}