Debugging

GigE Vision cameras constantly listen for special network packets, called heartbeats, sent by the host at a known frequency. The purpose of these packets is to keep the connection alive; if the camera doesn’t receive a heartbeat within a given timeout, it will consider the connection lost and disconnect itself.

ItalaApi automatically sends these heartbeats to keep the camera alive. However, if an application using the API is paused (e.g., when a breakpoint is hit during debugging), the heartbeat thread is also paused. This can cause the camera to self-disconnect.

To prevent this, it is recommended to extend the heartbeat timeout when debugging. This allows for longer pauses in the process without losing the connection. The custom feature oeCcHeartbeatRate, available from the GenTL Device module’s nodemap (not the physical device’s nodemap), can be used for this purpose.

The following example demonstrates how to set the heartbeat timeout to 30 seconds (30,000 milliseconds).

// Get the "oeCcHeartbeatRate" custom feature from the TL Device nodemap
GenApi::CIntegerPtr pOeHeartbeatTimeout =
  pDevice->GetTLDeviceNodeMap().GetNode("oeCcHeartbeatRate");

// Set the heartbeat to 30 seconds
pOeHeartbeatTimeout->SetValue(30000);
// Get the "oeCcHeartbeatRate" custom feature from the TL Device nodemap
H_NODE hOeHeartbeatTimeout = NULL;
error = NODEMAP_GetNode(hNodeMap, "oeCcHeartbeatRate", &hOeHeartbeatTimeout);

// Set the heartbeat to 30 seconds
error = NODE_IntegerSetValue(hOeHeartbeatTimeout, 30000);
// Get the "oeCcHeartbeatRate" custom feature from the TL Device nodemap
GenApi.IInteger oeCcHeartbeatRate =
    device.GetTLDeviceNodeMap().GetNode<GenApi.IInteger>("oeCcHeartbeatRate");

// Set the heartbeat to 30 seconds
oeCcHeartbeatRate.Value = 30000;
// Get the "oeCcHeartbeatRate" custom feature from the TL Device nodemap
GenApi.IInteger oeCcHeartbeatRate =
    device.GetTLDeviceNodeMap().GetNode<GenApi.IInteger>("oeCcHeartbeatRate");

// Set the heartbeat to 30 seconds
oeCcHeartbeatRate.Value = 30000;
# Get the "oeCcHeartbeatRate" custom feature from the TL Device nodemap
oe_heartbeat_timeout = device.tl_device_node_map.oeCcHeartbeatRate

# Set the heartbeat to 30 seconds
oe_heartbeat_timeout.value = 30000

Warning

If the application is terminated without properly closing the device while a high heartbeat value is set, the camera may consider itself still connected for some time. In this case, the device will be busy and cannot be opened again until the heartbeat timeout expires or it is physically disconnected and reconnected.