DCS_SDK  2.0.0
TCP/IP control library for Ai DCS-100E and DCS-103E
DCS100.h
Go to the documentation of this file.
1 #ifndef __DCS_100_H__
2 #define __DCS_100_H__
3 
4 #if defined(_WIN32) && defined(BUILD_SHARED)
5  #ifdef DCS_SDK_EXPORT
6  #define DCS_EXPORT __declspec(dllexport)
7  #else
8  #define DCS_EXPORT __declspec(dllimport)
9  #endif
10 #else
11  #define DCS_EXPORT
12 #endif
13 
14 #include <string>
15 #include <cinttypes>
16 #include <vector>
17 #include <iostream>
18 #include <exception>
19 
21 {
25  class DCS_EXPORT DeviceWarning : std::invalid_argument
26  {
27  public:
28  virtual const char* what() const noexcept;
29  DeviceWarning(const std::string msg);
30  virtual ~DeviceWarning() noexcept;
31  private:
32  std::string _what;
33  };
34 
38  class DCS_EXPORT DeviceError : std::runtime_error
39  {
40  public:
41  virtual const char* what() const noexcept;
42  DeviceError(const std::string msg);
43  virtual ~DeviceError() noexcept;
44  private:
45  std::string _what;
46  };
47 
48 
50  enum class Mode
51  {
52 
54  Off = 0,
55 
57  Continuous = 1,
58 
60  Pulsed = 2,
61 
63  Gated = 3
64  };
65 
66 
68  enum class Trigger
69  {
71  Falling = 0,
72 
74  Rising = 1
75  };
76 
77 
79  enum class Channel
80  {
82  One = 1,
83 
85  Two = 2,
86 
88  Three = 3
89  };
90 
95  {
96 
97  public:
98 
103  {
104  public:
105 
106  double current() const;
107  void current(const double);
108 
109  double pulseWidth() const;
110  void pulseWidth(const double);
111 
112  double pulseDelay() const;
113  void pulseDelay(const double);
114 
115  double maxContinuous() const;
116  const double maxStrobe() const;
117 
118  Mode mode() const;
119  void mode(const Mode);
120 
121  Trigger triggerMode() const;
122  void triggerMode(const Trigger);
123 
124  Channel triggerInput() const;
125  void triggerInput(const Channel);
126 
127  double maxFrequency() const;
128 
129  void trigger() const;
130 
131  private:
132  friend class DCS_100;
133 
134  DCS_Channel();
135  DCS_100* parent;
136 
137  double _minPulseDelay;
138  double _current;
139  double _pulseWidth;
140  double _pulseDelay;
141 
142  double _maxCont;
143  double _maxStrobe;
144  int _number;
145  Mode _mode;
146  Trigger _trigger;
147  Channel _input;
148  double _maxFreq;
149 
151  };
152 
153  friend class DCS_Channel;
154 
155  DCS_Channel& Channel(size_t);
156  DCS_Channel& operator[](size_t);
157 
158  const std::string& name() const;
159  void name(const std::string& name);
160 
161  const std::string& firmwareVersion() const;
162 
163  const std::string& ipAddress() const;
164  void ipAddress(const std::string& ip);
165 
166  size_t ChannelCount() const;
167 
168 
169  const std::string& profileName() const;
170  int profileNumber() const noexcept;
171 
172  void profileName(const std::string&);
173  void profileNumber(int);
174 
175  void webConfigEnabled(const bool);
176  bool webConfigEnabled() const;
177 
178  void saveProfile();
179 
180  DCS_100();
181 
182  DCS_100(const char* ip);
183 
184  void connect(const std::string& ip);
185  void disconnect();
186 
187  void refreshConfig();
188 
189  const std::vector<std::string>& profileNames() const;
190 
191  ~DCS_100();
192 
193  void refreshProfiles();
194 
195  private:
196  void parseProfiles(const std::string&);
197  void parseConfigJSON(const std::string&);
198  void parseConfigXML(const std::string&);
199 
200  size_t numChannels;
201  DCS_Channel* Channels = nullptr;
202 
203  std::string sendCommand(const std::string&);
204 
205  std::string _name;
206  std::string _firmare;
207  std::string _lighthead;
208  std::string _address;
209  std::string _profileName;
210  bool _webConfigEnabled;
211  int _activeProfile;
212 
213  std::vector<std::string> _profileNames;
214 
215  void checkError(const std::string&) const;
216  std::string getResponse(const char* prefix);
217  class Comms* _comms;
218  };
219 }
220 
221 #endif
AdvancedIllumination::Mode::Gated
@ Gated
An enum constant representing the Gated mode.
AdvancedIllumination::DCS_100::DCS_Channel
Encaspsulates the data related to a single DCS channel.
Definition: DCS100.h:102
AdvancedIllumination::Mode
Mode
Values that represent modes.
Definition: DCS100.h:50
AdvancedIllumination::Channel::One
@ One
The first channel.
DCS_EXPORT
#define DCS_EXPORT
Definition: DCS100.h:11
AdvancedIllumination::Trigger::Rising
@ Rising
A falling-edge trigger.
AdvancedIllumination::Channel::Two
@ Two
The second channel.
AdvancedIllumination::Mode::Pulsed
@ Pulsed
An enum constant representing the Pulsed mode.
AdvancedIllumination::Mode::Continuous
@ Continuous
An enum constant representing the Continuous current mode.
AdvancedIllumination::Trigger
Trigger
Values that represent trigger edges (e.g.
Definition: DCS100.h:68
AdvancedIllumination::Channel
Channel
Values that represent channels.
Definition: DCS100.h:79
AdvancedIllumination::DeviceError
An exception representing an error message from the device.
Definition: DCS100.h:38
AdvancedIllumination::Mode::Off
@ Off
An enum constant representing the "Off" mode.
AdvancedIllumination::DCS_100
Contains information and methods for working with DCS devices.
Definition: DCS100.h:94
AdvancedIllumination::Channel::Three
@ Three
The third channel.
AdvancedIllumination::DeviceWarning
An exception representing a warning message from the device.
Definition: DCS100.h:25
AdvancedIllumination::Trigger::Falling
@ Falling
A rising-edge trigger.
AdvancedIllumination
Namespace containing AI-created functions and classes.
Definition: DCS100.h:20