-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathACSFormats.ts
More file actions
171 lines (153 loc) · 3.3 KB
/
Copy pathACSFormats.ts
File metadata and controls
171 lines (153 loc) · 3.3 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import { AccessControllerState, CoreInputMode } from "../../knex/tables.js"
import { ACSDeployment } from "../ACS/deployment.js";
export interface CoreStatusReport {
channels: {
channelID: number,
state: AccessControllerState,
hobbsTime: number,
}[];
currentCardTag: string;
}
enum CoreStateChangeReason {
AUTHED = "AUTHED",
OVER_TEMP = "OVER_TEMP",
CARD_REMOVED = "CARD_REMOVED",
COMMANDED = "COMMANDED",
LOCAL = "LOCAL",
INTEGRITY_FAIL = "INTEGRITY_FAIL",
FAULT = "FAULT"
}
export interface CoreStateChangeReport {
channels: {
channelID: number,
fromState: AccessControllerState,
toState: AccessControllerState,
reason: CoreStateChangeReason
}[];
currentCardTag: string;
}
export interface CoreLogRequest {
auditLog: boolean;
message: string;
category?: string;
}
export interface CoreAuthToRequest {
state: AccessControllerState,
cardTagID: string;
}
export interface CoreFlags {
lockWhenIdle: boolean;
restartWhenUnused: boolean;
welcoming: boolean;
}
export interface CoreConfigReport {
channels?: {
channelID: number;
tempDuration: number;
}[];
inputMode?: CoreInputMode;
deployment?: ACSDeployment;
flags?: CoreFlags;
firmware?: string;
}
/**
* TIME: Current time
* STATE: State the channels should be in
* HMI: Information intended for human consumption
*/
export enum CoreInfoOptions {
TIME = "TIME",
STATE = "STATE",
HMI = "HMI",
FLAGS = "FLAGS",
HOBBS_TIME = "HOBBS_TIME"
}
export interface CoreInfoRequest {
fields: CoreInfoOptions[];
}
/**
* Shape of what the server will send to the core in response to
* an authTo request
*/
export interface ServerAuthToResponse {
channels: {
channelID: number;
state: AccessControllerState;
approved: boolean;
reason: string;
}[];
cardTagID: string;
}
export enum CoreFiles {
CERT = "CERT",
OFFLINE_LIST = "OFFLINE_LIST",
OTA = "OTA"
}
/**
* Shape of what the server sends to the core when the server
* wants the core to update its configuration
*/
export interface ServerConfigUpdateRequest {
inputMode?: CoreInputMode;
channels?: {
id: number;
tempDuration?: number;
getFiles?: CoreFiles[];
}[];
}
export enum CoreActions {
RESTART = "RESTART",
SEAL = "SEAL",
IDENTIFY = "IDENTIFY",
SCHEDULED_RESTART = "SCHEDULED_RESTART"
}
/**
* Shape of what the server sends to the core when the server
* wants to command the core to take some action
*/
export interface ServerCommand {
toState?: {
id: number,
state: AccessControllerState
}[];
action?: CoreActions;
identifyChannel?: number;
flags?: CoreFlags;
hobbsTime?: {channelID: number, hobbsTime: number}[]
}
export enum CoreRole {
WELCOME = "WELCOME",
EQUIPMENT = "EQUIPMENT"
}
/**
* Shape of what the server sends the core in response to
* an info request
*/
export interface ServerInfoResponse {
time?: number;
state?: {
id: number;
state: AccessControllerState
}[];
hmi?: {
role: CoreRole;
deviceName: string,
makerspace: string;
channels: {
channelID: number;
pairedEntity: string;
}[];
};
flags?: CoreFlags;
hobbsTime?: {
channelID: number;
hobbsTime: number;
}[]
}
export interface WelcomeRequest {
cardTagID: string;
}
export interface WelcomeResponse {
welcomed: boolean;
cardTagID: string;
}