IDS Peak comfortSDK, genericSDK, IPL, and AFL developer manuals are external documents. Please contact us if you need them.
Querying the current camera name
comfortC
|
size_t userDefinedNameSize = 0;
status = peak_Camera_UserDefinedName_Get(hCam, NULL, &userDefinedNameSize);
if (PEAK_SUCCESS(status))
{
char* userDefinedName = NULL;
userDefinedName = (char*)malloc(userDefinedNameSize);
if (userDefinedName)
{
status = peak_Camera_UserDefinedName_Get(hCam, userDefinedName, &userDefinedNameSize);
if (PEAK_SUCCESS(status))
{
// ...
}
free(userDefinedName);
}
}
|
genericC++
|
std::string name = nodemapRemoteDevice->FindNode<peak::core::nodes::StringNode>("DeviceUserID")->Value();
|
Setting a camera name, e.g. "camera1"
comfortC
|
status = peak_Camera_UserDefinedName_Set(hCam, “camera1”);
if (PEAK_ERROR(status))
{
// Error handling
}
|
genericC++
|
nodemapRemoteDevice->FindNode<peak::core::nodes::StringNode>("DeviceUserID")->SetValue("camera1");
|
Querying the maximum possible length of the string
genericC++
|
auto length = nodemapRemoteDevice->FindNode<peak::core::nodes::StringNode>("DeviceUserID")->MaximumLength();
|
Complete example
try
{
std::string name = "camera1";
auto maxLength = nodemapRemoteDevice->FindNode<peak::core::nodes::StringNode>("DeviceUserID")->MaximumLength();
if (name.length() <= maxLength)
{
nodemapRemoteDevice->FindNode<peak::core::nodes::StringNode>("DeviceUserID")->SetValue(name);
}
}
catch (const std::exception& e)
{
// ...
}
|
try
{
var name = "camera1";
var maxLength = nodeMapRemoteDevice.FindNode<peak.core.nodes.StringNode>("DeviceUserID").MaximumLength();
if (name.Length <= maxLength)
{
nodeMapRemoteDevice.FindNode<peak.core.nodes.StringNode>("DeviceUserID").SetValue(name);
}
}
catch (Exception e)
{
// ...
}
|
try:
name = "camera1"
max_length = node_map_remote_device.FindNode("DeviceUserID").MaximumLength()
if len(name) <= max_length:
node_map_remote_device.FindNode("DeviceUserID").SetValue(name)
except Exception as e:
# ...
|