Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 5fd7ef8

Browse files
elektronikworkshophlovdal
authored andcommitted
Forgot to stage this with 47a29dedf77c41fb4b94a24aa76176b9a9ae0a2b
1 parent 722956b commit 5fd7ef8

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

src/arduino/package.ts

+52-5
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,35 @@ export interface IBoardConfigItem {
152152
options: IBoardConfigOption[];
153153
}
154154

155+
/**
156+
* Return values of calls to IBoard.loadConfig() and IBoard.updateConfig().
157+
*/
158+
export enum BoardConfigResult {
159+
/**
160+
* Setting configuration value(s) was successful
161+
*/
162+
Success,
163+
/**
164+
* Setting configuration value(s) was successful. All or some items
165+
* were already set to the requested values.
166+
*/
167+
SuccessNoChange,
168+
/**
169+
* One or more configuration keys were invalid.
170+
*/
171+
InvalidConfigID,
172+
/**
173+
* One or more options were invalid.
174+
*/
175+
InvalidOptionID,
176+
/**
177+
* Can only happen when calling IBoard.loadConfig() and when
178+
* the raw configuration string did contain invalid/unparsable
179+
* elements.
180+
*/
181+
InvalidFormat,
182+
}
183+
155184
/**
156185
* Interface for classes that represent an Arduino supported board.
157186
*
@@ -179,7 +208,7 @@ export interface IBoard {
179208

180209
/**
181210
* Reference to the platform that contains this board.
182-
* @prop {IPlatform}
211+
* @property {IPlatform}
183212
*/
184213
platform: IPlatform;
185214

@@ -206,14 +235,32 @@ export interface IBoard {
206235
getBuildConfig(): string;
207236

208237
/**
209-
* Load default configuration from saved context.
238+
* Load configuration from saved context.
239+
* Parses the configuration string and tries to set the individual
240+
* configuration values. It will bail out on any error.
241+
* @param {string} configString The configuration string from the
242+
* configuration file.
243+
* @returns {BoardConfigResult} Result of the operation - for more
244+
* information see documentation of BoardConfigResult.
245+
*/
246+
loadConfig(configString: string): BoardConfigResult;
247+
248+
/**
249+
* Set configuration value.
250+
* This function makes sure, that the configuration ID and the option ID
251+
* are actually valid. It will bail out on any error
252+
* @param {string} configId The ID of the configuration value
253+
* @param {string} optionId The ID to which the option of the configuration
254+
* value should be set to.
255+
* @returns {BoardConfigResult} Result of the operation - for more
256+
* information see documentation of BoardConfigResult.
210257
*/
211-
loadConfig(configString: string): void;
258+
updateConfig(configId: string, optionId: string): BoardConfigResult;
212259

213260
/**
214-
* Update the configuration
261+
* Reset configuration to defaults and update configuration file.
215262
*/
216-
updateConfig(configId: string, optionId: string): boolean;
263+
resetConfig();
217264

218265
/**
219266
* Get the board package name

0 commit comments

Comments
 (0)