User`s guide

Creating Device Properties
6-5
Creating Device Properties
To define properties for a device, follow this procedure:
1
Create the property using the appropriate IPropFactory member function for
the data type. The engine passes in a handle to a IPropFactory object to the
getDeviceAttributes() function.
For example, to create a property of type double, use the
createDoubleProperty() method of the IPropFactory object, specifying the
property name and default value as arguments.
hprop = devicePropFact->createDoubleProperty("Brightness",100)
The IPropFactory class supports functions to create properties of various data
types — see “Selecting the Property Creation Function” on page 6-5.
2
Specify if a user can modify the property, using the setPropReadOnly()
method of the IPropFactory object. Use one of the following constants
(defined in IEngine.h): READONLY_ALWAYS, READONLY_NEVER, and
READONLY_WHILE_RUNNING. For example,
devicePropFact->setPropReadOnly(hProp,
imaqkit::propreadonly::READONLY_WHILE_RUNNING);
3
Add the property to the device-specific property container, using the
addProperty() method of the IPropFactory object. For example,
devicePropFact->addProperty(hProp);
where hProp is a handle to the property you created in step 1.
Selecting the Property Creation Function
The IPropFactory() object supports functions that you can use to create properties of
various data types, including:
int
double
string
Enumerated types