TheImagingSource / ic4-examples

IC4 Example Programs
Apache License 2.0
5 stars 3 forks source link

Questions? #3

Closed g40 closed 8 months ago

g40 commented 8 months ago

Hello,

Is this the right place to ask questions? Using the IC4 SDK with some GigE cameras.

Assuming yes then can I get the IP address of a connected unit?

ic4::DeviceInfo provides some details but less than I'd expect.

TIS-Tim commented 8 months ago

Any suggestions and questions are welcome.

The Qt device selection dialog example shows how to extract the IP Address for a device:

https://github.com/TheImagingSource/ic4-examples/blob/efc4808fb3f9640432e3f666488e2e11385a6f97/cpp/qt6/common/qt6-dialogs/DeviceSelectionDialog.cpp#L192-L222

It is a little cumbersome with setting DeviceSelector to the index of the device in the list of devices and then querying GevDeviceIPAddress, but should do the trick.

May I ask what your use case for getting the IP Address is? If you want to remember a unique identifier for a device, DeviceInfo::uniqueName() should be safer, since an IP address might change.

g40 commented 8 months ago

Hello Tim

Thank you for the quick response.

I'd not seen the QT code. I'll check that out.

re the address itself, the use case is one where we might be switching between cameras where all cameras have fixed IP addresses. (set up using the ipconfig_cmd tool)

TIS-Tim commented 8 months ago

If you know the camera's fixed IP address, you can just pass it to deviceOpen (which tries to be smart about the string you pass), e.g.

grabber.deviceOpen("192.168.0.27")

However, in my opinion, using DeviceUserId is often the cleanest solution for that scenario.

g40 commented 8 months ago

Thanks for the tip. I'm using the serial number to open, did not realize IP address worked as well.