openc3 5.9.0 → 5.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of openc3 might be problematic. Click here for more details.

@@ -20,10 +20,10 @@
20
20
  # if purchased from OpenC3, Inc.
21
21
  */
22
22
 
23
- import axios from './axios.js'
23
+ import axios from "./axios.js";
24
24
 
25
25
  export class OpenC3Api {
26
- id = 1
26
+ id = 1;
27
27
 
28
28
  constructor() {}
29
29
 
@@ -31,20 +31,20 @@ export class OpenC3Api {
31
31
  try {
32
32
  let refreshed = await OpenC3Auth.updateToken(
33
33
  OpenC3Auth.defaultMinValidity
34
- )
34
+ );
35
35
  if (refreshed) {
36
- OpenC3Auth.setTokens()
36
+ OpenC3Auth.setTokens();
37
37
  }
38
38
  } catch (error) {
39
- OpenC3Auth.login()
39
+ OpenC3Auth.login();
40
40
  }
41
- this.id = this.id + 1
41
+ this.id = this.id + 1;
42
42
  try {
43
- kwparams['scope'] = window.openc3Scope
43
+ kwparams["scope"] = window.openc3Scope;
44
44
  const response = await axios.post(
45
- '/openc3-api/api',
45
+ "/openc3-api/api",
46
46
  {
47
- jsonrpc: '2.0',
47
+ jsonrpc: "2.0",
48
48
  method: method,
49
49
  params: params,
50
50
  id: this.id,
@@ -53,11 +53,11 @@ export class OpenC3Api {
53
53
  {
54
54
  headers: {
55
55
  Authorization: localStorage.openc3Token,
56
- 'Content-Type': 'application/json-rpc',
56
+ "Content-Type": "application/json-rpc",
57
57
  ...headerOptions,
58
58
  },
59
59
  }
60
- )
60
+ );
61
61
  // var data = response.data
62
62
  // if (data.error) {
63
63
  // var err = new Error()
@@ -66,53 +66,53 @@ export class OpenC3Api {
66
66
  // console.log(data.error.data.backtrace.join('\n'))
67
67
  // throw err
68
68
  // }
69
- return response.data.result
69
+ return response.data.result;
70
70
  } catch (error) {
71
- var err = new Error()
71
+ var err = new Error();
72
72
  if (error.response) {
73
73
  // The request was made and the server responded with a
74
74
  // status code that falls out of the range of 2xx
75
- err.name = error.response.data.error.data.class
76
- err.message = error.response.data.error.data.message
75
+ err.name = error.response.data.error.data.class;
76
+ err.message = error.response.data.error.data.message;
77
77
  } else if (error.request) {
78
78
  // The request was made but no response was received, `error.request`
79
79
  // is an instance of XMLHttpRequest in the browser and an instance
80
80
  // of http.ClientRequest in Node.js
81
- err.name = 'Request error'
82
- err.message = 'Request error, no response received'
81
+ err.name = "Request error";
82
+ err.message = "Request error, no response received";
83
83
  } else {
84
84
  // Something happened in setting up the request and triggered an Error
85
- err.name = 'Unknown error'
85
+ err.name = "Unknown error";
86
86
  }
87
87
  // console.log(error)
88
- throw err
88
+ throw err;
89
89
  }
90
90
  }
91
91
 
92
92
  decode_openc3_type(val) {
93
- if (val !== null && typeof val === 'object') {
94
- if (val.json_class == 'Float' && val.raw) {
95
- if (val.raw == 'NaN') {
96
- return NaN
97
- } else if (val.raw == 'Infinity') {
98
- return Infinity
99
- } else if (val.raw == '-Infinity') {
100
- return -Infinity
93
+ if (val !== null && typeof val === "object") {
94
+ if (val.json_class == "Float" && val.raw) {
95
+ if (val.raw == "NaN") {
96
+ return NaN;
97
+ } else if (val.raw == "Infinity") {
98
+ return Infinity;
99
+ } else if (val.raw == "-Infinity") {
100
+ return -Infinity;
101
101
  }
102
102
  }
103
103
  }
104
- return null
104
+ return null;
105
105
  }
106
106
 
107
107
  encode_openc3_type(val) {
108
108
  if (Number.isNaN(val)) {
109
- return { json_class: 'Float', raw: 'NaN' }
109
+ return { json_class: "Float", raw: "NaN" };
110
110
  } else if (val == Number.POSITIVE_INFINITY) {
111
- return { json_class: 'Float', raw: 'Infinity' }
111
+ return { json_class: "Float", raw: "Infinity" };
112
112
  } else if (val == Number.NEGATIVE_INFINITY) {
113
- return { json_class: 'Float', raw: '-Infinity' }
113
+ return { json_class: "Float", raw: "-Infinity" };
114
114
  }
115
- return null
115
+ return null;
116
116
  }
117
117
 
118
118
  ensure_offline_access() {
@@ -120,13 +120,13 @@ export class OpenC3Api {
120
120
  if (needed) {
121
121
  if (localStorage.openc3OfflineToken) {
122
122
  this.set_offline_access(localStorage.openc3OfflineToken).then(() => {
123
- delete localStorage.openc3OfflineToken
124
- })
123
+ delete localStorage.openc3OfflineToken;
124
+ });
125
125
  } else {
126
- OpenC3Auth.getOfflineAccess()
126
+ OpenC3Auth.getOfflineAccess();
127
127
  }
128
128
  }
129
- })
129
+ });
130
130
  }
