Instrument Control Lib
Framework to control Oscilloscopes, SMUs, Function Generators and DC Powersupplies via Ethernet.
DeviceDiscovery.h
Go to the documentation of this file.
1 
7 #ifndef INSTRUMENT_CONTROL_LIB_DEVICEDISCOVERY_HPP
8 #define INSTRUMENT_CONTROL_LIB_DEVICEDISCOVERY_HPP
9 #if __linux__
10 
11 #include <string>
12 #include <vector>
13 
14 #include "ctlib/SocketDefines.h"
15 #include "ctlib/Logging.hpp"
16 #include "Device.h"
17 
18 struct IPRange{
19  std::vector<uint8_t> m_startIPRange;
20  std::vector<uint8_t> m_stopIPRange;
21 } typedef IPRange;
22 
23 class DeviceDiscovery
24 {
25 public:
26  explicit DeviceDiscovery(std::string &interface, PIL::Logging *logging = nullptr);
27  ~DeviceDiscovery();
28 
29  std::vector<Device *> startDiscovery();
30 
31 private:
32  static IPRange getAddressRange(std::string &ip, std::string &mask);
33  PIL_ERROR_CODE setInterfaceList();
34  void testIPRange(IPRange& ipRange, std::vector<Device*>* deviceList);
35  static Device * createDeviceFromDeviceString(std::string &deviceStr, std::vector<uint8_t> &ip);
36  static std::vector<uint8_t> splitIpAddr(const std::string &string);
37 
38  InterfaceInfoList m_InterfaceList{};
39  std::string m_InterfaceName;
40  PIL::Logging *m_Logging;
41 };
42 #endif // __linux__
43 #endif //INSTRUMENT_CONTROL_LIB_DEVICEDISCOVERY_HPP
Basic device class This class contains all basic method of all devices, like Connect,...
Definition: Device.h:30