OpenDriver
Opens a connection to the specified device number. The number of available devices ( PCI boards ) can be determined by a call to GetDeviceBindingCount(). For example, if there are two ARC PCI boards in the system, then GetDeviceBindingCount() will return 2 and OpenDriver() may be called with either 0 or 1. The second version of this method also attempts to allocate the kernel image buffer with the specified size ( in bytes ) by including a call to the MapDriver() method.
Syntax
void OpenDriver( deviceNumber );
void OpenDriver( deviceNumber, bytes );
Parameters
long deviceNumber
The device number of the driver/PCI board to open.
unsigned long bytes
The size of the kernel image buffer to allocate ( in bytes ).
Returns
None
Required Headers
CController.h
Namespace
arc
Throws
std::runtime_error
Remarks
The GetDeviceBindings() method must be called first, or OpenDriver() will fail. Exceptions can be caught using a try/catch block.
Example
        // This code demonstrates how to open driver 0.

        #include <iostream.h>
        #include "CController.h"
        using namespace std;
        using namespace arc;

        CController cController;

        try {
            // This MUST be called first!
            cController.GetDeviceBindings();

            if ( cController.GetDeviceBindingCount() <= 0 )
                throw std::runtime_error( "Failed to find any ARC devices!" );
 
            cController.OpenDriver( 0 );

            // .... do something here ....

            // Close the driver when we're all done.
            cController.CloseDriver();
        }
        catch ( std::exception &e )
        {
            cerr << "Exception Occurred: " << e.what() << endl;
        }

© Astronomical Research Cameras, Inc.