123456789101112131415161718192021222324252627282930313233343536373839 |
- #ifndef _GATEWAY_SCHEDULER_MODBUS_UTILS_H_
- #define _GATEWAY_SCHEDULER_MODBUS_UTILS_H_
- #include <modbus/modbus.h>
- #include <cstdint>
- #include <string>
- #include <vector>
- namespace server {
- namespace utils {
- class ModbusUtils {
- public:
- ModbusUtils();
- ~ModbusUtils();
- bool connect();
- bool disconnect();
- std::vector<uint16_t> read();
- private:
- std::string device;
- std::int32_t baudrate;
- bool parity;
- std::int32_t dataBits;
- std::int32_t stopBits;
- modbus_t *context;
- };
- } // namespace utils
- } // namespace server
- #endif
|