diff --git a/ljswitchboard-io_manager/lib/controllers/device_controller.js b/ljswitchboard-io_manager/lib/controllers/device_controller.js index 786273dc..17cc7cc5 100644 --- a/ljswitchboard-io_manager/lib/controllers/device_controller.js +++ b/ljswitchboard-io_manager/lib/controllers/device_controller.js @@ -18,6 +18,7 @@ var io_endpoint_key = constants.device_endpoint_key; // device creators: var ljm_device_creator = require('./device_helpers/ljm_device'); +var t8_device_creator = require('./device_helpers/t8_device'); var t7_device_creator = require('./device_helpers/t7_device'); var t4_device_creator = require('./device_helpers/t4_device'); var t5_device_creator = require('./device_helpers/t5_device'); @@ -150,6 +151,9 @@ function createDeviceController(io_interface) { this.addMockDevice = function(deviceInfo) { return callFunc('addMockDevice', [deviceInfo]); }; + this.removeAllMockDevices = function() { + return callFunc('removeAllMockDevices'); + } this.initializeLogger = function() { return callFunc('initializeLogger'); }; @@ -440,8 +444,10 @@ function createDeviceController(io_interface) { deviceCreator = t5_device_creator; } else if (deviceInfo.deviceType == driver_constants.deviceTypes.digit) { deviceCreator = digit_device_creator; + } else if (deviceInfo.deviceType == driver_constants.deviceTypes.t8) { + deviceCreator = t8_device_creator; } else { - console.warn('Creating a non-standard ljm device object', deviceInfo); + console.warn('Creating a default ljm device object', deviceInfo); deviceCreator = ljm_device_creator; } diff --git a/ljswitchboard-io_manager/lib/controllers/device_helpers/t8_device.js b/ljswitchboard-io_manager/lib/controllers/device_helpers/t8_device.js new file mode 100644 index 00000000..8609d831 --- /dev/null +++ b/ljswitchboard-io_manager/lib/controllers/device_helpers/t8_device.js @@ -0,0 +1,41 @@ + +var EventEmitter = require('events').EventEmitter; +var util = require('util'); +var ljm_device = require('./ljm_device'); + +function createDevice(savedAttributes, deviceCallFunc, deviceSendFunc, closeDeviceFunc) { + + var ljmDevice = new ljm_device.createDevice( + savedAttributes, + deviceCallFunc, + deviceSendFunc, + closeDeviceFunc + ); + var ljmDeviceKeys = Object.keys(ljmDevice); + + var i = 0; + for(i = 0; i < ljmDeviceKeys.length; i++) { + var key = ljmDeviceKeys[i]; + this[key] = ljmDevice[key]; + } + + var getLJMDeviceEventListener = function(eventKey) { + var ljmDeviceEventListener = function(eventData) { + self.emit(eventKey, eventData); + }; + return ljmDeviceEventListener; + }; + var ljmDeviceEvents = ljmDevice.eventList; + var ljmDeviceEventKeys = Object.keys(ljmDeviceEvents); + ljmDeviceEventKeys.forEach(function(key) { + ljmDevice.on(key, getLJMDeviceEventListener(key)); + }); + + this.testFunc = function() { + + }; + var self = this; +} +util.inherits(createDevice, EventEmitter); + +exports.createDevice = createDevice; diff --git a/ljswitchboard-io_manager/lib/managers/device_manager_helpers/device_keeper.js b/ljswitchboard-io_manager/lib/managers/device_manager_helpers/device_keeper.js index ed07897f..a51e0b27 100644 --- a/ljswitchboard-io_manager/lib/managers/device_manager_helpers/device_keeper.js +++ b/ljswitchboard-io_manager/lib/managers/device_manager_helpers/device_keeper.js @@ -639,6 +639,7 @@ function createDeviceKeeper(io_delegator, link) { .then(function(data) { defered.resolve(data); }, defered.reject); + return defered.promise; }; @@ -689,6 +690,12 @@ function createDeviceKeeper(io_delegator, link) { .then(defered.resolve, defered.reject); return defered.promise; }; + this.removeAllMockDevices = function() { + var defered = q.defer(); + deviceScanner.removeAllMockDevices() + .then(defered.resolve, defered.reject); + return defered.promise; + }; /* Logger Functions/Logic */ diff --git a/ljswitchboard-io_manager/test/device_controller/t8_live_test.js b/ljswitchboard-io_manager/test/device_controller/t8_live_test.js new file mode 100644 index 00000000..0288f376 --- /dev/null +++ b/ljswitchboard-io_manager/test/device_controller/t8_live_test.js @@ -0,0 +1,199 @@ + +/** + This test is like basic_live_test.js, but only performs a minimal T8 test. +**/ + +var utils = require('../utils/utils'); +var qRunner = utils.qRunner; +var qExec = utils.qExec; +var pResults = utils.pResults; +var q = require('q'); +var async = require('async'); + +var labjack_nodejs = require('labjack-nodejs'); +var constants = labjack_nodejs.driver_const; + +var io_manager; +var io_interface; + +// Managers +var driver_controller; +var device_controller; +var file_io_controller; +var logger_controller; + +var device; + +exports.tests = { + 'initialization': function(test) { + console.log(''); + console.log('**** basic_live_test ****'); + console.log('**** Please connect 1x T8 via USB ****'); + + // Require the io_manager library + io_manager = require('../../lib/io_manager'); + + // Require the io_interface that gives access to the ljm driver, + // device controller, logger, and file_io_controller objects. + io_interface = io_manager.io_interface(); + + // Initialize the io_interface + io_interface.initialize() + .then(function(res) { + // io_interface has initialized and is ready for use + + // Save local pointers to the created objects + driver_controller = io_interface.getDriverController(); + device_controller = io_interface.getDeviceController(); + + test.ok(true); + test.done(); + }, function(err) { + test.ok(false, 'error initializing io_interface' + JSON.stringify(err)); + test.done(); + }); + }, + 'open device': function(test) { + var params = { + 'deviceType': 'LJM_dtT8', + 'connectionType': 'LJM_ctUSB', + 'identifier': 'LJM_idANY', + 'mockDevice': false + }; + + device_controller.openDevice(params) + .then(function(newDevice) { + // save device reference + device = newDevice; + device_controller.getNumDevices() + .then(function(res) { + test.strictEqual(res, 1, 'wrong number of devices are open'); + test.done(); + }); + }, function(err) { + console.log("Error opening device", err); + test.ok(false, 'failed to create new device object'); + test.done(); + }); + }, + 'test getHandleInfo': function(test) { + device.getHandleInfo() + .then(function(res) { + var requiredKeys = [ + 'deviceType', + 'connectionType', + 'serialNumber', + 'ipAddress', + 'port', + 'maxBytesPerMB' + ]; + var resKeys = Object.keys(res); + var msg = 'required keys do not match keys in response'; + test.strictEqual(resKeys.length, requiredKeys.length, msg); + requiredKeys.forEach(function(key, i) { + test.strictEqual(resKeys[i], key, msg + ': ' + key); + }); + test.done(); + }, function(err) { + console.log('getHandleInfo error', err); + test.ok(false); + test.done(); + }); + }, + 'test getDeviceAttributes': function(test) { + device.getDeviceAttributes() + .then(function(res) { + // Test to make sure that there are a few key attributes. + var requiredAttributes = [ + 'deviceType', + 'connectionType', + 'serialNumber', + 'ipAddress', + 'port', + 'maxBytesPerMB', + 'deviceTypeString', + 'deviceClass', + 'openParameters', + 'subclass', + 'isPro', + 'productType' + ]; + var givenAttributes = Object.keys(res); + requiredAttributes.forEach(function(requiredAttribute) { + var msg = 'Required key does not exist: ' + requiredAttribute; + test.ok((givenAttributes.indexOf(requiredAttribute) >= 0), msg); + }); + test.done(); + }, function(err) { + test.ok(false, 'read should not have returned an error: ' + JSON.stringify(err)); + test.done(); + }); + }, + 'readFirmwareVersion': function(test) { + var regs = [ + 'FIRMWARE_VERSION', + // 'BOOTLOADER_VERSION', + 'DEVICE_NAME_DEFAULT', + // 'WIFI_VERSION' + ]; + var passes = true; + var errorMessage = ''; + async.eachSeries(regs, function(reg, cb) { + device.iRead(reg).then( + function(res) { + cb(); + }, function(err) { + passes = false; + errorMessage += 'Error reading: ' + reg + '\n'; + cb(); + }); + }, function(err) { + test.ok(passes, errorMessage); + test.done(); + }); + }, + 'close device': function(test) { + device.close() + .then(function(res) { + test.strictEqual(res.comKey, 0, 'expected to receive a different comKey'); + test.done(); + }, function(err) { + console.log('Failed to close mock device', err); + test.ok(false, 'Failed to close mock device'); + test.done(); + }); + }, + 'verify device closure': function(test) { + device.read('AIN0') + .then(function(res) { + console.log('read returned', res); + test.ok(false, 'should have caused an error'); + test.done(); + }, function(err) { + test.done(); + }); + }, + 'close all devices': function(test) { + device_controller.closeAllDevices() + .then(function(res) { + // console.log('Num Devices Closed', res); + test.strictEqual(res.numClosed, 0, 'wrong number of devices closed'); + test.done(); + }, function(err) { + console.log('Error closing all devices', err); + test.ok(false, 'failed to close all devices'); + test.done(); + }); + }, + 'destruction': function(test) { + io_interface.destroy() + .then(function(res) { + // io_interface process has been shut down + test.ok(true); + test.done(); + }, function(err) { + test.ok(false, 'io_interface failed to shut down' + JSON.stringify(err)); + test.done(); + }); + } +}; diff --git a/ljswitchboard-io_manager/test/test.js b/ljswitchboard-io_manager/test/test.js index 8766c634..d9113f8e 100644 --- a/ljswitchboard-io_manager/test/test.js +++ b/ljswitchboard-io_manager/test/test.js @@ -31,6 +31,7 @@ var testGroups = { // Requires LabJack devices. 'basic_live_test': false, // Passing + 't8_live_test': false, 'open_advanced_test': false, // 'device_keeper_test': false, // diff --git a/ljswitchboard-kipling_tester/test/mock_module_tests/mock_device_selector.js b/ljswitchboard-kipling_tester/test/mock_module_tests/mock_device_selector.js index 7c920265..2a926fc5 100644 --- a/ljswitchboard-kipling_tester/test/mock_module_tests/mock_device_selector.js +++ b/ljswitchboard-kipling_tester/test/mock_module_tests/mock_device_selector.js @@ -169,8 +169,8 @@ this.test_device_selector = { var t4s = $('.DEVICE_TYPE_T4 .device'); test.strictEqual(t4s.length, 1, 'Unexpected number of T4s found'); - var t5s = $('.DEVICE_TYPE_T5 .device'); - test.strictEqual(t5s.length, 1, 'Unexpected number of T5s found'); + var t8s = $('.DEVICE_TYPE_T8 .device'); + test.strictEqual(t8s.length, 1, 'Unexpected number of T8s found'); test.done(); }, diff --git a/ljswitchboard-kipling_tester/test/mock_module_tests/mock_devices.js b/ljswitchboard-kipling_tester/test/mock_module_tests/mock_devices.js index 5ed36d15..3d7338e7 100644 --- a/ljswitchboard-kipling_tester/test/mock_module_tests/mock_devices.js +++ b/ljswitchboard-kipling_tester/test/mock_module_tests/mock_devices.js @@ -40,15 +40,23 @@ var mockDevices = [{ 'POWER_LED': 1, }, }, { - 'deviceType': 'LJM_dtT4', + 'deviceType': 'LJM_dtT8', 'connectionType': 'LJM_ctUSB', - 'serialNumber': 44001000, + 'serialNumber': 8, + 'WIFI_RSSI': -65, 'deviceConfig': { + 'TEMPERATURE_DEVICE_K': 210.69, + 'CURRENT_SOURCE_200UA_CAL_VALUE': 0.000123123, + 'CURRENT_SOURCE_10UA_CAL_VALUE': 0.000123123, + 'POWER_ETHERNET': 1, + 'POWER_WIFI': 1, + 'POWER_AIN': 1, + 'POWER_LED': 1, }, }, { - 'deviceType': 'LJM_dtT5', + 'deviceType': 'LJM_dtT4', 'connectionType': 'LJM_ctUSB', - 'serialNumber': 45001000, + 'serialNumber': 44001000, 'deviceConfig': { }, }, { diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/analog_inputs_fw/module.json b/ljswitchboard-module_manager/lib/switchboard_modules/analog_inputs_fw/module.json index 733b7c9d..19c9ecce 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/analog_inputs_fw/module.json +++ b/ljswitchboard-module_manager/lib/switchboard_modules/analog_inputs_fw/module.json @@ -3,6 +3,9 @@ "humanName": "Analog Inputs", "version": "0.0.1", "framework":"singleDevice", + "supportedDevices": [ + {"type":"T7","minFW":"0.5"} + ], "supportedDevices": [{"type":"T7","minFW":"0.5"}], "htmlFiles": [ "ainEFTypeNameTemplate.html", diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/deviceControlLocationDefinitions.js b/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/deviceControlLocationDefinitions.js index 52a38769..5b554416 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/deviceControlLocationDefinitions.js +++ b/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/deviceControlLocationDefinitions.js @@ -9,28 +9,38 @@ function getDashboardGuiConstants(deviceTypeName, productType) { this.LABJACK_OVERVIEW_IMG_SRC = STATIC_FILES_DIR + this.LABJACK_OVERVIEW_IMG_SRC; this.DEVICE_IMAGE_ALLOCATED_WIDTH = { + 'T8': 560, 'T7': 370, 'T5': 505, 'T4': 505, }[deviceTypeName]; this.DEVICE_IMAGE_X_OFFSET = 150; this.DEVICE_IMAGE_Y_OFFSET = 10;//10 - this.DEVICE_IMG_WIDTH = 225; + this.DEVICE_IMG_WIDTH = { + 'T8': 290, + 'T7': 225, + 'T5': 225, + 'T4': 225, + }[deviceTypeName]; + var T8_DEVICE_HEIGHT = 525; var T7_DEVICE_HEIGHT = 525; var T5_DEVICE_HEIGHT = 425; var T4_DEVICE_HEIGHT = 325; this.DEVICE_IMG_HEIGHT = { + 'T8': T8_DEVICE_HEIGHT, 'T7': T7_DEVICE_HEIGHT, 'T5': T5_DEVICE_HEIGHT, 'T4': T4_DEVICE_HEIGHT, }[deviceTypeName]; this.DEVICE_IMG_SPLINES_HEIGHT_MULTIPLIER = { + 'T8': 1, 'T7': 1, 'T5': T7_DEVICE_HEIGHT/T5_DEVICE_HEIGHT, 'T4': T7_DEVICE_HEIGHT/T4_DEVICE_HEIGHT, }[deviceTypeName]; this.DEVICE_IMAGE_Y_SPLINES_OFFSET = { + 'T8': 0, 'T7': 0, 'T5': 20, 'T4': 40, @@ -42,7 +52,12 @@ function getDashboardGuiConstants(deviceTypeName, productType) { this.CONNECTOR_SIZE_X = this.DEVICE_IMAGE_X_OFFSET + this.DEVICE_IMAGE_X_OVERLAP; // this.DEVICE_IMAGE_X_OVERLAP = 55; - this.DEVICE_RIGHT_SIDE_OFFSET = 215; + this.DEVICE_RIGHT_SIDE_OFFSET = { + 'T8': 300, + 'T7': 215, + 'T5': 215, + 'T4': 215, + }[deviceTypeName]; this.DEVICE_CONNECTOR_SIZE_X = this.DEVICE_IMAGE_X_OFFSET + this.DEVICE_IMAGE_X_OVERLAP; this.DEVICE_BUTTON_LEFT_PADDING = 5; @@ -53,6 +68,7 @@ function getDashboardGuiConstants(deviceTypeName, productType) { // DB Image Info // this.LABJACK_DB_IMG_SRC = 'img/'+deviceTypeName+'-DB-cartoon.png'; this.LABJACK_DB_IMG_SRC = { + 'T8': 'img/'+deviceTypeName+'-DB15-cartoon.png', 'T7': 'img/'+deviceTypeName+'-DB-cartoon.png', 'T4': 'img/'+deviceTypeName+'-DB15-cartoon.png', 'T5': 'img/'+deviceTypeName+'-DB15-cartoon.png', @@ -62,27 +78,32 @@ function getDashboardGuiConstants(deviceTypeName, productType) { this.DB_IMG_WIDTH = 225; this.DB_ALLOCATED_HEIGHT = { + 'T8': 230, 'T7': 525, 'T5': 260, 'T4': 230, }[deviceTypeName]; + var T8_DB_HEIGHT = 180; var T7_DB_HEIGHT = 525; var T5_DB_HEIGHT = 180; var T4_DB_HEIGHT = 180; this.DB_IMG_HEIGHT = { + 'T8': T8_DB_HEIGHT, 'T7': T7_DB_HEIGHT, 'T5': T5_DB_HEIGHT, 'T4': T4_DB_HEIGHT, }[deviceTypeName]; this.DB_IMG_SPLINES_HEIGHT_MULTIPLIER = { + 'T8': T7_DB_HEIGHT/T8_DB_HEIGHT, 'T7': 1, 'T5': T7_DB_HEIGHT/T5_DB_HEIGHT, 'T4': T7_DB_HEIGHT/T4_DB_HEIGHT, }[deviceTypeName]; this.DB_IMAGE_Y_SPLINES_OFFSET = { + 'T8': 20, 'T7': 0, 'T5': 20, 'T4': 20, @@ -90,6 +111,7 @@ function getDashboardGuiConstants(deviceTypeName, productType) { this.DB_IMAGE_X_OFFSET = 110; this.DB_IMAGE_Y_OFFSET = { + 'T8': 50, 'T7': 0, 'T5': 80, 'T4': 50, @@ -222,6 +244,46 @@ function getDashboardGuiConstants(deviceTypeName, productType) { {register: 'AIN4', yLocation: 0.425-DEV_OFF, yShift: 1, yOffset: -6, yOverlayOffset: 12, type: null, board: 'device', side: 'right'}, {register: 'AIN7', yLocation: 0.342-DEV_OFF, yShift: 3.5, yOffset: 6, yOverlayOffset: 15, type: null, board: 'device', side: 'right'}, {register: 'AIN6', yLocation: 0.315-DEV_OFF, yShift: 4, yOffset: -6, yOverlayOffset: 15, type: null, board: 'device', side: 'right'}, + + // Left Side, DB15 + {register: 'EIO6', yLocation: 0.275+0.020, yOffset: 2*bNum, type: 'dio', board: 'connector', side: 'left'}, + {register: 'EIO4', yLocation: 0.250+0.020, yOffset: 1*bNum, type: 'dio', board: 'connector', side: 'left'}, + {register: 'EIO2', yLocation: 0.225+0.020, yOffset: 0*bNum, type: 'dio', board: 'connector', side: 'left'}, + {register: 'EIO0', yLocation: 0.197+0.020, yOffset: -1*bNum, type: 'dio', board: 'connector', side: 'left'}, + {register: 'CIO3', yLocation: 0.170+0.020, yOffset: -2*bNum, type: 'dio', board: 'connector', side: 'left'}, + {register: 'CIO1', yLocation: 0.140+0.020, yOffset: -3*bNum, type: 'dio', board: 'connector', side: 'left'}, + + // Right Side, DB15 + {register: 'EIO7', yLocation: 0.300+0.010, yOffset: 2*bNum, type: 'dio', board: 'connector', side: 'right'}, + {register: 'EIO5', yLocation: 0.275+0.010, yOffset: 1*bNum, type: 'dio', board: 'connector', side: 'right'}, + {register: 'EIO3', yLocation: 0.248+0.010, yOffset: 0*bNum, type: 'dio', board: 'connector', side: 'right'}, + {register: 'EIO1', yLocation: 0.222+0.010, yOffset: -1*bNum, type: 'dio', board: 'connector', side: 'right'}, + {register: 'CIO2', yLocation: 0.165+0.010, yOffset: -0.5*bNum, type: 'dio', board: 'connector', side: 'right'}, + {register: 'CIO0', yLocation: 0.135+0.010, yOffset: -1.5*bNum, type: 'dio', board: 'connector', side: 'right'} + ]; + } else if(deviceTypeName === 'T8') { + this.AIN_NUM_DIGITS_PRECISION = 6; + this.REGISTER_OVERLAY_SPEC = [ + // Left Side, Device + {register: 'DAC1', yLocation: 0.297-DEV_OFF, yShift: 1, yOffset: -6, yOverlayOffset: 12, type: 'dac', board: 'device', side: 'left'}, + {register: 'DAC0', yLocation: (0.297+0.025)-DEV_OFF, yShift: 0, yOffset: 6, yOverlayOffset: 12, type: 'dac', board: 'device', side: 'left'}, + {register: 'FIO7', yLocation: 0.382-DEV_OFF, yShift: -1, yOffset: -6, yOverlayOffset: 10, type: 'dio', board: 'device', side: 'left'}, + {register: 'FIO6', yLocation: (0.382+0.025)-DEV_OFF, yShift: -2, yOffset: 6, yOverlayOffset: 10, type: 'dio', board: 'device', side: 'left'}, + {register: 'FIO5', yLocation: 0.486-DEV_OFF, yShift: 1, yOffset: -6, yOverlayOffset: 12, type: 'dio', board: 'device', side: 'left'}, + {register: 'FIO4', yLocation: (0.486+0.025)-DEV_OFF, yShift: 0, yOffset: 6, yOverlayOffset: 12, type: 'dio', board: 'device', side: 'left'}, + {register: 'FIO3', yLocation: 0.597-DEV_OFF, yShift: -1, yOffset: -6, yOverlayOffset: 10, type: 'dio', board: 'device', side: 'left'}, + {register: 'FIO2', yLocation: (0.597+0.025)-DEV_OFF, yShift: -2, yOffset: 6, yOverlayOffset: 10, type: 'dio', board: 'device', side: 'left'}, + {register: 'FIO1', yLocation: 0.690-DEV_OFF, yShift: -4, yOffset: -6, yOverlayOffset: 8, type: 'dio', board: 'device', side: 'left'}, + {register: 'FIO0', yLocation: (0.690+0.025)-DEV_OFF, yShift: -5, yOffset: 6, yOverlayOffset: 8, type: 'dio', board: 'device', side: 'left'}, + + {register: 'AIN0', yLocation: 0.200-DEV_OFF, yShift: 0, yOffset: 0, yOverlayOffset: 15, type: null, board: 'device', side: 'right'}, + {register: 'AIN1', yLocation: (0.200+1*.07)-DEV_OFF, yShift: 0, yOffset: 0, yOverlayOffset: 15, type: null, board: 'device', side: 'right'}, + {register: 'AIN2', yLocation: (0.200+2*.07)-DEV_OFF, yShift: 0, yOffset: 0, yOverlayOffset: 12, type: null, board: 'device', side: 'right'}, + {register: 'AIN3', yLocation: (0.200+3*.07)-DEV_OFF, yShift: 0, yOffset: 0, yOverlayOffset: 12, type: null, board: 'device', side: 'right'}, + {register: 'AIN4', yLocation: (0.200+4*.07)-DEV_OFF, yShift: 0, yOffset: 0, yOverlayOffset: 10, type: null, board: 'device', side: 'right'}, + {register: 'AIN5', yLocation: (0.200+5*.07)-DEV_OFF, yShift: 0, yOffset: 0, yOverlayOffset: 10, type: null, board: 'device', side: 'right'}, + {register: 'AIN6', yLocation: (0.200+6*.07)-DEV_OFF, yShift: 0, yOffset: 0, yOverlayOffset: 8, type: null, board: 'device', side: 'right'}, + {register: 'AIN7', yLocation: (0.200+7*.07)-DEV_OFF, yShift: 0, yOffset: 0, yOverlayOffset: 8, type: null, board: 'device', side: 'right'}, // Left Side, DB15 {register: 'EIO6', yLocation: 0.275+0.020, yOffset: 2*bNum, type: 'dio', board: 'connector', side: 'left'}, diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/deviceDashboardController.js b/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/deviceDashboardController.js index 4d2623f6..b83cb38c 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/deviceDashboardController.js +++ b/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/deviceDashboardController.js @@ -224,7 +224,7 @@ function getDeviceDashboardController(deviceInfo, moduleData) { .attr('stroke-width', 1) .style('shape-rendering', determineAntialiasing); - // Create a DIV for each of the registers for the main device + // Create a DIV for each of the registers var overlays = d3.select(DB_REGISTERS_CONTAINER) .selectAll('.register-overlay') // Try to replace any existing elements w/ this class .data(function () { // fill all of the elements with data. @@ -337,7 +337,7 @@ function getDeviceDashboardController(deviceInfo, moduleData) { (-1 * marginTopVal).toString() + 'px' ); - // Apply width & height fixes to allow for T4 to have register controls + // Apply width & height fixes to allow for register controls // on the right side. $(DEVICE_D3_CONTAINER).css( 'width', diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/module.json b/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/module.json index 69877ccd..161874d7 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/module.json +++ b/ljswitchboard-module_manager/lib/switchboard_modules/dashboard_v2/module.json @@ -4,7 +4,11 @@ "version": "0.0.1", "framework":"singleDevice", "third_party_code":[], - "supportedDevices": [{"type":"T7","subclass":["Pro",""],"minFW":"0.01"}, {"type":"T4","minFW":"0.01"}, {"type":"T5","minFW":"0.01"}], + "supportedDevices": [ + {"type":"T8","minFW":"0.1"}, + {"type":"T7","subclass":["Pro",""],"minFW":"0.01"}, + {"type":"T4","minFW":"0.01"} + ], "jsFiles":[ "deviceDashboardController.js", "deviceControlLocationDefinitions.js" diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/controller.js b/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/controller.js index de87d3fe..d453dfe7 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/controller.js +++ b/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/controller.js @@ -525,7 +525,117 @@ function module() { // 'RTC_TIME_S', // Not available in T4 FW 0.202 // 'SNTP_UPDATE_INTERVAL', // Not available in T4 FW 0.202 ]; - + + // Not available in T4 FW 0.202 + var secondaryExtraRegisters = [ + 'TEMPERATURE_DEVICE_K', + ]; + // var secondaryExtraRegisters = []; + promises.push(getExtraOperation(device,'sReadMany', extraRegisters)); + promises.push(getExtraOperation(device,'sReadMany', secondaryExtraRegisters)); + promises.push(getExtraOperation(device,'sRead', 'ETHERNET_MAC')); + promises.push(function getDeviceRecoveryFirmwareVersion() { + var defered = q.defer(); + device.getRecoveryFirmwareVersion() + .then(function(res) { + console.log('Get Device Recovery Firmware Version Result', res); + defered.resolve({ + 'val': res, + 'name': 'recoveryFirmwareVersion' + }); + }, function(err) { + defered.reject(err); + }); + return defered.promise; + }()); + promises.push(function performCheckForHardwareIssues() { + var defered = q.defer(); + device.checkForHardwareIssues() + .then(function(res) { + console.log('HW Issues Results', res); + var retData = JSON.parse(JSON.stringify(res)); + retData.name = 'hwIssues'; + retData.testResults = []; + var tests = Object.keys(res.testResults); + tests.forEach(function(key) { + retData.testResults.push(res.testResults[key]); + }); + defered.resolve(retData); + }, function(err) { + defered.reject(err); + }); + return defered.promise; + }()); + promises.push(function getDeviceAuthStatus() { + var defered = q.defer(); + device.isAuthorized() + .then(function(res) { + console.log('Device Auth Status', res); + var message = "Device is Authorized"; + var shortMessage = "Authorized"; + if(!res) { + message = "Not authorized, please email support@labjack.com"; + shortMessage = "Not Authorized"; + } + defered.resolve({ + 'val': res, + 'name': 'isAuthorized', + 'message': message, + 'shortMessage': shortMessage, + }); + }, function(err) { + defered.reject(err); + }); + return defered.promise; + }()); + promises.push(function getAvailableConnectionTypes() { + var defered = q.defer(); + device.getAvailableConnectionTypes() + .then(function(result) { + console.log('Available connection types'); + var connections = result.connections; + var isUSB = false; + var isEth = false; + var isWiFi = false; + connections.forEach(function(connection) { + if(connection.type === 'USB') { + isUSB = connection.isAvailable; + } + if(connection.type === 'Ethernet') { + isEth = connection.isAvailable; + } + if(connection.type === 'WiFi') { + isWiFi = connection.isAvailable; + } + }); + defered.resolve({ + 'val': result, + 'name': 'availableConnections', + 'isUSB': isUSB, + 'isEth': isEth, + 'isWiFi': isWiFi, + }); + }, function(err) { + defered.reject(err); + }); + return defered.promise; + }()); + promises.push(getExtraOperation(device,'getLatestDeviceErrors')); + } else if(device.savedAttributes.deviceTypeName === 'T8') { + deviceTemplate = handlebars.compile( + framework.moduleData.htmlFiles.t8_template + ); + + // Extra required data for T4s + extraRegisters = [ + 'ETHERNET_IP', + 'POWER_LED', + 'WATCHDOG_ENABLE_DEFAULT', + 'HARDWARE_VERSION', + // 'RTC_TIME_S', // Not available in T4 FW 0.202 + // 'SNTP_UPDATE_INTERVAL', // Not available in T4 FW 0.202 + ]; + // Not available in T4 FW 0.202 var secondaryExtraRegisters = [ 'TEMPERATURE_DEVICE_K', diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/module.json b/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/module.json index e2fa12f1..84d76004 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/module.json +++ b/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/module.json @@ -4,8 +4,14 @@ "version": "0.0.1", "framework":"singleDevice", "third_party_code":[], - "supportedDevices": [{"type":"T7"},{"type":"Digit"},{"type":"T4"}], + "supportedDevices": [ + {"type":"Digit"}, + {"type":"T8","minFW":"0.1"}, + {"type":"T7","minFW":"0.1"}, + {"type":"T4","minFW":"0.1"} + ], "htmlFiles": [ + "t8_template.html", "t7_template.html", "digit_template.html", "t4_template.html", diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/t4_template.html b/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/t4_template.html index abc67960..be02da35 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/t4_template.html +++ b/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/t4_template.html @@ -383,4 +383,4 @@
{{printContext}}--}} \ No newline at end of file +{{!--
{{printContext}}--}} diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/t8_template.html b/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/t8_template.html new file mode 100644 index 00000000..2ef35a74 --- /dev/null +++ b/ljswitchboard-module_manager/lib/switchboard_modules/device_info_fw/t8_template.html @@ -0,0 +1,386 @@ +
Note 1: Clicking on these links will open up your computer's default web browser and take you to the labjack.com website.
+ Note 2: When running a secondary application (LJLogM/LJStreamM) you may need to close the application in order for it to be used in Kipling again.
+
BETA FEATURE, APP OPENING
+If these applications aren't properly opening a device edit the appropriate _open.cfg file (links below) to instruct them to open the correct device.
+{{printContext}}--}} diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/controller.js b/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/controller.js index 2fe1a22a..9df49e83 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/controller.js +++ b/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/controller.js @@ -292,6 +292,7 @@ var createModuleInstance = function() { updateAndSaveScanSelections(); // In parallel, scan for devices. + console.log('Calling listAllDevices', self.scanOptions); listAllDevices(self.scanOptions) .then(function(res) { scanResults = res; @@ -554,6 +555,7 @@ var createModuleInstance = function() { 'scanWiFi': false, 'scanEthernetTCP': false, 'scanWiFiTCP': false, + 'enableDemoMode': false, }; this.advancedScanOptions = false; this.directConnectParams = { @@ -571,6 +573,7 @@ var createModuleInstance = function() { self.scanOptions.scanWiFi = $("#wifi_scan_enabled").is(':checked'); self.scanOptions.scanEthernetTCP = $("#ethernet_tcp_scan_enabled").is(':checked'); self.scanOptions.scanWiFiTCP = $("#wifi_tcp_scan_enabled").is(':checked'); + self.scanOptions.enableDemoMode = $("#demo_scan_enabled").is(':checked'); // After updating these variables, update the persistent data return innerSaveStartupData(); // .then(function(res) { @@ -628,6 +631,7 @@ var createModuleInstance = function() { 'scanWiFi': false, 'scanEthernetTCP': false, 'scanWiFiTCP': false, + 'enableDemoMode': false, }, 'advancedScanOptions': false, 'directConnectParams': { @@ -656,7 +660,7 @@ var createModuleInstance = function() { if(requiredPrimaryKey === requiredPrimaryKeys[0]) { var secondaryKeys = Object.keys(startupData[requiredPrimaryKey]); - var reqSecondaryKeys = ['scanUSB', 'scanEthernet', 'scanWiFi','scanEthernetTCP', 'scanWiFiTCP']; + var reqSecondaryKeys = ['scanUSB', 'scanEthernet', 'scanWiFi','scanEthernetTCP', 'scanWiFiTCP', 'enableDemoMode']; reqSecondaryKeys.forEach(function(reqSecondaryKey) { if(secondaryKeys.indexOf(reqSecondaryKey) < 0) { isValid = false; diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/data_init.json b/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/data_init.json index 32190605..605fbde8 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/data_init.json +++ b/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/data_init.json @@ -4,7 +4,8 @@ "scanEthernet": true, "scanWiFi": false, "scanEthernetTCP": false, - "scanWiFiTCP": false + "scanWiFiTCP": false, + "enableDemoMode": false }, "advancedScanOptions": false, "directConnectParams": { diff --git a/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/view.html b/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/view.html index 92ba554c..ab99f2d3 100644 --- a/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/view.html +++ b/ljswitchboard-module_manager/lib/switchboard_modules/device_selector/view.html @@ -64,6 +64,11 @@