Home > C: Programming > Function descriptions > History back  Previous chapter  Next chapter  Print  

is_IpConfig

uEye Camera Manual Version 4.00

is_IpConfig

Windows_Logo

Linux_Logo

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. The function provides the following settings:

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).

Achtung

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.

Hinweis

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.

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.

Hinweis

The is_IpConfig() function is only supported by cameras of the GigE uEye series.

The IP configuration can also be changed using the IDS Camera Manager.

Achtung

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.

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.

IPCONFIG_CMD_QUERY_CAPABILITIES

Returns the function modes supported by the camera.

pParam: Pointer to bit mask of type UINT returning the supported function modes:
IPCONFIG_CAP_PERSISTENT_IP_SUPPORTED
IPCONFIG_CAP_AUTOCONFIG_IP_SUPPORTED

cbSizeOfParam: 4

IPCONFIG_CMD_SET_PERSISTENT_IP

Sets the persistent IP address and the subnet mask of the camera.

The device ID of the camera must be passed in iID or the MAC address of the camera must be passed in mac.

pParam: Pointer to object of type UEYE_ETH_IP_CONFIGURATION.

cbSizeOfParam: Size of UEYE_ETH_IP_CONFIGURATION in bytes.

IPCONFIG_CMD_GET_PERSISTENT_IP

Returns the persistent IP address and the subnet mask of the camera.

The device ID of the camera must be passed in iID or the MAC address of the camera must be passed in mac.

pParam: Pointer to object of type UEYE_ETH_IP_CONFIGURATION.

cbSizeOfParam: Size of UEYE_ETH_IP_CONFIGURATION in bytes.

IPCONFIG_CMD_SET_AUTOCONFIG_IP

Sets the IP address range for automatic IP configuration.

The ID of the network adapter must be passed in iID or the MAC address of the network adapter must be passed in mac.

pParam: Pointer to object of type UEYE_ETH_AUTOCFG_IP_SETUP.

cbSizeOfParam: Size of UEYE_ETH_AUTOCFG_IP_SETUP in bytes.

IPCONFIG_CMD_GET_AUTOCONFIG_IP

Returns the IP address range for automatic IP configuration.

The ID of the network adapter must be passed in iID or the MAC address of the network adapter must be passed in mac.

pParam: Pointer to object of type UEYE_ETH_AUTOCFG_IP_SETUP.

cbSizeOfParam: Size of UEYE_ETH_AUTOCFG_IP_SETUP in bytes.

IPCONFIG_CMD_SET_AUTOCONFIG_IP_BYDEVICE

Sets the IP address range for automatic IP configuration via the device ID.

The device ID of the camera must be passed in iID or the MAC address of the camera must be passed in mac.

pParam: Pointer to object of type UEYE_ETH_AUTOCFG_IP_SETUP.

cbSizeOfParam: Size of UEYE_ETH_AUTOCFG_IP_SETUP in bytes.

IPCONFIG_CMD_GET_AUTOCONFIG_IP_BYDEVICE

Returns the IP address range for automatic IP configuration via the device ID.

The device ID of the camera must be passed in iID or the MAC address of the camera must be passed in mac.

pParam: Pointer to object of type UEYE_ETH_AUTOCFG_IP_SETUP.

cbSizeOfParam: Size of UEYE_ETH_AUTOCFG_IP_SETUP in bytes.

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

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

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

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

UEYE_ETH_ADDR_IPV4

ipAutoCfgIpRangeEnd

Last IPv4 address of the auto configuration range in hexadecimal format

BYTE

reserved[4]

Reserved

Return values

IS_ACCESS_VIOLATION

An internal error has occured.

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 */

  ipcfg.ipAddress.dwAddr = 0xc0a80a02;

  ipcfg.ipSubnetmask.dwAddr = 0xffffff00;

  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 */

  ipautocfg.ipAutoCfgIpRangeBegin.dwAddr = 0xc0a80a0f;

  ipautocfg.ipAutoCfgIpRangeEnd.dwAddr = 0xc0a80a23;

  /* 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. */

  }

}

}


Suggestion for improvement? Send us your short Feedback on this chapter. Thank you very much!

For technical questions please contact you local distributor or use the support form on our website.


© 2012 IDS Imaging Development Systems GmbH
http://www.ids-imaging.com