Camera Control and Connection Functions

The eSDK API offers the following camera control and connection functions:

  • EVT_CameraOpen – Open the camera
  • EVT_CameraClose – Close the camera
  • EVT_CameraOpenStream – Open a stream channel on the host side
  • EVT_CameraCloseStream – Close a stream channel on the host side
  • EVT_CameraExecuteCommand – Execute a command attribute
  • EVT_ListDevices – List all devices connected to Ethernet ports
  • EVT_ForceReboot - Reboot a camera

For information about other eSDK API functions, see the eSDK API Functions Overview.‍‍

EVT_CameraOpen

Description: Opens the EVT camera.

Prototype:

EVT_ERROR EVT_CameraOpen(
	CEmergentCamera* camera,
	GigEVisionDeviceInfo* deviceInfo,
	const char* xmlFileName = NULL
);

Parameters:

  • camera: Camera handle.
  • deviceInfo: Handle to a GigEVisionDeviceInfo structure.
  • xmlFileName: Local camera XML file. Omit or pass NULL to use in-camera XML file.

Return Values:

  • EVT_SUCCESS
  • EVT_ERROR_DEVICE_CONNECTED_ALRD
  • EVT_ERROR_INVAL
  • EVT_ERROR_NOMEM
  • EVT_ERROR_SOCK
  • EVT_ERROR_GVCP_ACK
  • EVT_GENERAL_ERROR

Usage Example:

EVT_CameraOpen(camera, deviceInfo, "camera.xml");
Note: Always call EVT_CameraClose() to close the camera when finished.

EVT_CameraClose

Description: Closes the EVT camera.

Prototype:

EVT_ERROR EVT_CameraClose(
   CEmergentCamera* camera
);

Parameters:

  • camera: Camera handle.

Return Values:

  • EVT_SUCCESS
  • EVT_ERROR_DEVICE_NOT_CONNECTED
  • EVT_ERROR_SRCH
  • EVT_ERROR_GENICAM_ERROR
  • EVT_ERROR_SOCK
  • EVT_ERROR_GVCP_ACK
  • EVT_GENERAL_ERROR

Usage Example:

EVT_CameraClose(camera);
Note: Always open the camera using EVT_CameraOpen() before calling this function.

EVT_CameraOpenStream

Description: Opens a stream channel on the host side.

Prototype:

EVT_ERROR EVT_CameraOpenStream(
   CEmergentCamera* camera
);

Parameters:

  • camera: Camera handle.

Return Values:

  • EVT_SUCCESS
  • EVT_ERROR_DEVICE_NOT_CONNECTED
  • EVT_ERROR_SOCK
  • EVT_ERROR_GVCP_ACK
  • EVT_ERROR_MYRICOM_INIT
  • EVT_ERROR_INVAL
  • EVT_GENERAL_ERROR

Usage Example:

EVT_CameraOpenStream(camera);

EVT_CameraCloseStream

Description: Closes the stream channel on the host side.

Prototype:

EVT_ERROR EVT_CameraCloseStream(
   CEmergentCamera* camera
);

Parameters:

  • camera: Camera handle.

Return Values:

  • EVT_SUCCESS
  • EVT_GENERAL_ERROR

Usage Example:

EVT_CameraCloseStream(camera);

EVT_CameraExecuteCommand

Description: Executes a command attribute.

Prototype:

EVT_ERROR EVT_CameraExecuteCommand(
   CEmergentCamera* camera,
   const char* name
);

Parameters:

  • camera: Camera handle.
  • name: Command attribute to be executed.

Return Values:

  • EVT_SUCCESS
  • EVT_ERROR_DEVICE_NOT_CONNECTED
  • EVT_ERROR_SRCH
  • EVT_ERROR_GENICAM_ERROR
  • EVT_ERROR_SOCK
  • EVT_ERROR_GVCP_ACK
  • EVT_GENERAL_ERROR

Usage Example:

EVT_CameraExecuteCommand(camera, "AcquisitionStart");

EVT_ListDevices

Description: Lists all devices connected to Ethernet ports and fills in deviceInfo for each.

Prototype:

EVT_ERROR EVT_ListDevices(
   GigEVisionDeviceInfo* deviceInfo,
   unsigned int* bufSize,
   unsigned int* actualNum,
   const ListDevicesSettings* settings = 0
);

Parameters:

  • deviceInfo: Pointer to an array of GigEVisionDeviceInfo objects.
  • bufSize: Number of devices in the system.
  • actualNum: Number of devices actually found.
  • settings: Struct variable for discovery timeout settings.

Return Values:

  • EVT_SUCCESS
  • EVT_ERROR_OS_OBTAIN_ADAPTER
  • EVT_GENERAL_ERROR

Usage Example:

GigEVisionDeviceInfo deviceList[10];
unsigned int bufSize = 10;
unsigned int actualNum;
EVT_ListDevices(deviceList, &bufSize, &actualNum, &settings);

EVT_ForceReboot

Description: Reboots a specified camera by sending a force reboot command.

Prototype:

EVT_ERROR EVT_ForceReboot(
    const char* macAddressSn,
    const char* cameraIP = NULL
);

Parameters:

  • macAddressSn: Specifies the camera using its MAC address or serial number. A MAC address is a string of six hexadecimal pairs delimited by '-', such as e0-55-97-06-1a-fb. A serial number is a string of decimal digits, such as 400123.
  • cameraIP (optional): Specifies the current IP address of the camera. If NULL, the reboot command is broadcast. If provided, the command is sent via unicast to the specified IP.

Return Values:

  • EVT_SUCCESS
  • EVT_ERROR_INVAL
  • EVT_ERROR_SOCK

Usage Examples:

// Reboot a camera using its MAC address via broadcast
EVT_ForceReboot("e0-55-97-06-1a-fb", NULL);

// Reboot a camera using its MAC address via unicast to a specific IP
EVT_ForceReboot("e0-55-97-06-1a-fb", "192.168.1.100");
Updated on
November 19, 2024
Questions?


Get in touch with us today and our team of imaging professionals will be pleased to assist you.

Contact Us