This example explores retrieving information from all major node types on the camera. This includes string, integer, float, boolean, command, enumeration, category, and value types. Looping through multiple child nodes is also covered. A few node types are not covered - base, port, and register - as they are not fundamental. The final node type - enumeration entry - is explored and printed for nodes whose parent node is a selector node.
Once comfortable with NodeMapInfo, we suggest checking out ImageFormatControl and Exposure. ImageFormatControl explores customizing image settings on a camera while Exposure introduces the standard structure of configuring a device, acquiring some images, and then returning the device to a default state.
#include <iostream>
#include <sstream>
using namespace std;
{
};
void Indent(
unsigned int level)
{
for (unsigned int i = 0; i < level; i++)
{
cout << " ";
}
}
{
int result = 0;
try
{
if (node->IsSelector() && (node->GetPrincipalInterfaceType() ==
intfIEnumeration))
{
}
gcstring displayName = ptrValueNode->GetDisplayName();
gcstring value = ptrValueNode->ToString();
{
}
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrStringNode->GetDisplayName();
gcstring value = ptrStringNode->GetValue();
{
}
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrIntegerNode->GetDisplayName();
int64_t value = ptrIntegerNode->GetValue();
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrFloatNode->GetDisplayName();
double value = ptrFloatNode->GetValue();
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrBooleanNode->GetDisplayName();
gcstring value = (ptrBooleanNode->GetValue() ?
"true" :
"false");
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrCommandNode->GetDisplayName();
gcstring tooltip = ptrCommandNode->GetToolTip();
{
}
cout << displayName << ": " << tooltip << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
if (node->IsSelector())
{
}
CEnumEntryPtr ptrEnumEntryNode = ptrEnumerationNode->GetCurrentEntry();
gcstring displayName = ptrEnumerationNode->GetDisplayName();
gcstring currentEntrySymbolic = ptrEnumEntryNode->GetSymbolic();
cout << displayName << ": " << currentEntrySymbolic << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
{
{
}
{
switch (node->GetPrincipalInterfaceType())
{
{
}
{
}
{
}
{
}
{
}
{
}
default:
{
cout << "Unexpected interface type." << endl;
return -1;
}
}
}
default:
{
cout << "Unexpected read type." << endl;
return -1;
}
}
}
{
int result = 0;
try
{
FeatureList_t selectedFeatures;
node->GetSelectedFeatures(selectedFeatures);
ptrSelectorNode->GetSymbolics(entries);
CEnumEntryPtr ptrCurrentEntry = ptrSelectorNode->GetCurrentEntry();
gcstring displayName = ptrSelectorNode->GetDisplayName();
gcstring currentEntrySymbolic = ptrSelectorNode->ToString();
cout << displayName << ": " << currentEntrySymbolic << endl;
for (size_t i = 0; i < entries.size(); i++)
{
CEnumEntryPtr selectorEntry = ptrSelectorNode->GetEntryByName(entries[i]);
FeatureList_t::const_iterator it;
{
{
ptrSelectorNode->SetIntValue(selectorEntry->GetValue());
cout << displayName << ": " << ptrSelectorNode->ToString() << endl;
}
}
for (it = selectedFeatures.begin(); it != selectedFeatures.end(); ++it)
{
{
continue;
}
else
{
result = result |
PrintNode(ptrFeatureNode, level + 2);
}
}
}
{
ptrSelectorNode->SetIntValue(ptrCurrentEntry->GetValue());
}
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrCategoryNode->GetDisplayName();
cout << displayName << endl;
FeatureList_t features;
ptrCategoryNode->GetFeatures(features);
FeatureList_t::const_iterator it;
for (it = features.begin(); it != features.end(); ++it)
{
{
continue;
}
if (ptrFeatureNode->GetPrincipalInterfaceType() ==
intfICategory)
{
}
else
{
result = result |
PrintNode(ptrFeatureNode, level + 1);
}
}
cout << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
unsigned int level = 0;
try
{
cout << endl << "*** PRINTING TRANSPORT LAYER DEVICE NODEMAP ***" << endl << endl;
INodeMap& genTLNodeMap = cam->GetTLDeviceNodeMap();
cout << "*** PRINTING TL STREAM NODEMAP ***" << endl << endl;
INodeMap& nodeMapTLStream = cam->GetTLStreamNodeMap();
cout << "*** PRINTING GENICAM NODEMAP ***" << endl << endl;
cam->Init();
INodeMap& appLayerNodeMap = cam->GetNodeMap();
cam->DeInit();
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
cout << "Application build date: " << __DATE__ << " " << __TIME__ << endl << endl;
const LibraryVersion spinnakerLibraryVersion = system->GetLibraryVersion();
cout <<
"Spinnaker library version: " << spinnakerLibraryVersion.
major <<
"." << spinnakerLibraryVersion.
minor
<<
"." << spinnakerLibraryVersion.
type <<
"." << spinnakerLibraryVersion.
build << endl
<< endl;
unsigned int numCameras = camList.
GetSize();
cout << "Number of cameras detected: " << numCameras << endl << endl;
if (numCameras == 0)
{
system->ReleaseInstance();
cout << "Not enough cameras!" << endl;
cout << "Done! Press Enter to exit..." << endl;
getchar();
return -1;
}
for (unsigned int i = 0; i < numCameras; i++)
{
cout << endl << "Running example for camera " << i << "..." << endl;
cout << "Camera " << i << " example complete..." << endl << endl;
}
pCam = nullptr;
system->ReleaseInstance();
cout << endl << "Done! Press Enter to exit..." << endl;
getchar();
return result;
}