Instrument Control Lib
Framework to control Oscilloscopes, SMUs, Function Generators and DC Powersupplies via Ethernet.
CommandLineInterface.h
Go to the documentation of this file.
1 
7 #pragma once
8 
10 #include "ConfigFileParser.h"
11 
12 #include <map> // std::map
13 #include <vector> // std::vector
14 
15 // Forward declarations to avoid importing PIL headers
16 namespace PIL {
17  class Logging;
18 }
19 class Device;
20 
25 {
26 public:
27  explicit CommandLineInterface(PIL::Logging *logger);
28  explicit CommandLineInterface();
29  bool Start();
30 
31  // Commands to be executed on the command line interface.
32  static void PrintHelp(std::string &args);
33  static void Connect(std::string &args);
34  static void SendCustomCommand(std::string &args);
35  static void Disconnect(std::string &args);
36  static void Quit(std::string &args);
37  static void GetSupportedDevices(std::string &args);
38  static void ActiveDevices(std::string &args);
39  static void SelectDevice(std::string &args);
40  static void GetDeviceIdentifier(std::string &args);
41  static void addCustomCommandLineOption(const char *identifier, const char *description, void (*func)(std::string&));
42 
43  static std::vector<std::string> splitArguments(std::string &args);
44 
45 private:
46  CLI_Commands ParseCommand(std::string &string);
47 
48  static void CtrlCHandler(int signal);
49 
50  // TODO: maybe combined to one data structure
52  static std::vector<Device*> m_DeviceList;
54  static std::vector<std::string> m_DeviceNameList;
56  static std::vector<std::string> m_DeviceIPList;
58  static std::vector<DeviceDescription> m_DeviceDescriptions;
59 
61  static int m_currentDevice;
63  static volatile bool m_ExitCLI;
65  static PIL::Logging *m_Logger;
67  static std::map<CLI_Commands, CLICommandStruct> m_DescriptionMap;
69  static std::map<std::string, std::string> m_SupportedDevices;
70 };
CLI_Commands
Definition: CommandLineInterfaceDefines.h:27
This class represents a command line interface to execute common functions of VISA devices.
Definition: CommandLineInterface.h:25
static void PrintHelp(std::string &args)
This method prints an overview of available commands on the command line interface.
Definition: CommandLineInterface.cpp:93
static std::vector< std::string > splitArguments(std::string &args)
Definition: CommandLineInterface.cpp:177
static void SendCustomCommand(std::string &args)
Definition: CommandLineInterface.cpp:223
static void GetDeviceIdentifier(std::string &args)
Definition: CommandLineInterface.cpp:299
static void GetSupportedDevices(std::string &args)
Definition: CommandLineInterface.cpp:254
bool Start()
Start executing the command line interface. Input a raw SCPI command and execute. To see if a command...
Definition: CommandLineInterface.cpp:56
static void ActiveDevices(std::string &args)
Definition: CommandLineInterface.cpp:271
static void addCustomCommandLineOption(const char *identifier, const char *description, void(*func)(std::string &))
Definition: CommandLineInterface.cpp:158
CommandLineInterface()
Definition: CommandLineInterface.cpp:47
static void Connect(std::string &args)
Connects to a device based on a certain IP address and adds it to the list of active devices.
Definition: CommandLineInterface.cpp:109
static void Quit(std::string &args)
Definition: CommandLineInterface.cpp:264
static void SelectDevice(std::string &args)
Definition: CommandLineInterface.cpp:280
static void Disconnect(std::string &args)
Definition: CommandLineInterface.cpp:186
Basic device class This class contains all basic method of all devices, like Connect,...
Definition: Device.h:30
This class contains a implementation of a command line interface. It supports various functions like ...
Definition: CommandLineInterface.h:16