This repository was archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 236
/
Copy pathpackage.ts
300 lines (256 loc) · 6.89 KB
/
package.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
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
/**
* Interface that represents an individual package contributor from Arduino package index.
* @interface
*/
export interface IPackage {
/**
* Package name
* @property {string}
*/
name: string;
/**
* Package author email
* @property {string}
*/
email: string;
/**
* Package maintainer
* @property {string}
*/
maintainer: string;
/**
* Package support website URL
* @property {string}
*/
websiteURL: string;
/**
* Help information include online link(s)
* @property: {any}
*/
help: any;
/**
* Supported platforms that contain in this package.
* @property {IPlatform[]}
*/
platforms: IPlatform[];
/**
* Provided tools that contain in this package.
*/
tools: Array<object>;
}
/**
* Interface that represents the supported platforms from the contribution packages.
*
* The interface has merged all the supported versions.
*
* @interface
*/
export interface IPlatform {
/**
* Platform name
* @property {string}
*/
name: string;
/**
* Targeting architecture of the platform.
* @property {string}
*/
architecture: string;
/**
* Category, can be these values: "Arduino", "Arduino Certified", "Partner", "ESP8266", ...
* @property {string}
*/
category: string;
/**
* Provide URL of the platform
* @property {string}
*/
url: string;
/**
* Whether is the default platform come with the installation.
* @property {boolean}
*/
defaultPlatform?: boolean;
/**
* The raw version when load the object from json object. This value should not be used after the
* platforms information has been parsed.
* @property {string}
*/
version: string;
/**
* All supported version fro this platform.
* @property {string[]}
*/
versions: string[];
/**
* Installed platform on the local Arduino IDE
* @property {string}
*/
installedVersion: string;
/**
* Root path that contains all the files, board description under the specified version.
* @property {string}
*/
rootBoardPath: string;
/**
* The board descriptor information supported by this platform.
* @property {IBoard[]}
*/
boards: any[];
/**
* Help information object include online link(s).
* @property {any}
*/
help: any;
/**
* Parent package information
* @property {IPackage}
*/
package?: IPackage;
/**
* For custom package, only package name available.
* @property {packageName}
*/
packageName?: string;
}
export interface IBoardConfigOption {
id: string;
displayName: string;
}
export interface IBoardConfigItem {
displayName: string;
id: string;
selectedOption: string;
options: IBoardConfigOption[];
}
/**
* Return values of calls to IBoard.loadConfig() and IBoard.updateConfig().
*/
export enum BoardConfigResult {
/**
* Setting configuration value(s) was successful
*/
Success,
/**
* Setting configuration value(s) was successful. All or some items
* were already set to the requested values.
*/
SuccessNoChange,
/**
* One or more configuration keys were invalid.
*/
InvalidConfigID,
/**
* One or more options were invalid.
*/
InvalidOptionID,
/**
* Can only happen when calling IBoard.loadConfig() and when
* the raw configuration string did contain invalid/unparsable
* elements.
*/
InvalidFormat,
}
/**
* Interface for classes that represent an Arduino supported board.
*
* @interface
*/
export interface IBoard {
/**
* Unique key that represent the board in the package:arch:alias.
* @property {string}
*/
key: string;
/**
* Board aliasname for Arduino compilation such as `huzzah`, `yun`
* @property {string}
*/
board: string;
/**
* The human readable name displayed on the Arduino IDE Boards Manager
* @property {string}
*/
name?: string;
/**
* Reference to the platform that contains this board.
* @property {IPlatform}
*/
platform: IPlatform;
/**
* Custom configuration for the Arduino board
* @property {string}
*/
customConfig: string;
/**
* Custom board's configuration items.
* @property {IBoardConfigItem[]}
*/
configItems: IBoardConfigItem[];
/**
* Board's parameter values.
*/
addParameter(key: string, value: string): void;
/**
* Get board specified build configuration.
*/
getBuildConfig(): string;
/**
* Load configuration from saved context.
* Parses the configuration string and tries to set the individual
* configuration values. It will bail out on any error.
* @param {string} configString The configuration string from the
* configuration file.
* @returns {BoardConfigResult} Result of the operation - for more
* information see documentation of BoardConfigResult.
*/
loadConfig(configString: string): BoardConfigResult;
/**
* Set configuration value.
* This function makes sure, that the configuration ID and the option ID
* are actually valid. It will bail out on any error
* @param {string} configId The ID of the configuration value
* @param {string} optionId The ID to which the option of the configuration
* value should be set to.
* @returns {BoardConfigResult} Result of the operation - for more
* information see documentation of BoardConfigResult.
*/
updateConfig(configId: string, optionId: string): BoardConfigResult;
/**
* Reset configuration to defaults and update configuration file.
*/
resetConfig();
/**
* Get the board package name
*/
getPackageName();
}
/**
* Interface for classes that represent an Arduino supported programmer.
*
* @interface
*/
export interface IProgrammer {
/**
* Unique key that represent the programmer in the package:name.
* @property {string}
*/
key: string;
/**
* Programmer name for Arduino compilation such as `avrisp`, `atmel_ice`
* @property {string}
*/
name: string;
/**
* The human readable name displayed in the Arduino programmer selection menu
* @property {string}
*/
displayName: string;
/**
* Reference to the platform that contains this board.
* @prop {IPlatform}
*/
platform: IPlatform;
}