'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.layoutProfiles();
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* () {
log.info("Devices ready");
let opt;
let devs = [];
let notify = 'Connected to ';
let p;
if (typeof arg.camera !== 'undefined' && typeof arg.camera.exposure !== undefined) {
$('#submit_cam_time').removeClass('hide');
$('#cam_time').removeAttr('readonly');
}
for (let i in arg) {
if (typeof arg[i].arduino !== 'undefined' && arg[i].arduino !== '/dev/fake') {
devs.push(arg[i].arduino);
if (notify === 'Connected to ') {
notify += arg[i].arduino + ' ';
}
else {
notify += `& ${arg[i].arduino}`;
}
}
opt = $('