User`s guide
Creating Stub Implementation of Your Adaptor Class
4-7
Exported Functions” on page 3-2. This is needed because the createInstance()
exported function instantiates an object of this class.
#include "MyDeviceAdaptor.h"
6
Edit the stub implementations of the createInstance() function, also in the
exported functions source file, mydevice_exported_fcns.cpp. Make the function
instantiate an object of your adaptor class, highlighted in italics below. (In the stub,
it returns NULL.)
void getDeviceAttributes(const imaqkit::IDeviceInfo* deviceInfo,
const char* formatName,
imaqkit::IPropFactory* devicePropFact,
imaqkit::IVideoSourceInfo* sourceContainer,
imaqkit::ITriggerInfo* hwTriggerInfo){
// Create a video source
sourceContainer->addAdaptorSource("MyDeviceSource", 1);
}
imaqkit::IAdaptor* createInstance(imaqkit::IEngine* engine,
imaqkit::IDeviceInfo* deviceInfo,
char* formatName){
imaqkit::IAdaptor* adaptor = new
MyDeviceAdaptor(engine,deviceInfo,formatName);
return adaptor;
}
7
Build the adaptor DLL. Select the Build Solution option on the Build menu.
8
Start the MATLAB software.
9
Call the imaqhwinfo function. Note how the adaptor, named mydeviceimaq, is
included in the list of available adaptors returned by imaqhwinfo. If you have not
previously registered your adaptor DLL, register your adaptor with the toolbox —
see “Registering an Adaptor with the Toolbox” on page 1-10. To view more detailed
information about your adaptor, call imaqhwinfo again with this syntax:
dev_info = imaqhwinfo('mydeviceimaq');
10
Create a video input object for the mydeviceimaq adaptor, using the videoinput
function.