AuboStudio SDK 0.6.3

modbus_io.h
浏览该文件的文档.
1 #ifndef AUBO_SCOPE_MODBUS_IO_H
2 #define AUBO_SCOPE_MODBUS_IO_H
3
4 #include <aubo_caps/domain/io/io.h>
5
6 namespace arcs {
7 namespace aubo_scope {
8 ARCS_CLASS_FORWARD(ModbusIo);
9
10 /**
11 * @defgroup ModbusIo ModbusIo (Modbus I/O)
12 * This interface provides support for MODBUS I/Os.
13 */
14 class ARCS_ABI_EXPORT ModbusIo : public Io
15 {
16 public:
17 ModbusIo(ModbusIo &f);
18 ModbusIo(ModbusIo &&f);
19 ~ModbusIo();
20
21 /**
22 * @ingroup ModbusIo
23 * @return Get the IP address for this MODBUS I/O.
24 */
25 std::string getIpAddress();
26
27 /**
28 * @ingroup ModbusIo
29 * @return the signal address for this MODBUS I/O.
30 */
31 std::string getSignalAddress();
32
33 /**
34 * @ingroup ModbusIo
35 * @return Get the is slave for this MODBUS I/O.
36 */
37 bool isSlave();
38
39 /**
40 * @ingroup ModbusIo
41 * @param value Set MODBUS signal to an integer value. If the MODBUS signal
42 * is digital, then <code>false</code> is represented by 0 and
43 * <code>true</code> are represented by all numbers different from 0.
44 *
45 * @return <code>true</code> if the MODBUS signal was sent down to the
46 * controller, and <code>false</code> if the signal was not sent down, e.g.
47 * because the controller was not running. Notice that the MODBUS signal
48 * must support writes, consult the Aubo MODBUS protocol.
49 */
50 bool setValue(int value);
51
52 /**
53 * @ingroup ModbusIo
54 * @return the integer value of the MODBUS signal. If the MODBUS signal is
55 * digital then <code>false</code> is represented by 0 and
56 * <code>true}</code> is represented by the value 1.
57 */
58 int getValue();
59
60 private:
61 friend class DataSwitch;
62 ModbusIo();
63 void *d_{ nullptr };
64 };
65
66 struct ModbusIoFilter
67 {
68 ModbusIoFilter(Io::IoType type, bool is_input)
69 : type_(type), is_input_(is_input)
70 {
71 }
72 bool operator()(IoPtr io)
73 {
74 return std::dynamic_pointer_cast<ModbusIo>(io) != nullptr &&
75 io->getType() == type_ && io->isInput() == is_input_;
76 }
77
78 private:
79 Io::IoType type_;
80 bool is_input_;
81 };
82
83 } // namespace aubo_scope
84 } // namespace arcs
85
86 #endif // MODBUSIO_H
ARCS_ABI_EXPORT
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16
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::IoType
IoType
Definition: io.h:20
arcs::aubo_scope::ModbusIo
Definition: modbus_io.h:15
arcs::aubo_scope::ModbusIo::~ModbusIo
~ModbusIo()
arcs::aubo_scope::ModbusIo::ModbusIo
ModbusIo(ModbusIo &f)
arcs::aubo_scope::ModbusIo::ModbusIo
ModbusIo()
arcs::aubo_scope::ModbusIo::ModbusIo
ModbusIo(ModbusIo &&f)
arcs::aubo_scope::ModbusIo::setValue
bool setValue(int value)
arcs::aubo_scope::ModbusIo::getIpAddress
std::string getIpAddress()
arcs::aubo_scope::ModbusIo::getSignalAddress
std::string getSignalAddress()
arcs::aubo_scope::ModbusIo::getValue
int getValue()
arcs::aubo_scope::ModbusIo::isSlave
bool isSlave()
io.h
arcs::aubo_scope::ARCS_CLASS_FORWARD
ARCS_CLASS_FORWARD(GripForceCapability)
arcs
Definition: contribution_provider.h:7
arcs::aubo_scope::ModbusIoFilter
Definition: modbus_io.h:67
arcs::aubo_scope::ModbusIoFilter::is_input_
bool is_input_
Definition: modbus_io.h:80
arcs::aubo_scope::ModbusIoFilter::type_
Io::IoType type_
Definition: modbus_io.h:79
arcs::aubo_scope::ModbusIoFilter::operator()
bool operator()(IoPtr io)
Definition: modbus_io.h:72
arcs::aubo_scope::ModbusIoFilter::ModbusIoFilter
ModbusIoFilter(Io::IoType type, bool is_input)
Definition: modbus_io.h:68