131
131
 
132
132
  // ***********************************************
@@ -134,123 +134,123 @@ export class OpenC3Api {
134
134
  // ***********************************************
135
135
 
136
136
  offline_access_needed() {
137
- return this.exec('offline_access_needed', [])
137
+ return this.exec("offline_access_needed", []);
138
138
  }
139
139
 
140
140
  set_offline_access(offline_access_token) {
141
- return this.exec('set_offline_access', [offline_access_token])
141
+ return this.exec("set_offline_access", [offline_access_token]);
142
142
  }
143
143
 
144
144
  get_all_interface_info() {
145
- return this.exec('get_all_interface_info', [])
145
+ return this.exec("get_all_interface_info", []);
146
146
  }
147
147
 
148
148
  map_target_to_interface(target_name, interface_name) {
149
- return this.exec('map_target_to_interface', [target_name, interface_name])
149
+ return this.exec("map_target_to_interface", [target_name, interface_name]);
150
150
  }
151
151
 
152
152
  connect_interface(interface_name, ...interface_params) {
153
153
  if (interface_params.length > 0) {
154
- return this.exec('connect_interface', [
154
+ return this.exec("connect_interface", [
155
155
  interface_name,
156
156
  ...interface_params,
157
- ])
157
+ ]);
158
158
  } else {
159
- return this.exec('connect_interface', [interface_name])
159
+ return this.exec("connect_interface", [interface_name]);
160
160
  }
161
161
  }
162
162
 
163
163
  disconnect_interface(interface_name) {
164
- return this.exec('disconnect_interface', [interface_name])
164
+ return this.exec("disconnect_interface", [interface_name]);
165
165
  }
166
166
 
167
167
  get_all_router_info() {
168
- return this.exec('get_all_router_info', [])
168
+ return this.exec("get_all_router_info", []);
169
169
  }
170
170
 
171
171
  connect_router(router_name) {
172
- return this.exec('connect_router', [router_name])
172
+ return this.exec("connect_router", [router_name]);
173
173
  }
174
174
 
175
175
  disconnect_router(router_name) {
176
- return this.exec('disconnect_router', [router_name])
176
+ return this.exec("disconnect_router", [router_name]);
177
177
  }
178
178
 
179
179
  get_target_interfaces() {
180
- return this.exec('get_target_interfaces', [])
180
+ return this.exec("get_target_interfaces", []);
181
181
  }
182
182
 
183
183
  // DEPRECATED
184
184
  get_all_target_info() {
185
- return this.exec('get_all_target_info', [])
185
+ return this.exec("get_all_target_info", []);
186
186
  }
187
187
 
188
188
  get_tlm_cnts(target_commands) {
189
- return this.exec('get_tlm_cnts', [target_commands])
189
+ return this.exec("get_tlm_cnts", [target_commands]);
190
190
  }
191
191
 
192
192
  get_item(target, packet, item) {
193
- return this.exec('get_item', [target, packet, item])
193
+ return this.exec("get_item", [target, packet, item]);
194
194
  }
195
195
 
196
196
  get_parameter(target, packet, item) {
197
- return this.exec('get_parameter', [target, packet, item])
197
+ return this.exec("get_parameter", [target, packet, item]);
198
198
  }
199
199
 
200
200
  get_all_packet_logger_info() {
201
- return this.exec('get_all_packet_logger_info', [])
201
+ return this.exec("get_all_packet_logger_info", []);
202
202
  }
203
203
 
204
204
  start_logging() {
205
- return this.exec('start_logging', [])
205
+ return this.exec("start_logging", []);
206
206
  }
207
207
 
208
208
  stop_logging() {
209
- return this.exec('stop_logging', [])
209
+ return this.exec("stop_logging", []);
210
210
  }
211
211
 
212
212
  start_cmd_log(log_writer_name) {
213
- return this.exec('start_cmd_log', [log_writer_name])
213
+ return this.exec("start_cmd_log", [log_writer_name]);
214
214
  }
215
215
 
216
216
  start_tlm_log(log_writer_name) {
217
- return this.exec('start_tlm_log', [log_writer_name])
217
+ return this.exec("start_tlm_log", [log_writer_name]);
218
218
  }
219
219
 
220
220
  stop_cmd_log(log_writer_name) {
221
- return this.exec('stop_cmd_log', [log_writer_name])
221
+ return this.exec("stop_cmd_log", [log_writer_name]);
222
222
  }
223
223
 
224
224
  stop_tlm_log(log_writer_name) {
225
- return this.exec('stop_tlm_log', [log_writer_name])
225
+ return this.exec("stop_tlm_log", [log_writer_name]);
226
226
  }
227
227
 
228
228
  get_server_status() {
229
- return this.exec('get_server_status', [])
229
+ return this.exec("get_server_status", []);
230
230
  }
231
231
 
232
232
  get_limits_sets() {
233
- return this.exec('get_limits_sets', [])
233
+ return this.exec("get_limits_sets", []);
234
234
  }
235
235
 
236
236
  get_limits_set() {
237
- return this.exec('get_limits_set', [])
237
+ return this.exec("get_limits_set", []);
238
238
  }
239
239
 
240
240
  set_limits_set(limits_set) {
241
- return this.exec('set_limits_set', [limits_set])
241
+ return this.exec("set_limits_set", [limits_set]);
242
242
  }
243
243
 
244
244
  get_background_tasks() {
245
- return this.exec('get_background_tasks', [])
245
+ return this.exec("get_background_tasks", []);
246
246
  }
247
247
 
248
248
  start_background_task(name) {
249
- return this.exec('start_background_task', [name])
249
+ return this.exec("start_background_task", [name]);
250
250
  }
251
251
 
252
252
  stop_background_task(name) {
253
- return this.exec('stop_background_task', [name])
253
+ return this.exec("stop_background_task", [name]);
254
254
  }
255
255
 
256
256
  // ***********************************************
@@ -258,179 +258,179 @@ export class OpenC3Api {
258
258
  // ***********************************************
259
259
 
260
260
  get_target(target_name) {
261
- return this.exec('get_target', [target_name])
261
+ return this.exec("get_target", [target_name]);
262
262
  }
263
263
 
264
- get_target_list() {
265
- return this.exec('get_target_list', [])
264
+ get_target_names() {
265
+ return this.exec("get_target_names", []);
266
266
  }
267
267
 
268
268
  get_telemetry(target_name, packet_name) {
269
- return this.exec('get_telemetry', [target_name, packet_name])
269
+ return this.exec("get_telemetry", [target_name, packet_name]);
270
270
  }
271
271
 
272
272
  get_all_telemetry(target_name) {
273
- return this.exec('get_all_telemetry', [target_name])
273
+ return this.exec("get_all_telemetry", [target_name]);
274
274
  }
275
275
 
276
276
  get_all_telemetry_names(target_name) {
277
- return this.exec('get_all_telemetry_names', [target_name])
277
+ return this.exec("get_all_telemetry_names", [target_name]);
278
278
  }
279
279
 
280
280
  async get_tlm_packet(target_name, packet_name, value_type, stale_time = 30) {
281
- const data = await this.exec('get_tlm_packet', [target_name, packet_name], {
281
+ const data = await this.exec("get_tlm_packet", [target_name, packet_name], {
282
282
  type: value_type,
283
283
  stale_time: stale_time,
284
- })
284
+ });
285
285
  // Make sure data isn't null or undefined. Note this is the only valid use of == or !=
286
286
  if (data != null) {
287
- var len = data.length
288
- var converted = null
287
+ var len = data.length;
288
+ var converted = null;
289
289
  for (var i = 0; i < len; i++) {
290
- converted = this.decode_openc3_type(data[i][1])
290
+ converted = this.decode_openc3_type(data[i][1]);
291
291
  if (converted !== null) {
292
- data[i][1] = converted
292
+ data[i][1] = converted;
293
293
  }
294
294
  }
295
295
  }
296
- return data
296
+ return data;
297
297
  }
298
298
 
299
299
  get_packet_derived_items(target_name, packet_name) {
300
- return this.exec('get_packet_derived_items', [target_name, packet_name])
300
+ return this.exec("get_packet_derived_items", [target_name, packet_name]);
301
301
  }
302
302
 
303
303
  get_tlm_buffer(target_name, packet_name) {
304
- return this.exec('get_tlm_buffer', [target_name, packet_name])
304
+ return this.exec("get_tlm_buffer", [target_name, packet_name]);
305
305
  }
306
306
 
307
307
  async get_tlm_values(items, stale_time = 30) {
308
- const data = await this.exec('get_tlm_values', [items], {
308
+ const data = await this.exec("get_tlm_values", [items], {
309
309
  stale_time: stale_time,
310
- })
311
- var len = data[0].length
312
- var converted = null
310
+ });
311
+ var len = data[0].length;
312
+ var converted = null;
313
313
  for (var i = 0; i < len; i++) {
314
- converted = this.decode_openc3_type(data[0][i])
314
+ converted = this.decode_openc3_type(data[0][i]);
315
315
  if (converted !== null) {
316
- data[0][i] = converted
316
+ data[0][i] = converted;
317
317
  }
318
318
  }
319
- return data
319
+ return data;
320
320
  }
321
321
 
322
322
  get_limits(target_name, packet_name, item_name) {
323
- return this.exec('get_limits', [target_name, packet_name, item_name])
323
+ return this.exec("get_limits", [target_name, packet_name, item_name]);
324
324
  }
325
325
 
326
- async tlm(target_name, packet_name, item_name, value_type = 'CONVERTED') {
327
- let data = null
326
+ async tlm(target_name, packet_name, item_name, value_type = "CONVERTED") {
327
+ let data = null;
328
328
  // Check for the single string syntax: tlm("TGT PKT ITEM")
329
329
  if (packet_name === undefined) {
330
- data = await this.exec('tlm', [target_name])
330
+ data = await this.exec("tlm", [target_name]);
331
331
  // Check for the single string syntax with type: tlm("TGT PKT ITEM", "RAW")
332
332
  } else if (item_name === undefined) {
333
333
  if (
334
- ['RAW', 'CONVERTED', 'FORMATTED', 'WITH_UNITS'].includes(packet_name)
334
+ ["RAW", "CONVERTED", "FORMATTED", "WITH_UNITS"].includes(packet_name)
335
335
  ) {
336
- data = await this.exec('tlm', [target_name], { type: packet_name })
336
+ data = await this.exec("tlm", [target_name], { type: packet_name });
337
337
  } else {
338
- var err = new Error()
339
- err.name = 'TypeError'
340
- err.message = `Invalid data type ${packet_name}. Valid options are RAW, CONVERTED, FORMATTED, and WITH_UNITS.`
341
- throw err
338
+ var err = new Error();
339
+ err.name = "TypeError";
340
+ err.message = `Invalid data type ${packet_name}. Valid options are RAW, CONVERTED, FORMATTED, and WITH_UNITS.`;
341
+ throw err;
342
342
  }
343
343
  } else {
344
- data = await this.exec('tlm', [target_name, packet_name, item_name], {
344
+ data = await this.exec("tlm", [target_name, packet_name, item_name], {
345
345
  type: value_type,
346
- })
346
+ });
347
347
  }
348
- var converted = this.decode_openc3_type(data)
348
+ var converted = this.decode_openc3_type(data);
349
349
  if (converted !== null) {
350
- data = converted
350
+ data = converted;
351
351
  }
352
- return data
352
+ return data;
353
353
  }
354
354
 
355
355
  async inject_tlm(
356
356
  target_name,
357
357
  packet_name,
358
358
  item_hash = null,
359
- value_type = 'CONVERTED'
359
+ value_type = "CONVERTED"
360
360
  ) {
361
361
  data = await this.exec(
362
- 'inject_tlm',
362
+ "inject_tlm",
363
363
  [target_name, packet_name, item_hash],
364
364
  {
365
365
  type: value_type,
366
366
  }
367
- )
367
+ );
368
368
  }
369
369
 
370
370
  set_tlm(target_name, packet_name, item_name, value_type) {
371
- return this.exec('set_tlm', [target_name, packet_name, item_name], {
371
+ return this.exec("set_tlm", [target_name, packet_name, item_name], {
372
372
  type: value_type,
373
- })
373
+ });
374
374
  }
375
375
 
376
376
  override_tlm(target_name, packet_name, item_name, value_type) {
377
- return this.exec('override_tlm', [target_name, packet_name, item_name], {
377
+ return this.exec("override_tlm", [target_name, packet_name, item_name], {
378
378
  type: value_type,
379
- })
379
+ });
380
380
  }
381
381
 
382
382
  get_overrides() {
383
- return this.exec('get_overrides')
383
+ return this.exec("get_overrides");
384
384
  }
385
385
 
386
386
  normalize_tlm(target_name, packet_name, item_name, value_type) {
387
- return this.exec('normalize_tlm', [target_name, packet_name, item_name], {
387
+ return this.exec("normalize_tlm", [target_name, packet_name, item_name], {
388
388
  type: value_type,
389
- })
389
+ });
390
390
  }
391
391
 
392
392
  get_all_commands(target_name) {
393
- return this.exec('get_all_commands', [target_name])
393
+ return this.exec("get_all_commands", [target_name]);
394
394
  }
395
395
 
396
396
  get_all_command_names(target_name) {
397
- return this.exec('get_all_command_names', [target_name])
397
+ return this.exec("get_all_command_names", [target_name]);
398
398
  }
399
399
 
400
400
  get_command(target_name, command_name) {
401
- return this.exec('get_command', [target_name, command_name])
401
+ return this.exec("get_command", [target_name, command_name]);
402
402
  }
403
403
 
404
404
  get_cmd_cnts(target_commands) {
405
- return this.exec('get_cmd_cnts', [target_commands])
405
+ return this.exec("get_cmd_cnts", [target_commands]);
406
406
  }
407
407
 
408
408
  get_cmd_value(
409
409
  target_name,
410
410
  packet_name,
411
411
  parameter_name,
412
- value_type = 'CONVERTED'
412
+ value_type = "CONVERTED"
413
413
  ) {
414
- return this.exec('get_cmd_value', [
414
+ return this.exec("get_cmd_value", [
415
415
  target_name,
416
416
  packet_name,
417
417
  parameter_name,
418
418
  value_type,
419
- ])
419
+ ]);
420
420
  }
421
421
 
422
422
  get_cmd_buffer(target_name, packet_name) {
423
- return this.exec('get_cmd_buffer', [target_name, packet_name])
423
+ return this.exec("get_cmd_buffer", [target_name, packet_name]);
424
424
  }
425
425
 
426
426
  // Implementation of functionality shared by cmd methods with param_lists.
427
427
  _cmd(method, target_name, command_name, param_list, headerOptions) {
428
- var converted = null
428
+ var converted = null;
429
429
  for (var key in param_list) {
430
430
  if (Object.prototype.hasOwnProperty.call(param_list, key)) {
431
- converted = this.encode_openc3_type(param_list[key])
431
+ converted = this.encode_openc3_type(param_list[key]);
432
432
  if (converted !== null) {
433
- param_list[key] = converted
433
+ param_list[key] = converted;
434
434
  }
435
435
  }
436
436
  }
@@ -439,208 +439,208 @@ export class OpenC3Api {
439
439
  [target_name, command_name, param_list],
440
440
  {},
441
441
  headerOptions
442
- )
442
+ );
443
443
  }
444
444
 
445
445
  get_cmd_hazardous(target_name, command_name, param_list) {
446
446
  if (command_name === undefined) {
447
- return this.exec('get_cmd_hazardous', target_name)
447
+ return this.exec("get_cmd_hazardous", target_name);
448
448
  } else {
449
449
  return this._cmd(
450
- 'get_cmd_hazardous',
450
+ "get_cmd_hazardous",
451
451
  target_name,
452
452
  command_name,
453
453
  param_list
454
- )
454
+ );
455
455
  }
456
456
  }
457
457
 
458
458
  cmd(target_name, command_name, param_list, headerOptions = {}) {
459
459
  if (command_name === undefined) {
460
- return this.exec('cmd', target_name, {}, headerOptions)
460
+ return this.exec("cmd", target_name, {}, headerOptions);
461
461
  } else {
462
462
  return this._cmd(
463
- 'cmd',
463
+ "cmd",
464
464
  target_name,
465
465
  command_name,
466
466
  param_list,
467
467
  headerOptions
468
- )
468
+ );
469
469
  }
470
470
  }
