AuboStudio SDK  0.6.3
digital_io.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_DIGITAL_IO_H
2#define AUBO_SCOPE_DIGITAL_IO_H
3
5
6namespace arcs {
7namespace aubo_scope {
9
10/**
11 * \chinese
12 * 数字 IO 接口
13 * 此接口提供对数字 I/O 的支持。
14 * \endchinese
15 * \english
16 * DigitalIo
17 * This interface provides support for digital I/Os.
18 * \endenglish
19 */
21{
22public:
26
27 /**
28 * \chinese
29 * 设置数字I/O输出信号。注意该I/O必须是输出类型。
30 * @param high 要设置的数字值。
31 * @return 如果数字信号设置成功返回<code>true</code>,否则返回<code>false</code>。
32 * \endchinese
33 * \english
34 * Set digital I/O output signal. Note that the I/O must be an output I/O.
35 *
36 * @param high the digital value to be set.
37 * @return <code>true</code> if the digital signal was set,
38 * <code>false</code> if the signal was not set, e.g. because the controller
39 * was not running.
40 * \endenglish
41 */
42 bool setValue(bool high);
43
44 /**
45 * \chinese
46 * 获取I/O的最后一次读数
47 * @return I/O的最后一次读数。
48 * \endchinese
49 * \english
50 * Returns the last reading of the I/O.
51 * @return Returns the last reading of the I/O.
52 * \endenglish
53 */
54 bool getValue();
55
56private:
57 friend class DataSwitch;
59 void *d_{ nullptr };
60};
61
63{
64 DigitalIoFilter(Io::InterfaceType interface, bool is_input)
65 : interface_(interface), is_input_(is_input)
66 {
67 }
68 bool operator()(IoPtr io)
69 {
70 return std::dynamic_pointer_cast<DigitalIo>(io) != nullptr &&
71 io->getInterfaceType() == interface_ &&
72 io->isInput() == is_input_;
73 }
74
75private:
78};
79
81{
82 bool operator()(IoPtr io) { return io && io->isInput(); }
83};
84
86{
87 bool operator()(IoPtr io) { return io && !io->isInput(); }
88};
89
90} // namespace aubo_scope
91} // namespace arcs
92
93#endif // AUBO_SCOPE_DIGITAL_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 DigitalIo This interface provides support fo...
bool getValue()
\chinese 获取I/O的最后一次读数
bool setValue(bool high)
\chinese 设置数字I/O输出信号。注意该I/O必须是输出类型。
DigitalIoFilter(Io::InterfaceType interface, bool is_input)