Smart Camera Documentation

Configure existing Data Server

9 views October 16, 2018 soliton-support 0

NUERA project template offers readily available data server, command server, PLC server, image server in
order to exchange different type of information through TCP Communication.

For the purpose of communicating data with a PC, a data_server has been created in the NUERA project template. As shown in the following steps, by simply enabling the data server and calling the send_data(), you can program NUERA to send data to PC.

Step 1: Enable Data Server (if not already enabled)
The data server can be enabled or disabled by defining DATA_SERVER_ENABLED as true or false respectively in sys_constants.hpp.

NUERA Data Server Enable

Step 2: Configure Data Server (if needed)
In TCP, the server listens for connection requests from clients at a specific port. By default, the Port Number for the Data server is given in sys_constants.hpp. Navigate to file src >> system_configurations >> sys_constants.hpp. Many constants are defined in this header file. Find DATA_SERVER_PORT. By default, it is defined as 7892. This can be changed as per your requirement. Remember that in Step 4, we
will use this port number as the TCP client end to connect to this data server. The Buffer Size and Data Timeout of the data server can also be changed in this file.

NUERA Data Server Port Setting

Step 3: Add code to Send Data
Navigate to file src >> application >> application.cpp. Goto manage_data_srvr() . Add the message you want to send through TCP to a character array. An example is shown in image below:

NUERA Data Server Port add application code

Call the send_data(), passing the character array as first parameter and number of characters as second parameter, to send this message through the network to the other device using TCP. The code needs to be added at the location shown below:

NUERA Data Server Port add application code 1

Step 4: Observe output (on Hercules)
Connect a Windows System to the same network as NUERA. Open Hercules on the Windows System. Go to the TCP Client pane. Set the Module IP as the IP address of the NUERA camera. Set the Port field according to the data port as set in Step 2. Then, click Connect button. After a “Connected” message, the data we are sending from the Nuera camera will be received by the TCP client and displayed on the screen as shown below:

NUERA Data Server Terminal Output

For any further assistance, please contact our application engineer at camera.support@solitontech.com

Was this helpful?