function DeviceQueue(){function t(t){var t=t||null,n=_.find(e,function(e){if(e)return e.uID===t});return showDebug===2&&console.log("getDeviceFromQueue: uID = "+t+" returning device: "+n),n}function n(n,r){r=r.replace("BO5EBO5E-F00D-F00D-FEED-","").toUpperCase(),r[r.length-1]===""&&(r=r.slice(0,-1));var i=t(r);if(i===undefined){var s=new Device(n,r);return showDebug>=2&&console.log(LogMessage.create("DEVICE_DISCOVERY","STEP ---: ADD DEVICE TO DEVICE QUEUE",!0)+"ip: "+n+"id: "+r),e.push(s),s}return i.ip===n?i.waking===!0?i:i.fail===!0?(i.fail=!1,i):undefined:(i.ip=n,i)}function r(n){showDebug===2&&console.log("addExistingDeviceToQueue: "+n);var r=t(n.uID);return r===undefined?(showDebug>=2&&console.log(LogMessage.create("DEVICE_DISCOVERY","STEP ---: ADD EXISTING DEVICE TO DEVICE QUEUE",!0)+JSON.stringify(n),n),funcObj.UIMain.validateIp(n.ip)?(e.push(n),n):undefined):r.ip===n.ip?undefined:n.ip==null?undefined:(r.ip=n.ip,r)}function i(n){showDebug===2&&console.log("removeDevice: uID = "+n);var r=t(n);return e=_.without(e,r),e}function s(){var t=[];e.forEach(function(e){var n=e;n.sObj?n.socketState=n.sObj.getSocketState():n.socketState=undefined,t.push(n)}),console.table(t,["uID","ip","aid","name","origin","own","done","fail","socketState"])}function o(e,n,r){showDebug===2&&console.log("setDeviceProperty: "+e+", "+n+", "+r);var i=t(e);if(i!==undefined)try{i[n]=r}catch(s){showDebug===2&&console.log("setDeviceProperty: failed to set property: "+n)}}function u(){var t=[];return showDebug===2&&console.log("getFailedDevices"),t=_.find(e,function(e){return e.fail===!0}),t}function a(){e=[]}function f(){return e}var e=[];this.addToDeviceQueue=n,this.addExistingDeviceToQueue=r,this.removeDevice=i,this.setDeviceProperty=o,this.getFailedDevices=u,this.clearQueue=a,this.getQueue=f,this.getDeviceFromQueue=t,this.listDeviceQueue=s};