GigE |
GigE |
Syntax
INT is_IpConfig (INT iID, UEYE_ETH_ADDR_MAC mac, UINT nCommand, void* pParam, UINT cbSizeOfParam)
Description
is_IpConfig() allows configuring the IP settings of GigE uEye cameras and the associated GigE network adapters (see IDS Camera Manager).
1.If a persistent IP address is configured for a GigE camera, it will be used (if free).
2.If no persistent IP address is configured for a GigE camera, the IP address is obtained via DHCP (if DHCP is enabled and a DHCP server is available).
3.If no persistent IP address is configured for a GigE camera and DHCP is not possible, an IP address is obtained from the IP address range for automatic IP configuration.
Note on calling the function The is_IpConfig() function does not accept a camera handle in the iID parameter. In the call, please use the internal device ID as described below. |
Assigning a persistent IP address to GigE uEye cameras
If you set a persistent IP address, the address is permanently stored in camera memory. The persistent IP address is retained even after the camera is disconnected from the power supply. When connecting the camera to a different PC, make sure the persistent IP address is valid on that PC, as well. If you set the persistent IP address to 0.0.0.0, the camera is configured for automatic assignment of the IP address (see below).
Note on setting persistent IP addresses Persistent IP addresses can only be set for cameras that have not been initialized (see also Pairing). |
Configuring automatic IP assignment by the network adapter
You can also configure connected GigE uEye cameras to automatically obtain the IP address from the network adapter (see above). To use this feature, you need to define a suitable IP address range for the network adapter. When pairing a GigE uEye camera with the IP address 0.0.0.0, the uEye driver automatically assigns a free IP address to the camera.
Note on using GigE uEye cameras on a DHCP network If a DHCP server is running on the network, you need to ensure when configuring the network adapter that the manually assigned address range of the uEye driver is outside the DHCP range. |
Obtaining the IP address from a DHCP server
In order to use the DHCP functionality, the camera must be operated with firmware version 4.95 or higher. For a camera with a firmware version lower than 4.95, the starter firmware must be updated first, e.g. in IDS Camera Manager via the "Starter Firmware Upload" button.
The nCommand input parameter is used to select the function mode. The pParam input parameter depends on the selected function mode. If you select functions for setting or returning a value, pParam contains a pointer to a variable of the UINT type. The size of the memory area to which pParam refers is specified in the cbSizeOfParam input parameter.
Input parameters
iID |
Device ID of the camera. You can query the camera's device ID with the is_GetCameraList() function. Pass iID = -1 to address the camera or network adapter by its MAC address (recommended). |
mac |
If iID = -1: Variable of type UEYE_ETH_ADDR_MAC containing the MAC address of the camera or network adapter in hexadecimal format. |
pParam |
Pointer to a function parameter, whose function depends on nCommand. |
cbSizeOfParam |
Size (in bytes) of the memory area to which pParam refers. |
Contents of the IPCONFIG_CAPABILITY_FLAGS enumeration
INT |
IPCONFIG_CAP_PERSISTENT_IP_SUPPORTED |
Setting a persistent IP address is supported |
INT |
IPCONFIG_CAP_AUTOCONFIG_IP_SUPPORTED |
Automatic IP configuration by the network adapter is supported |
INT |
IPCONFIG_CAP_DHCP_SUPPORTED |
Obtaining the IP address from a DHCP server is supported. |
Contents of the UEYE_ETH_ADDR_MAC structure
BYTE |
abyOctet[6] |
MAC address in hexadecimal format |
Contents of the UEYE_ETH_IP_CONFIGURATION structure
UEYE_ETH_ADDR_IPV4 |
ipAddress |
IPv4 address in hexadecimal format (little-endian) If you set ipAddress = 0x00000000 (IP address 0.0.0.0), the camera is configured for automatic assignment of the IP address |
UEYE_ETH_ADDR_IPV4 |
ipSubnetmask |
IPv4 subnet mask in hexadecimal format (little-endian) |
BYTE |
reserved[4] |
Reserved |
Contents of the UEYE_ETH_AUTOCFG_IP_SETUP Structure
UEYE_ETH_ADDR_IPV4 |
ipAutoCfgIpRangeBegin |
First IPv4 address of the auto configuration range in hexadecimal format (little-endian) |
UEYE_ETH_ADDR_IPV4 |
ipAutoCfgIpRangeEnd |
Last IPv4 address of the auto configuration range in hexadecimal format (little-endian) |
BYTE |
reserved[4] |
Reserved |
Return values
IS_ACCESS_VIOLATION |
An access violation has occurred. The camera ID cannot be changed because e.g. the camera is running in the boot-boost mode. |
IS_INVALID_PARAMETER |
One of the submitted parameters is outside the valid range or is not supported for this sensor or is not available in this mode. |
IS_IO_REQUEST_FAILED |
An IO request from the uEye driver failed. Possibly the versions of the ueye_api.dll (API) and the driver file (ueye_usb.sys or ueye_eth.sys) do not match. |
IS_NO_SUCCESS |
General error message |
IS_NOT_SUPPORTED |
The camera model used here does not support this function or setting. (return value for USB 2.0 cameras) |
IS_SUCCESS |
Function executed successfully |
Example
void example_is_IpConfig()
{
INT nRet = IS_SUCCESS;
INT iDeviceID = -1;
UEYE_ETH_ADDR_MAC devicemac = { 0, 0, 0, 0, 0, 0 };
if (I_know_the_device_id)
{
/* Note that the device id may have changed after reconnection of the device. */
iDeviceID = my_device_id;
}
else if (I_know_the_device_mac)
{
memcpy(devicemac, my_device_mac, sizeof(UEYE_ETH_ADDR_MAC));
}
else if (I_know_the_device_serno)
{
/* is_IpConfiguration currently supports device id or device mac for identification of
* the device of interest.
* In this case that I know some identifying detail other than device id or device mac,
* I have to acquire the device list and look up the device of interest.
* If found I use it's device id for addressing.
*/
/* first query the number of cameras. */
int nCams = 0;
nRet = is_GetNumberOfCameras(&nCams);
if (nRet != IS_SUCCESS)
{
/* error handling here. */
}
/* get the camera list */
UEYE_CAMERA_LIST* pCamList = 0;
if (nCams >= 1)
{
/* allocate memory for the camera count + the camera info's */
pCamList = (UEYE_CAMERA_LIST*) new char[sizeof(DWORD) +
(nCams * sizeof(UEYE_CAMERA_INFO))];
pCamList->dwCount = nCams;
/* query the camera list */
nRet = is_GetCameraList(pCamList);
if (nRet != IS_SUCCESS)
{
/* error handling here */
}
}
/* scan the camera list for the device with the matching identifier. */
if (pCamList != 0)
{
int i = 0;
for (i = 0; i < (int)pCamList->dwCount; i++)
{
/* test for the identifier to match
* Note: Here the serial number is used for identification. I could also
* use the camera id or any other field of the UEYE_CAMERA_INFO datatype.
*/
if (memcmp(pCamList->uci[i].SerNo, my_serial_number, sizeof(my_serial_number)) == 0)
{
/* found the camera with the matching identifier */
/* copy device id */
iDeviceID = pCamList->uci[i].dwDeviceID;
/* stop searching */
break;
}
}
}
/* cleanup */
delete [] pCamList;
}
/* query ip config caps */
UINT uCaps = 0;
nRet = is_IpConfig(iDeviceID, devicemac, IPCONFIG_CMD_QUERY_CAPABILITIES,
&uCaps, sizeof(UINT));
if (nRet != IS_SUCCESS)
{
/* error handling here. */
}
/* test for persistent ip feature to be supported */
if ((uCaps & IPCONFIG_CAP_PERSISTENT_IP_SUPPORTED) == IPCONFIG_CAP_PERSISTENT_IP_SUPPORTED)
{
UEYE_ETH_IP_CONFIGURATION ipcfg;
/* query the persistent ip setting of the device */
memset(&ipcfg, 0, sizeof(UEYE_ETH_IP_CONFIGURATION));
nRet = is_IpConfig(iDeviceID, devicemac, IPCONFIG_CMD_GET_PERSISTENT_IP,
&ipcfg, sizeof(UEYE_ETH_IP_CONFIGURATION));
if (nRet != IS_SUCCESS)
{
/* error handling here. */
}
/* set the persistent ip of the device to 192.168.10.2/24 */
memset(&ipcfg, 0, sizeof(UEYE_ETH_IP_CONFIGURATION));
/* note: provide the addresses in hex format (little-endian) */
ipcfg.ipAddress.dwAddr = 0x020aa8c0;
ipcfg.ipSubnetmask.dwAddr = 0x00ffffff;
nRet = is_IpConfig(iDeviceID, devicemac, IPCONFIG_CMD_SET_PERSISTENT_IP,
&ipcfg, sizeof(UEYE_ETH_IP_CONFIGURATION));
if (nRet != IS_SUCCESS)
{
/* error handling here. */
}
}
/* test for ip auto configuration feature to be supported */
if ((uCaps & IPCONFIG_CAP_AUTOCONFIG_IP_SUPPORTED) == IPCONFIG_CAP_AUTOCONFIG_IP_SUPPORTED)
{
UEYE_ETH_AUTOCFG_IP_SETUP ipautocfg;
/* query the ip auto configuration setting for the device */
memset(&ipautocfg, 0, sizeof(UEYE_ETH_AUTOCFG_IP_SETUP));
/* note: use IPCONFIG_CMD_GET_AUTOCONFIG_IP_BYDEVICE here as it takes device identifiers.
* alternatively IPCONFIG_CMD_GET_AUTOCONFIG_IP can be used with a network adapter
* identifier, i.e. adapter id or adapter mac.
*/
nRet = is_IpConfig(iDeviceID, devicemac, IPCONFIG_CMD_GET_AUTOCONFIG_IP_BYDEVICE,
&ipautocfg, sizeof(UEYE_ETH_AUTOCFG_IP_SETUP));
if (nRet != IS_SUCCESS)
{
/* error handling here. */
}
/* set the ip auto configuration range for the device to (192.168.10.15,192.168.10.35) */
memset(&ipautocfg, 0, sizeof(UEYE_ETH_AUTOCFG_IP_SETUP));
/* note: provide the addresses in hex format (little-endian) */
ipautocfg.ipAutoCfgIpRangeBegin.dwAddr = 0x0f0aa8c0;
ipautocfg.ipAutoCfgIpRangeEnd.dwAddr = 0x230aa8c0;
/* note: use IPCONFIG_CMD_SET_AUTOCONFIG_IP_BYDEVICE here as it takes device identifiers.
* alternatively IPCONFIG_CMD_SET_AUTOCONFIG_IP can be used with a network adapter
* identifier, i.e. adapter id or adapter mac.
*/
nRet = is_IpConfig(iDeviceID, devicemac, IPCONFIG_CMD_SET_AUTOCONFIG_IP_BYDEVICE,
&ipcfg, sizeof(UEYE_ETH_AUTOCFG_IP_SETUP));
if (nRet != IS_SUCCESS)
{
/* error handling here. */
}
}
}