-
Notifications
You must be signed in to change notification settings - Fork 1
/
ifc2.d.ts
81 lines (71 loc) · 2.1 KB
/
ifc2.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
/// <reference types="typescript" />
export type IFData = string | number | boolean;
export const name: 'IFC2';
export const LE: true;
export const enableLog: boolean;
export const logLevel: number;
export const keepAlive: boolean;
export const doReconnect: boolean;
export const timeout: number;
export const isConnected: boolean;
export const isWaiting: boolean;
export const isPollWaiting: boolean;
export const isCallback: boolean;
export const INFO = 3;
export const WARN = 2;
export const ERROR = 1;
export const MANDATORY = 0;
export type IFC2Event = 'IFC2manifest' | 'IFC2msg' | 'IFC2data';
export interface IFC2CommandArgument {
name: string;
value: string;
}
export function on(
event: IFC2Event,
listener: (...args: unknown[]) => void
): void;
export function getCommand(cmd: string): Uint8Array;
export function setCommand<T extends IFData>(cmd: string, value: T): Uint8Array;
export function get<T extends IFData>(
cmd: string,
callback?: (data: T) => void
): void;
export function set<T extends IFData>(cmd: string, value: T): void;
export function run(cmd: string, args?: IFC2CommandArgument[]): void;
export function manifestByName(): { [key: string]: ManifestNameItem };
export function manifestByCommand(): { [key: string]: ManifestCommandItem };
export function pollRegister<T extends IFData>(
cmd: string,
callback: (data: T) => void
): void;
export function pollDeregister(cmd: string): void;
export function init(successCallback?: () => void, params?: InitInfo): void;
export function close(callback: () => void): void;
export enum DataType {
BOOLEAN = 0,
INTEGER = 1,
FLOAT = 2,
DOUBLE = 3,
STRING = 4,
LONG = 5,
}
export interface ManifestCommandItem {
name: string;
type: DataType;
}
export interface ManifestNameItem {
command: number;
type: DataType;
}
export interface InitInfo {
enableLog?: boolean;
logLevel?: number;
keepAlive?: boolean;
doReconnect?: boolean;
timeout?: number;
callback?: boolean;
infoCallback?: (info: unknown) => void;
pollThrottle?: number;
host?: string;
port?: number;
}