Commit 2b637911f4de113cfde00e24d18dab93c0956fcb
1 parent
86fed624
Add TCP connection
Showing
3 changed files
with
10 additions
and
10 deletions
src/modbusbase.h
| @@ -66,14 +66,14 @@ public: | @@ -66,14 +66,14 @@ public: | ||
| 66 | * \param length | 66 | * \param length |
| 67 | * \return | 67 | * \return |
| 68 | */ | 68 | */ |
| 69 | - virtual ssize_t modbusSend(uint8_t *to_send, size_t length) = 0; | 69 | + virtual int modbusSend(uint8_t *to_send, size_t length) = 0; |
| 70 | 70 | ||
| 71 | /*! | 71 | /*! |
| 72 | * \brief modbusReceive | 72 | * \brief modbusReceive |
| 73 | * \param buffer | 73 | * \param buffer |
| 74 | * \return | 74 | * \return |
| 75 | */ | 75 | */ |
| 76 | - virtual ssize_t modbusReceive(uint8_t *buffer) = 0; | 76 | + virtual int modbusReceive(uint8_t *buffer) = 0; |
| 77 | 77 | ||
| 78 | // Modbus implementation(s) | 78 | // Modbus implementation(s) |
| 79 | /*! | 79 | /*! |
src/modbustcp.cpp
| @@ -14,22 +14,22 @@ ModbusTcp::ModbusTcp(const ConnectionConfig &con_config) | @@ -14,22 +14,22 @@ ModbusTcp::ModbusTcp(const ConnectionConfig &con_config) | ||
| 14 | 14 | ||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | -bool ModbusTcp::Open() const | 17 | +bool ModbusTcp::Connect() |
| 18 | { | 18 | { |
| 19 | 19 | ||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | -bool ModbusTcp::Close() const | 22 | +bool ModbusTcp::Close() |
| 23 | { | 23 | { |
| 24 | 24 | ||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | -int ModbusTcp::Read(uint8_t *buffer) const | 27 | +int ModbusTcp::modbusReceive(uint8_t *buffer) |
| 28 | { | 28 | { |
| 29 | - | 29 | + return 0; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | -int ModbusTcp::Write(uint8_t *buffer, size_t length) const | 32 | +int ModbusTcp::modbusSend(uint8_t *buffer, size_t length) |
| 33 | { | 33 | { |
| 34 | - | 34 | + return 0; |
| 35 | } | 35 | } |
src/modbustcp.h
| @@ -37,14 +37,14 @@ public: | @@ -37,14 +37,14 @@ public: | ||
| 37 | * \param length | 37 | * \param length |
| 38 | * \return | 38 | * \return |
| 39 | */ | 39 | */ |
| 40 | - virtual ssize_t mmodbusSend(uint8_t *to_send, size_t length) override; | 40 | + virtual int modbusSend(uint8_t *to_send, size_t length) override; |
| 41 | 41 | ||
| 42 | /*! | 42 | /*! |
| 43 | * \brief modbusReceive | 43 | * \brief modbusReceive |
| 44 | * \param buffer | 44 | * \param buffer |
| 45 | * \return | 45 | * \return |
| 46 | */ | 46 | */ |
| 47 | - virtual ssize_t modbusReceive(uint8_t *buffer) const override; | 47 | + virtual int modbusReceive(uint8_t *buffer) override; |
| 48 | 48 | ||
| 49 | private: | 49 | private: |
| 50 | uint16_t m_port {502}; | 50 | uint16_t m_port {502}; |