User`s guide
3 Providing Hardware Information
3-4
Creating a Stub Adaptor
The easiest way to start building an adaptor is to create a stub implementation, compile
and link it, and then test your work. This method can be effective because it provides
immediate results and lets you verify that your build environment is setup properly.
This section shows a stub implementations of an adaptor that you can copy and paste
into a file in your adaptor Microsoft Visual C++ project. After compiling and linking this
code, you can see your adaptor included in the list of available adaptors returned by the
imaqhwinfo function.
Note You will not be able to instantiate an object of your adaptor class, however. That is
described in “Defining Your Adaptor Class” on page 4-2.
To create a stub adaptor, follow this procedure:
1
Add a C++ source file to the adaptor C++ project. See “Setting up a Build
Environment on Windows Systems” on page 2-2 for information about creating
an adaptor C++ project. This source file will hold your implementations of your
adaptor's exported C++ functions. You can give this file any name. This example
uses the name of the adaptor for this file, with the text string "_exported_fcns"
appended to it, mydevice_exported_fcns.cpp
2
Copy the following lines of C++ code into this new file. This code provides stub
implementations of the required adaptor exported functions. Note that you must
include the adaptor kit header file mwadaptorimaq.h. This header file includes
all other required adaptor kit header files. The getDeviceAttributes() stub
defines a video source—see “Identifying Video Sources” on page 4-9 for more
information.
#include "mwadaptorimaq.h"
void initializeAdaptor(){
}
void getAvailHW(imaqkit::IHardwareInfo* hardwareInfo){
}
void getDeviceAttributes(const imaqkit::IDeviceInfo* deviceInfo,