471
471
 
472
472
  cmd_no_range_check(target_name, command_name, param_list) {
473
473
  if (command_name === undefined) {
474
- return this.exec('cmd_no_range_check', target_name)
474
+ return this.exec("cmd_no_range_check", target_name);
475
475
  } else {
476
476
  return this._cmd(
477
- 'cmd_no_range_check',
477
+ "cmd_no_range_check",
478
478
  target_name,
479
479
  command_name,
480
480
  param_list
481
- )
481
+ );
482
482
  }
483
483
  }
484
484
 
485
485
  cmd_raw(target_name, command_name, param_list) {
486
486
  if (command_name === undefined) {
487
- return this.exec('cmd_raw', target_name)
487
+ return this.exec("cmd_raw", target_name);
488
488
  } else {
489
- return this._cmd('cmd_raw', target_name, command_name, param_list)
489
+ return this._cmd("cmd_raw", target_name, command_name, param_list);
490
490
  }
491
491
  }
492
492
 
493
493
  cmd_raw_no_range_check(target_name, command_name, param_list) {
494
494
  if (command_name === undefined) {
495
- return this.exec('cmd_raw_no_range_check', target_name)
495
+ return this.exec("cmd_raw_no_range_check", target_name);
496
496
  } else {
497
497
  return this._cmd(
498
- 'cmd_raw_no_range_check',
498
+ "cmd_raw_no_range_check",
499
499
  target_name,
500
500
  command_name,
501
501
  param_list
502
- )
502
+ );
503
503
  }
