AuboStudio SDK 0.6.3

analog_io.h
浏览该文件的文档.
1 #ifndef AUBO_SCOPE_ANALOG_IO_H
2 #define AUBO_SCOPE_ANALOG_IO_H
3
4 #include <aubo_caps/domain/io/io.h>
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
49 struct AnalogIoFilter
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:
63 Io::InterfaceType interface_;
64 bool is_input_;
65 };
66
67 } // namespace aubo_scope
68 } // namespace arcs
69
70 #endif // AUBO_SCOPE_ANALOG_IO_H
ARCS_ABI_EXPORT
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16
arcs::aubo_scope::AnalogIo
This interface provides support for analog I/Os.
Definition: analog_io.h:15
arcs::aubo_scope::AnalogIo::AnalogIo
AnalogIo()
arcs::aubo_scope::AnalogIo::AnalogIo
AnalogIo(AnalogIo &f)
arcs::aubo_scope::AnalogIo::isVoltage
bool isVoltage()
arcs::aubo_scope::AnalogIo::setValue
bool setValue(double value)
Set analog I/O output signal.
arcs::aubo_scope::AnalogIo::~AnalogIo
~AnalogIo()
arcs::aubo_scope::AnalogIo::isCurrent
bool isCurrent()
arcs::aubo_scope::AnalogIo::getMaxRangeValue
double getMaxRangeValue()
arcs::aubo_scope::AnalogIo::AnalogIo
AnalogIo(AnalogIo &&f)
arcs::aubo_scope::AnalogIo::getMinRangeValue
double getMinRangeValue()
arcs::aubo_scope::AnalogIo::getValue
double getValue()
arcs::aubo_scope::Io
This is the base interface representing all types of I/Os available in AuboScope.
Definition: io.h:17
arcs::aubo_scope::Io::InterfaceType
InterfaceType
Definition: io.h:28
io.h
arcs::aubo_scope::ARCS_CLASS_FORWARD
ARCS_CLASS_FORWARD(GripForceCapability)
arcs
Definition: contribution_provider.h:7
arcs::aubo_scope::AnalogIoFilter
Definition: analog_io.h:50
arcs::aubo_scope::AnalogIoFilter::AnalogIoFilter
AnalogIoFilter(Io::InterfaceType interface, bool is_input)
Definition: analog_io.h:51
arcs::aubo_scope::AnalogIoFilter::interface_
Io::InterfaceType interface_
Definition: analog_io.h:63
arcs::aubo_scope::AnalogIoFilter::operator()
bool operator()(IoPtr io)
Definition: analog_io.h:55
arcs::aubo_scope::AnalogIoFilter::is_input_
bool is_input_
Definition: analog_io.h:64