lib/temp_files/oa_managed_device.js
function innerCollectDeviceData(infoToCache) {
        var defered = q.defer();
        self.dataCollectionDefered = defered;

        self.log('Collecting Data from a handle', self.handle);
        
        // Indicate that this device was opened by the device scanner.
        self.openedByScanner = true;

        var deviceHandle = self.handle;
        var dt = self.openParameters.deviceType;
        var ct = self.openParameters.connectionType;
        var id = self.openParameters.identifier;

        // Initialize a curated device object.
        self.curatedDevice = new device_curator.device();

        // Link the device handle to the curated device object.
        self.curatedDevice.linkToHandle(deviceHandle, dt, ct, id)
        .then(function finishedLinkingHandle(res) {
            self.log(
                'Finished linking to a handle',
                deviceHandle,
                self.curatedDevice.savedAttributes.connectionTypeName
            );
            
            // Create a data collection timeout.
            var collectionTimeout = setTimeout(
                deviceHandleDataCollectionTimeout,
                DEVICE_DATA_COLLECTION_TIMEOUT
            );

            // Attach event listeners to the curated device.
            linkToCuratedDeviceEvents();
            console.log('reading multiple...', deviceHandle);
            // Collect information from the curated device.
            self.curatedDevice.iReadMultiple(infoToCache)
            .then(function finishedCollectingData(results) {
                // Clear the data collection timeout
                clearTimeout(collectionTimeout);

                self.log('Collecting data from a handle', deviceHandle);
                printCollectedDeviceData(results);
                saveCollectedDeviceData(results);

                // Report that the device is finished collecting data.
                stopCollectingDeviceData();
            }, function(err) {
                self.log('Error collecting data from a handle', deviceHandle, err);

                // Report that the device is finished collecting data.
                stopCollectingDeviceData();
            });
        }, function errorLinkingHandle(err) {
            console.error('Error linking to handle...');
            defered.resolve();
        });
        return defered.promise;
    }
function innerCollectDeviceData(infoToCache) {
        var defered = q.defer();
        self.dataCollectionDefered = defered;

        self.log('Collecting Data from a handle', self.handle);
        
        // Indicate that this device was opened by the device scanner.
        self.openedByScanner = true;

        var deviceHandle = self.handle;
        var dt = self.openParameters.deviceType;
        var ct = self.openParameters.connectionType;
        var id = self.openParameters.identifier;

        // Initialize a curated device object.
        self.curatedDevice = new device_curator.device();

        // Link the device handle to the curated device object.
        self.curatedDevice.linkToHandle(deviceHandle, dt, ct, id)
        .then(function finishedLinkingHandle(res) {
            self.log(
                'Finished linking to a handle',
                deviceHandle,
                self.curatedDevice.savedAttributes.connectionTypeName
            );
            
            // Create a data collection timeout.
            var collectionTimeout = setTimeout(
                deviceHandleDataCollectionTimeout,
                DEVICE_DATA_COLLECTION_TIMEOUT
            );

            // Attach event listeners to the curated device.
            linkToCuratedDeviceEvents();
            console.log('reading multiple...', deviceHandle);
            // Collect information from the curated device.
            self.curatedDevice.iReadMultiple(infoToCache)
            .then(function finishedCollectingData(results) {
                // Clear the data collection timeout
                clearTimeout(collectionTimeout);

                self.log('Collecting data from a handle', deviceHandle);
                printCollectedDeviceData(results);
                saveCollectedDeviceData(results);

                // Report that the device is finished collecting data.
                stopCollectingDeviceData();
            }, function(err) {
                self.log('Error collecting data from a handle', deviceHandle, err);

                // Report that the device is finished collecting data.
                stopCollectingDeviceData();
            });
        }, function errorLinkingHandle(err) {
            console.error('Error linking to handle...');
            defered.resolve();
        });
        return defered.promise;
    }
function innerCollectDeviceData ( infoToCache ) { var defered = q . defer ( ) ; self . dataCollectionDefered = defered ; self . log ( 'Collecting Data from a handle' , self . handle ) ; // Indicate that this device was opened by the device scanner. self . openedByScanner = true ; var deviceHandle = self . handle ; var dt = self . openParameters . deviceType ; var ct = self . openParameters . connectionType ; var id = self . openParameters . identifier ; // Initialize a curated device object. self . curatedDevice = new device_curator . device ( ) ; // Link the device handle to the curated device object. self . curatedDevice . linkToHandle ( deviceHandle , dt , ct , id ) . then ( function finishedLinkingHandle ( res ) { self . log ( 'Finished linking to a handle' , deviceHandle , self . curatedDevice . savedAttributes . connectionTypeName ) ; // Create a data collection timeout. var collectionTimeout = setTimeout ( deviceHandleDataCollectionTimeout , DEVICE_DATA_COLLECTION_TIMEOUT ) ; // Attach event listeners to the curated device. linkToCuratedDeviceEvents ( ) ; console . log ( 'reading multiple...' , deviceHandle ) ; // Collect information from the curated device. self . curatedDevice . iReadMultiple ( infoToCache ) . then ( function finishedCollectingData ( results ) { // Clear the data collection timeout clearTimeout ( collectionTimeout ) ; self . log ( 'Collecting data from a handle' , deviceHandle ) ; printCollectedDeviceData ( results ) ; saveCollectedDeviceData ( results ) ; // Report that the device is finished collecting data. stopCollectingDeviceData ( ) ; } , function ( err ) { self . log ( 'Error collecting data from a handle' , deviceHandle , err ) ; // Report that the device is finished collecting data. stopCollectingDeviceData ( ) ; } ) ; } , function errorLinkingHandle ( err ) { console . error ( 'Error linking to handle...' ) ; defered . resolve ( ) ; } ) ; return defered . promise ; }
Link supplied device handle to the curated device object and collect the required information from the device.
Link supplied device handle to the curated device object and collect the required information from the device .