CreateFeature
Top  Previous  Next

Description

Creates a GenICam feature with the specified name, type and access mode.

[C++]
int
 CreateFeature (unsigned short type, const char* name, const char* category, unsigned short access,  
   const
 char* description = NULL, unsigned short namespace = FEATURE_NAMESPACE_STANDARD);


Parameters
[C/C++]

[in] unsigned short type  
Type of the feature to be created. Can be one of the following values:  
FEATURE_TYPE_UINTEGER - unsigned 32-bit integer feature, maps to a slider with value, minimum, maximum and increment  
FEATURE_TYPE_INTEGER - signed 32-bit integer feature, maps to a slider with value, min, maximum, increment and physical unit  
FEATURE_TYPE_INTEGER64 - signed 62-bit integer feature, maps to a slider with value, min, maximum, increment and physical unit  
FEATURE_TYPE_FLOAT - floating point 32-bit feature, maps to a slider with value, minimum, maximum and physical unit  
FEATURE_TYPE_STRING - string feature, maps to an edit box showing a string of text  
FEATURE_TYPE_BOOLEAN - boolean feature, maps to a check box  
FEATURE_TYPE_COMMAND - command feature, maps to a command button  
FEATURE_TYPE_ENUMERATION - enumeration feature, maps to dropdown box with a list of selectable items  
 
[in] const char* name  
Name of the feature to be created. Must not be NULL or empty.  
 
[in] const char* category  
GenICam category under which the feature will be created. This parameter should be either "Root" or the name of the existing category created via CreateCategory.  

[in] unsigned short access  
Access mode for the feature to be created. Can be one of the following values:  
FEATURE_ACCESS_NA - feature is not available  
FEATURE_ACCESS_RO - feature is available only for reading  
FEATURE_ACCESS_WO - feature is available only for writing  
FEATURE_ACCESS_RW - feature is fully available  
 
[in] const char* description  
String containing the description of the feature.  
 
[in] unsigned short namespace  
Namespace to which the feature will belong. Can be one of the following values:  
FEATURE_NAMESPACE_STANDARD - feature will be created with the "Standard" namespace tag (recommended for features which follow the GenICam SFNC specifications).  
FEATURE_NAMESPACE_CUSTOM - feature will be created with the "Custom" namespace tag (recommended for features with proprietary names).  
 

Return Values

S_OK  
Success  
E_FAIL  
Failure  
E_NOINTERFACE  
Category does not exist  
E_INVALIDARG  
Wrong feature type or access  
 
 
Example

This fragment of code instantiates a camera object, creates an integer and enumerated features and sets up their attributes :

static CGevCamera* m_pCamera;  
m_pCamera = createCamera();  
 
m_pCamera->CreateFeature(FEATURE_TYPE_INTEGER, "TestFeatureInt", "Root", FEATURE_ACCESS_RW, "GigESim demo feature");  
m_pCamera->SetFeatureRange("TestFeatureInt", 0, 1000, 1);  
 
m_pCamera->CreateFeature(FEATURE_TYPE_ENUMERATION, "TestFeatureEnum", "Root", FEATURE_ACCESS_RW);  
m_pCamera->AddEnumEntry("TestEnumFeature", "First item", 1);  
m_pCamera->AddEnumEntry("TestFeatureEnum", "Second item", 2);  
m_pCamera->AddEnumEntry("TestFeatureEnum", "Third item", 3);  


Remarks


Use this method to assign features to your virtual camera object. The assigned features will be exposed to GigE Vision client applications allowing them to remotely control parameters of the virtual camera.

The camera must be in the disconnected state in order for this method to work.

The creation of a feature should be followed by setting up its parameters. See SetFeatureRange, AddEnumEntry, SetFeatureIntValue, SetFeatureStingValue, SetFeatureElement, for more details.

Note that there are seven features mandatory for all GigE Vision cameras. They are created automatically along with a virtual camera object and therefore they do not require separate calls to CreateFeature. Those features are:

Standard Feature
Type
Default Value
Width
Integer
640
Height
Integer
480
PayloadSize
Integer
SizeX * SizeY
PixelFormat
Enumerated
"Mono8"
AcquisitionMode
Enumerated
Continuous
AcquisitionStart
Command
N/A
AcquisitionStop
Command
N/A


The default values of the mandatory features can be modified by calling SetImageSize and SetPixelFormat.

It is recommended to change the version of your virtual camera device each time you modify the set of features (see SetDeviceInfo). If this is not done, a client GigE Vision application may use a copy of an old XML information file from its cache folder and remain unaware of your changes. If you do not want to use the device version control, make sure to locate an XML cache folder of your client application and delete an XML file in it each time the set of features of the virtual camera has been modified. This should be done on each computer running the client software.