-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.d.ts
84 lines (71 loc) · 1.74 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
export enum ESPSecurityType {
Sec0 = "sec0",
Sec1 = "sec1"
}
export enum ESPTransportType {
Wifi = "wifi",
Bluetooth = "bluetooh"
}
export enum ESPDeviceState {
Configured = "CONFIGURED",
NotConfigured = "NOT_CONFIGURED",
SessionEstablished = "SESSION_ESTABLISHED",
Disconnected = "DISCONNECTED"
}
export enum ESPNetworkStatus {
NotStarted = "NOT_STARTED",
InProgress = "IN_PROGRESS",
Ok = "OK",
Nok = "NOK"
}
export enum ESPBluetoothState {
Unknown = 'UNKNOWN',
Resetting = 'RESETTING',
Unsupported = 'UNSUPPORTED',
Unauthorized = 'UNAUTHORIZED',
PoweredOff = 'POWERED_OFF',
PoweredOn = 'POWERED_ON'
};
interface NetworkComponentStatus {
ip: boolean;
internet: boolean;
cloud: boolean;
}
interface Config {
transportType: ESPTransportType;
securityType: ESPSecurityType;
bleDeviceNamePrefix: string;
wifiBaseUrl: string;
wifiNetworkNamePrefix: string;
}
interface Device {
name: string;
uuid: string;
state: ESPEventState;
onNetworkStatusChanged: (status: ESPNetworkStatus, components: NetworkComponentStatus) => void;
onStatusChanged: (device: Device) => void;
startSession();
connect();
disconnect();
setCredentials(ssid: string, passphrase: string);
networkTest();
scanWifi();
}
export enum ESPEventState {
DeviceNotFound = "DEVICES_NOT_FOUND",
Unknown = "UNKNOWN",
DevicesFounds = "DEVICES_FOUND",
DeviceUpdated = "DEVICE_UPDATED"
}
export interface Event {
state: ESPEventState;
}
export interface Espressif {
setConfig(config: Config): Promise<Void>;
onStateChanged: (state: State, devices: [Device], error: Error?) => void;
}
export interface EspressifWrapper extends Espressif {
(): Espressif;
}
declare const Espressif: EspressifWrapper;
export default Espressif;