'use strict';
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
///
let devices;
class Devices {
constructor() {
this.id = 'devices';
}
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('processing', this.processingCb.bind(this));
ipcRenderer.on('error_state', this.errorState.bind(this));
}
ready(event, arg) {
return __awaiter(this, void 0, void 0, function* () {
//console.dir(arg)
let opt;
let devs = [];
let notify = 'Connected to ';
let p;
//@ts-ignore
yield 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 = $('