<< to CrossControl homepage

Support & Service Center

Using the IPCamerasettings library to control IP Cameras

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

Target platform


VS/VI2/VC/VA, VM 4.0

Prerequisites

  • VS/VI2 or VC/VA
  • Virtual Machine 4.0 or higher
  • IP Camera that supports ISO17215
  • Project and library files, see download link at end of page

How to use the library

How to run the example project


Installing the library

The library files for the different devices are included in the ZIP "ETH cam lib" (see below). To be able to build the test application in the VM, you must install the libraries in build environment. The ZIP contains a simple instruction of the steps that are needed to get this working.

In order to install the library on target, put the library files (so-files) in /opt/lib on your device (VS in this case). Then update the library cache file by executing:

sudo ldconfig -C /opt/etc/ld.so.cache

Alternatively, you can put the files anywhere you want and then set the environment variable $LD_LIBRARY_PATH to that location. For example:

export LD_LIBRARY_PATH=/home/ccs/mylibs

How to use the library

First we need to instantiate the class

#include "ethcamerasettings.h"
...
ETHCameraSettings m_ipCamSettings = new ETHCameraSettings(m_camIPAddress, m_camPortNumber, m_clientID);

Then we open the API torwards the camera and check the return code for errors

ETHCamStatus status = m_ipCamSettings->open();
if(status != E_OK)
{
	//Do error handling here
}

Now we can send our commands to the camera. For example, to get the camera datasheet

//Create a Datasheet struct
Datasheet datasheet;
 
m_ipCamSettings->getDatasheet(datasheet);
if(status == E_OK)
{
	//Process datasheet struct here
}

Once we are done we need to make sure it is closed and then delete it.

ETHCamStatus status = m_ipCamSettings->close();
if(status == E_OK)
{
	//It is closed, now we can delete it
	delete m_ipCamSettings;
}

For a complete list of library functions see the full documentation.


Running the example project

You can download the example project at the top of the article

Extract and open the example project with Qt creator

In the example project, go to main.cpp

At the top of the file enter the camera IP address and its communication port number. Note that the communication port number is not the same as the streaming port!


camextutorial.png

You can now run the application and should see something like this:


ipcamexampledialog.png

At the top of the application dialog there is a status box where you can see the IP address, port number, what operation you have called and the status code for that operation.

Now make sure your IP camera is running. For information on how to use gstreamer to view the camera stream see this article on the knowledgebase.

If you for example press Subscribe Index: 0 your dialog should look like this, provided everything went well.



ipcamexampledialog_subscribe_roi.png

You can now see that our operation SubscribeROIVideo received the status code E_OK which means the operation went well. For a description all the possible status codes, see the documentation. Note that your camera might not support all the methods available in the library, its likely that the camera will return the status code E_UNKNOWN_METHOD if that particular method is not yet implemented.

AttachmentSize
Package icon ipcamsettingsqmlexample.zip8.87 KB
Package icon eth_cam_lib.zip412.1 KB
whatever