lib/temp_files/oa_managed_device.js
function printCollectedDeviceData(results) {
        var dataToKeep = {
            'AIN0': 'val',
            'FIRMWARE_VERSION': 'val',
            'WIFI_IP': 'str',
            'ETHERNET_IP': 'str',
            'WIFI_RSSI': 'str',
            'WIFI_VERSION': 'val',
            'SERIAL_NUMBER': 'val',
            'HARDWARE_INSTALLED': 'productType',
        };
        var vals = [];
        results.forEach(function(result) {
            result = result.data;
            var data = {};
            var keyToKeep = 'res';
            if(dataToKeep[result.name]) {
                keyToKeep = dataToKeep[result.name];
            }
            data[result.name] = result.res;
            if(result[keyToKeep]) {
                data[result.name] = result[keyToKeep];
            }
            vals.push(data);
        });

        if(DEBUG_COLLECTED_DEVICE_DATA) {
            console.log('Connection Type', self.curatedDevice.savedAttributes.connectionTypeName);
            console.log('Serial Number', self.curatedDevice.savedAttributes.serialNumber);
            console.log('Read Data', self.curatedDevice.getDevice().handle,':');
            console.log(vals);
        }
    }
function printCollectedDeviceData(results) {
        var dataToKeep = {
            'AIN0': 'val',
            'FIRMWARE_VERSION': 'val',
            'WIFI_IP': 'str',
            'ETHERNET_IP': 'str',
            'WIFI_RSSI': 'str',
            'WIFI_VERSION': 'val',
            'SERIAL_NUMBER': 'val',
            'HARDWARE_INSTALLED': 'productType',
        };
        var vals = [];
        results.forEach(function(result) {
            result = result.data;
            var data = {};
            var keyToKeep = 'res';
            if(dataToKeep[result.name]) {
                keyToKeep = dataToKeep[result.name];
            }
            data[result.name] = result.res;
            if(result[keyToKeep]) {
                data[result.name] = result[keyToKeep];
            }
            vals.push(data);
        });

        if(DEBUG_COLLECTED_DEVICE_DATA) {
            console.log('Connection Type', self.curatedDevice.savedAttributes.connectionTypeName);
            console.log('Serial Number', self.curatedDevice.savedAttributes.serialNumber);
            console.log('Read Data', self.curatedDevice.getDevice().handle,':');
            console.log(vals);
        }
    }
function printCollectedDeviceData ( results ) { var dataToKeep = { 'AIN0' : 'val' , 'FIRMWARE_VERSION' : 'val' , 'WIFI_IP' : 'str' , 'ETHERNET_IP' : 'str' , 'WIFI_RSSI' : 'str' , 'WIFI_VERSION' : 'val' , 'SERIAL_NUMBER' : 'val' , 'HARDWARE_INSTALLED' : 'productType' , } ; var vals = [ ] ; results . forEach ( function ( result ) { result = result . data ; var data = { } ; var keyToKeep = 'res' ; if ( dataToKeep [ result . name ] ) { keyToKeep = dataToKeep [ result . name ] ; } data [ result . name ] = result . res ; if ( result [ keyToKeep ] ) { data [ result . name ] = result [ keyToKeep ] ; } vals . push ( data ) ; } ) ; if ( DEBUG_COLLECTED_DEVICE_DATA ) { console . log ( 'Connection Type' , self . curatedDevice . savedAttributes . connectionTypeName ) ; console . log ( 'Serial Number' , self . curatedDevice . savedAttributes . serialNumber ) ; console . log ( 'Read Data' , self . curatedDevice . getDevice ( ) . handle , ':' ) ; console . log ( vals ) ; } }
This is a "debugging" function that prints out the important attributes of the data being queried from a device.
This is a debugging function that prints out the important attributes of the data being queried from a device .