Force IP of a GEV-Camera programmatically

Hi,
I’m trying to programmatically set the IP address of a GEV camera.
I tried to set the IP address as described in this post. Unfortunately, an exception is thrown when i run the Cust::IPCfg_SetStatIP command.

After some research, I found someone who had the same problem. That did not work either. Again, an exception is thrown when I try to execute the Cust::IPCfg_SetStatIP.

The strange thing is, when I try to force only the IP, everything looks fine and the value of the “BOOL_IPCFG_Successfull” node is true. However, in the Common Vision Blox Management Console -> Device Configurator, the IP address still does not changed.
Neither the camera nor the network card are defective. I changed the network card and the camera twice. I can successfully set the IP address in Common Vision Blox Management Console -> Device Configurator.

Does anyone have some ideas?

HI @EmKo,

Did you follow the answer given in the post you mentioned?
Please try to first set the IP with the ForceIP command, then rediscover the camera and do the same thing again but with the StatIP command instead :slight_smile:

Thanks for you reply.

I have already followed the instructions as in the answer you marked.
But I used the C ++ Api and not the .Net Api.
ForceIP didn’t set the IP-Address and “BOOL_IPCFG_Successfull” returnd true.
Again executing “IPCfg_SetStatIP” throw an exception with unknown error.

Have now taken the code from this [answer] (Exception during discovery) and copied it one-to-one.
However, I came across another problem.
When I invoke DiscoverGevInterfaces(),
I only see the devices under %CVB%\Drivers.

By the way I’m using CVB version 13.02.002 on Windows 7 (64 bit).

Thank you.

Hey,
with the example (%CVB%Tutorial\Hardware\GenICam\VC\VCGEVForceIP) provided by CVB I managed to change the IP-Address by code. However, I want to use the C++ Api, so I rewrote the ForceIP(…) method and used the C++ methods. But then the example didn’t work anymore. The IP-Address remains the same.

Here are the changes I made:

void ForceIP_CPP(Cvb::DiscoveryInformation& info, const char *Mac, const char *IP, const char *Subnet)
{
    const auto nm_name = L"TLInterface";

    // set the features accordingly
    wchar_t buf[_MAX_U64TOSTR_BASE10_COUNT];

    auto err = _i64tow_s(StringToMac(Mac), buf, _MAX_U64TOSTR_BASE10_COUNT, 10);
    info.SetGenApiFeature(nm_name, L"IPCfg_MAC", buf);

    err = _ui64tow_s(htonl(String2IP(IP)), buf, _MAX_U64TOSTR_BASE10_COUNT, 10);
    info.SetGenApiFeature(nm_name, L"IPCfg_IP", buf);
    err = _ui64tow_s(htonl(String2IP(Subnet)), buf, _MAX_U64TOSTR_BASE10_COUNT, 10);
    info.SetGenApiFeature(nm_name, L"IPCfg_Subnet", buf);

    info.SetGenApiFeature(nm_name, L"Cust::DisableSubnetMatch", L"1");
    info.SetGenApiFeature(nm_name, L"Cust::AllowBroadcastDiscoveryResponse", L"1");

    //Execute ForceIP
    info.SetGenApiFeature(nm_name, L"IPCfg_SetForceIP", L"1");
}
void Mine(int argc, char* argv[])
{
    auto infos = Cvb::DeviceFactory::Discover(Cvb::DiscoverFlags::IgnoreVins | Cvb::DiscoverFlags::UpToLevelInterface);    

    for (auto& info : infos)
    {
        wstring tlType;
        bool res = info.TryGetProperty(Cvb::DiscoveryProperties::InterfaceTLType, tlType);
        wstring tlVendor;
        res = info.TryGetProperty(Cvb::DiscoveryProperties::TransportLayerVendor, tlVendor);
        if (tlType.compare(L"GEV") == 0 && tlVendor.compare(L"GEV"))
        {
            ForceIP_CPP(info, argv[1], argv[2], argv[3]); 
        }
    }
}

Hi @EmKo,

please make sure to follow the instruction in this post step by step and don’t miss anything! There is always an explanation given why the current step is necessary.
You e.g. don’t execute the DeviceUpdateList node.

Anyway, it’s strange that you don’t get any error message at all… :thinking:

1 Like

Hey,
I don’t know why, but this time it worked.
I think i had problems with my firewall.

If I find out something new, I’ll let you know.

Thank you for your help :slight_smile:

1 Like