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