User`s guide
6 Defining Device-Specific Properties
6-16
// The new value for double properties.
double _lastDoubleValue;
// The new value for string properties.
char* _lastStrValue;
};
Creating the notify() Function for Your Class
When a user calls the set command to change the value of a property, the engine calls
the notify() function of the set listener class associated with the property.
A set listener class notify() function must accept two parameters:
void notify(IPropInfo* propertyInfo, void* newValue)
• propertyInfo is a handle to an IPropInfo object—The IPropInfo class is the
interface that lets you get information about the property. For example, using
IPropInfo functions you can get the property name, its storage type, and its default
value.
• newValue is a pointer to the new property value—This engine passes this value as
a void*. Your notify() function must cast the value to the appropriate C++ data
type. The following table tells which C++ data type to cast to for all property types
supported by the adaptor kit.
imaqkit::PropertyTypes C++ Data Type
STRING char*
DOUBLE double*
INT int*
DOUBLE_ARRAY imaqkit::PropertyTypes::NDoubles*
INT_ARRAY imaqkit::PropertyTypes::NInts*
Suggested Algorithm for notify() Function
The design of the notify() function varies with the needs of your device and the
facilities offered by its SDK. For example, you can create one set listener class that
handles all value changes for all properties in a particular property container (general
or device-specific). In this case, the notify() function includes a switch statement with
cases that handle each individual property.