To create an adaptor, you must implement the C++ routines and the classes required by the adaptor framework. The following outlines one way to develop an adaptor that divides the task into several smaller tasks, called stages. This staged development model has been shown to be an effective way to create an adaptor.
Before you start developing an adaptor, you must gather information about the device (or devices) to help you make design decisions.
Familiarize yourself with adaptors and adaptor development by looking at the demo adaptor which is included with the adaptor kit — see Looking at the Demo Adaptor
Familiarize yourself with your device's SDK. Devices provide the tools you need to access and control them programmatically. You must learn your device's requirements for initialization, startup, and acquiring data, and the SDK functions used to perform these tasks.
Determine what device or devices you want to support with your adaptor. You can create an adaptor to support one particular device, a group of devices offered by a particular vendor, or a group of devices that all support a common interface. You must also determine the formats supported by the device and the properties of the device that you want to make available to users of your adaptor.
You must set up the required adaptor build environment, which includes specifying the names and locations of required header files and libraries. Setting up a Build Environment on Windows Systems provides this information.
In this stage, you start development by creating a stub implementation of your adaptor. Every adaptor must provide the toolbox with information about the device (or devices) it makes available to users. As a first step, you define the labels you want to use to identify the devices available through your adaptor and the formats they support, and you implement the adaptor functions that return this information to users. The toolbox displays these labels to users who must specify the device and format they want to use for an acquisition.
After building this stub implementation of your adaptor DLL
and registering it with the toolbox, you can use the
and verify that the toolbox can find your adaptor and load it. For
more information about this stage, see Using Adaptor Exported Functions.
In this stage, you define your adaptor class and add a stub
implementation of this class to your adaptor project. Every adaptor
must define an adaptor class that is a subclass of the adaptor kit
After building your adaptor DLL, a call to the
instantiates a video input object with your adaptor. For more information,
see Defining Your Adaptor Class.
In this stage, you flesh out the stub implementations of the virtual functions in your adaptor class. After completing this stage, you will be able to acquire data from your device and bring it into the MATLAB® workspace.
In addition, in this step you can also implement support for defining a region-of-interest (ROI) and for using hardware triggering, if your device supports this capability. For more information, see Acquiring Image Data.
In this stage, you decide which properties of the device you want to expose to toolbox users. You make this determination by reading the device's SDK documentation, determining its capabilities, and deciding which capabilities toolbox users will expect to configure. Once you decide to expose a property, you must decide on a name for the property, determine its data type, and, optionally, the range of valid values. As an alternative, you can define device-specific properties in an image device definition file (IMDF). For more information, see Defining Device-Specific Properties.