Add messaging to the device connection process.

This commit is contained in:
mmcwilliams 2018-01-31 21:46:37 -05:00
parent 0b34fad858
commit 96eb24ac6d
1 changed files with 20 additions and 6 deletions

View File

@ -5,7 +5,7 @@ devices.init = function () {
'use strict';
devices.listen();
gui.overlay(true);
gui.spinner(true);
gui.spinner(true, 'Checking for connected devices...');
};
devices.listen = function () {
'use strict';
@ -17,17 +17,26 @@ devices.ready = function (event, arg) {
'use strict';
let opt;
let devs = [];
let notify = 'Connected to '
gui.spinner(false);
gui.overlay(false);
for (let i in arg) {
if (arg[i] !== '/dev/fake') {
devs.push(arg[i]);
if (notify === 'Connected to ') {
notify += arg[i] + ' '
} else {
notify += '& ' + arg[i]
}
}
opt = $('<option>');
opt.val(arg[i]);
opt.text(arg[i]);
$(`#${i}_device`).empty();
$(`#${i}_device`).append(opt);
if (notify !== 'Connected to ') {
gui.notify()
}
}
if (devs.length > 0) {
$('#devices').empty();
@ -57,17 +66,22 @@ devices.intval = function () {
if (proceed) {
gui.overlay(true);
gui.spinner(true);
gui.spinner(true, `Connecting to INTVAL3 @ ${url}`);
ipcRenderer.send('intval', obj)
} else {
$('input[name=camera_type][value=arduino]').prop('checked', 'checked');
$('#camera_type_arduino').prop('checked', 'checked');
}
};
devices.intvalCb = function (a, b) {
devices.intvalCb = function (evt, args) {
'use strict';
console.dir(a);
console.dir(b);
gui.spinner(false);
gui.overlay(false);
if (args.connected && args.connected === true) {
//success state
} else {
$('#camera_type_arduino').prop('checked', 'checked');
}
};
module.exports = devices;