504
504
  }
505
505
 
506
506
  cmd_no_hazardous_check(target_name, command_name, param_list) {
507
507
  if (command_name === undefined) {
508
- return this.exec('cmd_no_hazardous_check', target_name)
508
+ return this.exec("cmd_no_hazardous_check", target_name);
509
509
  } else {
510
510
  return this._cmd(
511
- 'cmd_no_hazardous_check',
511
+ "cmd_no_hazardous_check",
512
512
  target_name,
513
513
  command_name,
514
514
  param_list
515
- )
515
+ );
516
516
  }
517
517
  }
518
518
 
519
519
  cmd_no_checks(target_name, command_name, param_list) {
520
520
  if (command_name === undefined) {
521
- return this.exec('cmd_no_checks', target_name)
521
+ return this.exec("cmd_no_checks", target_name);
522
522
  } else {
523
- return this._cmd('cmd_no_checks', target_name, command_name, param_list)
523
+ return this._cmd("cmd_no_checks", target_name, command_name, param_list);
524
524
  }
525
525
  }
526
526
 
527
527
  cmd_raw_no_hazardous_check(target_name, command_name, param_list) {
528
528
  if (command_name === undefined) {
529
- return this.exec('cmd_raw_no_hazardous_check', target_name)
529
+ return this.exec("cmd_raw_no_hazardous_check", target_name);
530
530
  } else {
531
531
  return this._cmd(
532
- 'cmd_raw_no_hazardous_check',
532
+ "cmd_raw_no_hazardous_check",
533
533
  target_name,
534
534
  command_name,
535
535
  param_list
536
- )
536
+ );
537
537
  }
