AuboStudio SDK  0.6.3
modbus_io.h
浏览该文件的文档.
1#ifndef AUBO_SCOPE_MODBUS_IO_H
2#define AUBO_SCOPE_MODBUS_IO_H
3
5
6namespace arcs {
7namespace aubo_scope {
9
10/**
11 * @ingroup ApplicationApi
12 * \chinese
13 * Modbus IO 接口
14 * 此接口提供对 MODBUS I/O 的支持。
15 * \endchinese
16 * \english
17 * ModbusIo
18 * This interface provides support for MODBUS I/Os.
19 * \endenglish
20 */
22{
23public:
27
28 /**
29 * @ingroup ModbusIo
30 * \chinese
31 * 获取此MODBUS I/O的IP地址
32 * @return IP地址。
33 * \endchinese
34 * \english
35 * Returns the IP address for this MODBUS I/O.
36 * @return Get the IP address for this MODBUS I/O.
37 * \endenglish
38 */
39 std::string getIpAddress();
40
41 /**
42 * @ingroup ModbusIo
43 * \chinese
44 * 获取此MODBUS I/O的信号地址
45 * @return 信号地址。
46 * \endchinese
47 * \english
48 * Returns the signal address for this MODBUS I/O.
49 * @return the signal address for this MODBUS I/O.
50 * \endenglish
51 */
52 std::string getSignalAddress();
53
54 /**
55 * @ingroup ModbusIo
56 * \chinese
57 * 判断此MODBUS I/O是否为从站
58 * @return 是否为从站。
59 * \endchinese
60 * \english
61 * Returns whether this MODBUS I/O is a slave.
62 * @return Get the is slave for this MODBUS I/O.
63 * \endenglish
64 */
65 bool isSlave();
66
67 /**
68 * @ingroup ModbusIo
69 * \chinese
70 * 设置MODBUS信号的整数值。
71 * @param value 要设置的整数值。
72 * @return 信号下发成功返回<code>true</code>,否则返回<code>false</code>。
73 * \endchinese
74 * \english
75 * Set MODBUS signal to an integer value.
76 * @param value Set MODBUS signal to an integer value.
77 * @return <code>true</code> if the MODBUS signal was sent down to the
78 * controller, and <code>false</code> if the signal was not sent down.
79 * \endenglish
80 */
81 bool setValue(int value);
82
83 /**
84 * @ingroup ModbusIo
85 * \chinese
86 * 获取MODBUS信号的整数值。
87 * @return MODBUS信号的整数值。
88 * \endchinese
89 * \english
90 * Returns the integer value of the MODBUS signal.
91 * @return the integer value of the MODBUS signal.
92 * \endenglish
93 */
94 int getValue();
95
96private:
97 friend class DataSwitch;
99 void *d_{ nullptr };
100};
101
103{
104 ModbusIoFilter(Io::IoType type, bool is_input)
105 : type_(type), is_input_(is_input)
106 {
107 }
108 bool operator()(IoPtr io)
109 {
110 return std::dynamic_pointer_cast<ModbusIo>(io) != nullptr &&
111 io->getType() == type_ && io->isInput() == is_input_;
112 }
113
114private:
117};
118
119} // namespace aubo_scope
120} // namespace arcs
121
122#endif // MODBUSIO_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 Modbus IO 接口 此接口提供对 MODBUS I/O 的支持。 \endchinese \english ModbusIo This interface provides su...
bool setValue(int value)
\chinese 设置MODBUS信号的整数值。
std::string getIpAddress()
\chinese 获取此MODBUS I/O的IP地址
std::string getSignalAddress()
\chinese 获取此MODBUS I/O的信号地址
int getValue()
\chinese 获取MODBUS信号的整数值。
bool isSlave()
\chinese 判断此MODBUS I/O是否为从站
ModbusIoFilter(Io::IoType type, bool is_input)