libvisiontransfer  10.8.0
temperature_example.cpp
1 #include <visiontransfer/deviceenumeration.h>
2 #include <visiontransfer/imagetransfer.h>
3 #include <visiontransfer/imageset.h>
4 #include <visiontransfer/deviceparameters.h>
5 #include <iostream>
6 #include <exception>
7 #include <iomanip>
8 #include <stdio.h>
9 
10 using namespace visiontransfer;
11 
12 int main(int, char**) {
13  try {
14  // Search for Nerian stereo devices
15  DeviceEnumeration deviceEnum;
16 
17  DeviceEnumeration::DeviceList devices = deviceEnum.discoverDevices();
18  if(devices.size() == 0) {
19  std::cout << "No devices discovered!" << std::endl;
20  return -1;
21  }
22 
23  // Print devices
24  std::cout << "Discovered devices:" << std::endl;
25  for(unsigned int i = 0; i< devices.size(); i++) {
26  std::cout << devices[i].toString() << std::endl;
27  }
28  std::cout << std::endl;
29 
30  // Create a connection to the parameter interface
31  DeviceParameters parameters(devices[0]);
32 
33  // Output the current temperatures
34  std::cout << "SOC temperature: " << parameters.getParameter("RT_temp_soc").getCurrent<double>() << " °C" << std::endl;
35  std::cout << "Left sensor temperature: " << parameters.getParameter("RT_temp_sensor_left").getCurrent<double>() << " °C" << std::endl;
36  std::cout << "Right sensor temperature: " << parameters.getParameter("RT_temp_sensor_right").getCurrent<double>() << " °C" << std::endl;
37 
38  return 0;
39  } catch(const std::exception& ex) {
40  std::cerr << "Exception occurred: " << ex.what() << std::endl;
41  }
42 
43  return 0;
44 }
45 
visiontransfer::DeviceEnumeration::discoverDevices
DeviceList discoverDevices()
Discovers new devices and returns the list of all devices that have been found.
Definition: deviceenumeration.h:66
visiontransfer::DeviceEnumeration
Allows for the discovery of devices in the network.
Definition: deviceenumeration.h:42
visiontransfer::DeviceParameters
Allows for configuration of the parameters of a Nerian stereo device through a network connection.
Definition: deviceparameters.h:64
Allied Vision