538
538
  }
539
539
 
540
540
  cmd_raw_no_checks(target_name, command_name, param_list) {
541
541
  if (command_name === undefined) {
542
- return this.exec('cmd_raw_no_checks', target_name)
542
+ return this.exec("cmd_raw_no_checks", target_name);
543
543
  } else {
544
544
  return this._cmd(
545
- 'cmd_raw_no_checks',
545
+ "cmd_raw_no_checks",
546
546
  target_name,
547
547
  command_name,
548
548
  param_list
549
- )
549
+ );
550
550
  }
551
551
  }
552
552
 
553
553
  build_command(target_name, command_name, param_list) {
554
554
  if (command_name === undefined) {
555
- return this.exec('build_command', target_name)
555
+ return this.exec("build_command", target_name);
556
556
  } else {
557
- return this._cmd('build_command', target_name, command_name, param_list)
557
+ return this._cmd("build_command", target_name, command_name, param_list);
558
558
  }
559
559
  }
560
560
 
561
561
  get_interface_names() {
562
- return this.exec('get_interface_names', [])
562
+ return this.exec("get_interface_names", []);
563
563
  }
564
564
 
565
565
  send_raw(interface_name, data) {
566
- return this.exec('send_raw', [interface_name, data])
566
+ return this.exec("send_raw", [interface_name, data]);
567
567
  }
