Hello,
GenICam Browser has an ‘Ignore Subnet Discover’ setting which, when used, sends a GVCP discover command with the ‘allow broadcast acknowledge’ flag set to true.
This is useful if:
- you have a camera with an unknown static IP
- your host has multiple network interfaces, and the camera has been plugged into the wrong one
- DHCP was unsuccessful and the camera fell back to a link-local address
I can’t see any way to do this via the Python API (or the C++ one for that matter) - how should I go about this? DiscoverFlags
is the obvious place to look, but none of the flags seem to provide this setting.
(I’d also like to be able to send a force-IP command with the allow-broadcast-acknowledge flag set, for the same reasons )
Hi @michaelt
A quick example:
auto allInterfaceFlags = Cvb::Driver::DiscoverFlags::UpToLevelInterface | Cvb::Driver::DiscoverFlags::IgnoreGevSD;
auto allInterfaces = Cvb::DeviceFactory::Discover(allInterfaceFlags);
// Let's say your camera is connected to the 4th interface found:
Cvb::Driver::DiscoveryInformation& iface = allInterfaces.at(4);
auto allDevFlags = Cvb::Driver::DiscoverFlags::IgnoreVins | Cvb::Driver::DiscoverFlags::IncludeInaccessible;// | Cvb::Driver::DiscoverFlags::IgnoreGevSD;
iface.SetGenApiFeature("TLInterface", "DisableSubnetMatch", "1");
iface.SetGenApiFeature("TLInterface", "AllowBroadcastDiscoveryResponse", "1");
auto devsFound = Cvb::DeviceFactory::Discover(iface, allDevFlags);
//std::cout << iface[Cvb::Driver::DiscoveryProperties::InterfaceId] << std::endl;
if (devsFound.size() > 0)
{
auto interfaceDevice = Cvb::DeviceFactory::Open(iface.AccessToken());
auto interfaceNM = interfaceDevice->NodeMap(CVB_LIT("TLInterface"));
auto deviceUpdateListNode = interfaceNM->Node<Cvb::CommandNode>(CVB_LIT("DeviceUpdateList"));
auto cfgIPNode = interfaceNM->Node<Cvb::IntegerNode>(CVB_LIT("IPCfg_IP"));
auto cfgSubnetNode = interfaceNM->Node<Cvb::IntegerNode>(CVB_LIT("IPCfg_Subnet"));
auto cfgMacNode = interfaceNM->Node<Cvb::IntegerNode>(CVB_LIT("IPCfg_MAC"));
auto cfgForceNode = interfaceNM->Node<Cvb::CommandNode>(CVB_LIT("IPCfg_SetForceIP"));
auto cfgStaticNode = interfaceNM->Node<Cvb::CommandNode>(CVB_LIT("IPCfg_SetStatIP"));
// make node map aware of the device
deviceUpdateListNode->Execute();
// we want to configure the found device with MAC
// 00-01-0D-C2-43-66
int64_t mac = 0x00010dc24366;
int64_t macReverse = 0x6643c20d0100;
cfgMacNode->SetValue(macReverse);
// New IP 169.254.0.1
cfgIPNode->SetValue(0xa9fe0001);
// Subnet 255.255.0.0
cfgSubnetNode->SetValue(0xFFFF0000);
// Force the new IP
cfgForceNode->Execute();
// make node map aware of new IP
deviceUpdateListNode->Execute();
// permanently write the IP to the camera
cfgStaticNode->Execute();
}
You can read some information like the MAC etc. from an camera in the wrone subnet like so:
auto mac = devsFound.at(0)[Cvb::Driver::DiscoveryProperties::DeviceMac];
Hope this helps!
2 Likes
This is how discovering in Python would look like (no ip setting here):
interface_flags = cvb.DiscoverFlags.UpToLevelInterface | cvb.DiscoverFlags.IgnoreGevSD
all_interfaces = cvb.DeviceFactory.discover_from_root(interface_flags)
broadcast_flags = cvb.DiscoverFlags.IgnoreVins | cvb.DiscoverFlags.IncludeInaccessible | cvb.DiscoverFlags.IgnoreGevSD
all_devices = []
for interface in all_interfaces:
cvb.DiscoveryInformation.set_genapi_feature(interface, "TLInterface", "DisableSubnetMatch", "1")
cvb.DiscoveryInformation.set_genapi_feature(interface, "TLInterface", "AllowBroadcastDiscoveryResponse", "1")
found_devices = cvb.DeviceFactory.discover_from_level(interface.access_token, broadcast_flags)
for dev in found_devices:
all_devices.append(dev)
for dev in all_devices:
# Check devices access status etc.:
# dev.read_property(cvb.DiscoveryProperties.DeviceAccessStatus)
with cvb.DeviceFactory.open(all_devices[0].access_token) as device: # open first camera found (check accessibility before!)
# work with camera...
2 Likes