'use strict';
///
let devices : Devices;
class Devices {
private id : string = 'devices';
constructor () {
}
init () {
this.listen();
this.profiles();
gui.overlay(true);
gui.spinner(true, 'Checking for connected devices...');
}
listen () {
ipcRenderer.on('ready', this.ready.bind(this));
ipcRenderer.on('intval', this.intvalCb.bind(this));
ipcRenderer.on('error_state', this.errorState.bind(this));
}
async ready (event : any, arg : any) {
//console.dir(arg)
let opt : any;
let devs : any[] = [];
let notify : string = 'Connected to ';
let p : any;
//@ts-ignore
await delay(1000);
try {
gui.spinner(false);
gui.overlay(false);
} catch (err) {
log.error(err);
}
for (let i in arg) {
devs.push(arg[i].arduino);
if (arg[i].arduino && arg[i].arduino !== '/dev/fake') {
if (notify === 'Connected to ') {
notify += arg[i].arduino + ' '
} else {
notify += `& ${arg[i].arduino}`
}
}
opt = $('