568
568
 
569
569
  list_configs(tool) {
570
- return this.exec('list_configs', [tool])
570
+ return this.exec("list_configs", [tool]);
571
571
  }
572
572
 
573
573
  load_config(tool, name) {
574
- return this.exec('load_config', [tool, name])
574
+ return this.exec("load_config", [tool, name]);
575
575
  }
576
576
 
577
577
  save_config(tool, name, data) {
578
- return this.exec('save_config', [tool, name, data])
578
+ return this.exec("save_config", [tool, name, data]);
579
579
  }
580
580
 
581
581
  delete_config(tool, name) {
582
- return this.exec('delete_config', [tool, name])
582
+ return this.exec("delete_config", [tool, name]);
583
583
  }
584
584
 
585
585
  enable_limits(target, packet, item) {
586
- return this.exec('enable_limits', [target, packet, item])
586
+ return this.exec("enable_limits", [target, packet, item]);
587
587
  }
588
588
 
589
589
  disable_limits(target, packet, item) {
590
- return this.exec('disable_limits', [target, packet, item])
590
+ return this.exec("disable_limits", [target, packet, item]);
591
591
  }
592
592
 
593
593
  get_out_of_limits() {
594
- return this.exec('get_out_of_limits', [])
594
+ return this.exec("get_out_of_limits", []);
595
595
  }
