AuboCaps  0.6.0
analog_io.h
Go to the documentation of this file.
1 #ifndef AUBO_SCOPE_ANALOG_IO_H
2 #define AUBO_SCOPE_ANALOG_IO_H
3 
5 
6 namespace arcs {
7 namespace aubo_scope {
8 ARCS_CLASS_FORWARD(AnalogIo);
9 
10 /**
11  * This interface provides support for analog I/Os.
12  *
13  */
14 class ARCS_ABI_EXPORT AnalogIo : public Io
15 {
16 public:
17  AnalogIo(AnalogIo &f);
18  AnalogIo(AnalogIo &&f);
19  ~AnalogIo();
20 
21  double getMinRangeValue();
22  double getMaxRangeValue();
23 
24  bool isCurrent();
25  bool isVoltage();
26 
27  /**
28  * Set analog I/O output signal. Notice the I/O must be an output I/O
29  *
30  * @param value The analog value to be set.
31  * @return <code>true</code> if the analog signal was set,
32  * <code>false</code> if the signal was not set, e.g. because the controller
33  * was not running.
34  */
35  bool setValue(double value);
36 
37  /**
38  *
39  * @return Returns the last reading of the I/O.
40  */
41  double getValue();
42 
43 private:
44  friend class DataSwitch;
45  AnalogIo();
46  void *d_{ nullptr };
47 };
48 
50 {
51  AnalogIoFilter(Io::InterfaceType interface, bool is_input)
52  : interface_(interface), is_input_(is_input)
53  {
54  }
55  bool operator()(IoPtr io)
56  {
57  return std::dynamic_pointer_cast<AnalogIo>(io) != nullptr &&
58  io->getInterfaceType() == interface_ &&
59  io->isInput() == is_input_;
60  }
61 
62 private:
64  bool is_input_;
65 };
66 
67 } // namespace aubo_scope
68 } // namespace arcs
69 
70 #endif // AUBO_SCOPE_ANALOG_IO_H
ARCS_CLASS_FORWARD(GripForceCapability)
This is the base interface representing all types of I/Os available in AuboScope. ...
Definition: io.h:16
AnalogIoFilter(Io::InterfaceType interface, bool is_input)
Definition: analog_io.h:51
InterfaceType getInterfaceType() const
Io::InterfaceType interface_
Definition: analog_io.h:63
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16
This interface provides support for analog I/Os.
Definition: analog_io.h:14