AuboStudio SDK  0.6.3
analog_io.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_ANALOG_IO_H
2#define AUBO_SCOPE_ANALOG_IO_H
3
5
6namespace arcs {
7namespace aubo_scope {
9
10/**
11 * \chinese
12 * 模拟 IO 接口
13 * 此接口提供对模拟 I/O 的支持。
14 * \endchinese
15 * \english
16 * AnalogIo
17 * This interface provides support for analog I/Os.
18 * \endenglish
19 */
21{
22public:
26
29
30 bool isCurrent();
31 bool isVoltage();
32
33 /**
34 * \chinese
35 * 设置模拟I/O输出信号。注意该I/O必须是输出类型。
36 * @param value 要设置的模拟值。
37 * @return 如果模拟信号设置成功返回<code>true</code>,否则返回<code>false</code>。
38 * \endchinese
39 * \english
40 * Set analog I/O output signal. Notice the I/O must be an output I/O.
41 *
42 * @param value The analog value to be set.
43 * @return <code>true</code> if the analog signal was set,
44 * <code>false</code> if the signal was not set, e.g. because the controller
45 * was not running.
46 * \endenglish
47 */
48 bool setValue(double value);
49
50 /**
51 * \chinese
52 * 获取I/O的最后一次读数
53 * @return I/O的最后一次读数。
54 * \endchinese
55 * \english
56 * Returns the last reading of the I/O.
57 * @return Returns the last reading of the I/O.
58 * \endenglish
59 */
60 double getValue();
61
62private:
63 friend class DataSwitch;
65 void *d_{ nullptr };
66};
67
69{
70 AnalogIoFilter(Io::InterfaceType interface, bool is_input)
71 : interface_(interface), is_input_(is_input)
72 {
73 }
74 bool operator()(IoPtr io)
75 {
76 return std::dynamic_pointer_cast<AnalogIo>(io) != nullptr &&
77 io->getInterfaceType() == interface_ &&
78 io->isInput() == is_input_;
79 }
80
81private:
84};
85
86} // namespace aubo_scope
87} // namespace arcs
88
89#endif // AUBO_SCOPE_ANALOG_IO_H
#define ARCS_ABI_EXPORT
#define ARCS_CLASS_FORWARD(C)
Macro that forward declares a class and defines the respective smartpointers through ARCS_DECLARE_PTR...
\chinese 模拟 IO 接口 此接口提供对模拟 I/O 的支持。 \endchinese \english AnalogIo This interface provides support for...
bool setValue(double value)
\chinese 设置模拟I/O输出信号。注意该I/O必须是输出类型。
double getValue()
\chinese 获取I/O的最后一次读数
AnalogIoFilter(Io::InterfaceType interface, bool is_input)