596
596
 
597
597
  get_overall_limits_state(ignored) {
598
- return this.exec('get_overall_limits_state', [ignored])
598
+ return this.exec("get_overall_limits_state", [ignored]);
599
599
  }
600
600
 
601
601
  list_settings() {
602
- return this.exec('list_settings', [])
602
+ return this.exec("list_settings", []);
603
603
  }
604
604
 
605
605
  get_all_settings() {
606
- return this.exec('get_all_settings', [])
606
+ return this.exec("get_all_settings", []);
607
607
  }
608
608
 
609
609
  get_setting(name) {
610
- return this.exec('get_setting', [name])
610
+ return this.exec("get_setting", [name]);
611
611
  }
612
612
 
613
613
  get_settings(array) {
614
- return this.exec('get_settings', array)
614
+ return this.exec("get_settings", array);
615
615
  }
616
616
 
617
617
  save_setting(name, data) {
618
- return this.exec('save_setting', [name, data])
618
+ return this.exec("save_setting", [name, data]);
619
619
  }
620
620
 
621
621
  get_metrics() {
622
- return this.exec('get_metrics', [])
622
+ return this.exec("get_metrics", []);
623
623
  }
624
624
 
625
625
  // TODO: Currently unused but seemed like a useful function
626
626
  async hashString(string) {
627
627
  if (window.isSecureContext) {
628
628
  // Encode the string as an arrayBuffer which the subtle crypto API uses
629
- const arrayBuffer = new TextEncoder().encode(string)
629
+ const arrayBuffer = new TextEncoder().encode(string);
630
630
  // Use the subtle crypto API to perform a SHA256 Sum of the array buffer
631
631
  // The resulting hash is stored in an array buffer
632
632
  const hashAsArrayBuffer = await crypto.subtle.digest(
633
- 'SHA-256',
633
+ "SHA-256",
634
634
  arrayBuffer
635
- )
635
+ );
636
636
  // To create a string we will get the hexadecimal value of each byte of the array buffer
637
637
  // This gets us an array where each byte of the array buffer becomes one item in the array
638
- const uint8ViewOfHash = new Uint8Array(hashAsArrayBuffer)
638
+ const uint8ViewOfHash = new Uint8Array(hashAsArrayBuffer);
639
639
  // We then convert it to a regular array so we can convert each item to hexadecimal strings
640
640
  // Where to characters of 0-9 or a-f represent a number between 0 and 16, containing 4 bits of information, so 2 of them is 8 bits (1 byte).
641
641
  return Array.from(uint8ViewOfHash)
642
- .map((b) => b.toString(16).padStart(2, '0'))
643
- .join('')
642
+ .map((b) => b.toString(16).padStart(2, "0"))
643
+ .join("");
644
644
  }
645
645
  // else ?
646
646
  }