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 * This interface provides support for digital I/Os.
12 *
13 */
15{
16public:
20
21 /**
22 * Set digital I/O output signal. Note that the I/O must be an output I/O.
23 *
24 * @param high the digital value to be set.
25 * @return <code>true</code> if the digital signal was set,
26 * <code>false</code> if the signal was not set, e.g. because the controller
27 * was not running.
28 */
29 bool setValue(bool high);
30
31 /**
32 *
33 * @return Returns the last reading of the I/O.
34 */
35 bool getValue();
36
37private:
38 friend class DataSwitch;
40 void *d_{ nullptr };
41};
42
44{
45 DigitalIoFilter(Io::InterfaceType interface, bool is_input)
46 : interface_(interface), is_input_(is_input)
47 {
48 }
49 bool operator()(IoPtr io)
50 {
51 return std::dynamic_pointer_cast<DigitalIo>(io) != nullptr &&
52 io->getInterfaceType() == interface_ &&
53 io->isInput() == is_input_;
54 }
55
56private:
59};
60
62{
63 bool operator()(IoPtr io) { return io && io->isInput(); }
64};
65
67{
68 bool operator()(IoPtr io) { return io && !io->isInput(); }
69};
70
71} // namespace aubo_scope
72} // namespace arcs
73
74#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...
This interface provides support for digital I/Os.
bool setValue(bool high)
Set digital I/O output signal.
DigitalIoFilter(Io::InterfaceType interface, bool is_input)