rodbus (C++ API) 1.3.1
Loading...
Searching...
No Matches
rodbus.hpp File Reference
#include <cstdint>
#include <stdexcept>
#include <chrono>
#include <memory>
#include <vector>

Go to the source code of this file.

Classes

class  rodbus::ParamException
 Exception type corresponding to the underlying error enum ParamError. More...
 
struct  rodbus::DecodeLevel
 Controls the decoding of transmitted and received data at the application, frame, and physical layer. More...
 
struct  rodbus::BitValue
 Index/value tuple of a bit type. More...
 
struct  rodbus::RegisterValue
 Index/value tuple of a register type. More...
 
struct  rodbus::RuntimeConfig
 Runtime configuration. More...
 
class  rodbus::Runtime
 Handle to the underlying runtime. More...
 
class  rodbus::RequestException
 Exception type corresponding to the underlying error enum RequestError. More...
 
struct  rodbus::AddressRange
 Range of 16-bit addresses sent in a request from the client to the server. More...
 
struct  rodbus::RequestParam
 Address and timeout parameters for requests. More...
 
class  rodbus::BitValueIterator
 Iterator over BitValue instances. More...
 
class  rodbus::RegisterValueIterator
 Iterator over RegisterValue instances. More...
 
struct  rodbus::SerialPortSettings
 Serial port settings. More...
 
struct  rodbus::RetryStrategy
 Retry strategy configuration. More...
 
struct  rodbus::LoggingConfig
 Logging configuration options. More...
 
class  rodbus::Logger
 Logging interface that receives the log messages and writes them somewhere. More...
 
class  rodbus::functional::LoggerLambda< T >
 class that implements Logger in terms of a lambda expression More...
 
class  rodbus::Logging
 Provides a static method for configuring logging. More...
 
struct  rodbus::TlsClientConfig
 TLS client configuration. More...
 
class  rodbus::ClientStateListener
 Callback for monitoring the state of a TCP/TLS connection state. More...
 
class  rodbus::functional::ClientStateListenerLambda< T >
 class that implements ClientStateListener in terms of a lambda expression More...
 
class  rodbus::PortStateListener
 Callback interface for receiving updates about the state of a serial port. More...
 
class  rodbus::functional::PortStateListenerLambda< T >
 class that implements PortStateListener in terms of a lambda expression More...
 
class  rodbus::BitReadCallback
 Callbacks received when reading coils or discrete inputs. More...
 
class  rodbus::RegisterReadCallback
 Callbacks received when reading reading holding or input registers. More...
 
class  rodbus::WriteCallback
 Callback methods received from asynchronous write operations. More...
 
class  rodbus::ClientChannel
 Abstract representation of a client communication channel. More...
 
class  rodbus::Database
 Class used to add, remove, update, and retrieve values. More...
 
class  rodbus::DatabaseCallback
 Callback used to access the internal database while it is locked. More...
 
class  rodbus::functional::DatabaseCallbackLambda< T >
 class that implements DatabaseCallback in terms of a lambda expression More...
 
struct  rodbus::WriteResult
 Describes to the server if a write operation was successful or not. More...
 
class  rodbus::WriteHandler
 Interface used to handle write requests received from the client. More...
 
class  rodbus::DeviceMap
 Maps endpoint handlers to Modbus address. More...
 
struct  rodbus::TlsServerConfig
 TLS server configuration. More...
 
class  rodbus::AuthorizationHandler
 User implemented interface defines which request and roles are allowed for different functions when implementing Modbus security. More...
 
class  rodbus::AddressFilter
 Filter used to restrict which IP addresses may communicate with a server. More...
 
class  rodbus::Server
 Handle to the running server. The server runs on a background task until this class is destroyed. More...
 

Namespaces

namespace  rodbus
 main namespace for the rodbus library
 
namespace  rodbus::functional
 helpers functions to create interface implementations using lambdas
 

Enumerations

enum class  rodbus::ParamError {
  rodbus::ok = 0 , rodbus::no_support = 1 , rodbus::null_parameter = 2 , rodbus::logging_already_configured = 3 ,
  rodbus::runtime_creation_failure = 4 , rodbus::runtime_destroyed = 5 , rodbus::runtime_cannot_block_within_async = 6 , rodbus::invalid_ip_address = 7 ,
  rodbus::invalid_range = 8 , rodbus::invalid_request = 9 , rodbus::invalid_index = 10 , rodbus::server_bind_error = 11 ,
  rodbus::invalid_unit_id = 12 , rodbus::invalid_peer_certificate = 13 , rodbus::invalid_local_certificate = 14 , rodbus::invalid_private_key = 15 ,
  rodbus::invalid_dns_name = 16 , rodbus::bad_tls_config = 17 , rodbus::shutdown = 18 , rodbus::invalid_utf8 = 19
}
 Error type that indicates a bad parameter or bad programmer logic. More...
 
enum class  rodbus::Nothing { rodbus::nothing = 0 }
 A single value enum which is used as a placeholder for futures that don't return a value. More...
 
enum class  rodbus::AppDecodeLevel { rodbus::nothing = 0 , rodbus::function_code = 1 , rodbus::data_headers = 2 , rodbus::data_values = 3 }
 Controls how transmitted and received message at the application layer are decoded at the INFO log level. More...
 
enum class  rodbus::FrameDecodeLevel { rodbus::nothing = 0 , rodbus::header = 1 , rodbus::payload = 2 }
 Controls how the transmitted and received frames are decoded at the INFO log level. More...
 
enum class  rodbus::PhysDecodeLevel { rodbus::nothing = 0 , rodbus::length = 1 , rodbus::data = 2 }
 Controls how data transmitted at the physical layer (TCP, serial, etc) is logged. More...
 
enum class  rodbus::RequestError {
  rodbus::ok = 0 , rodbus::shutdown = 1 , rodbus::no_connection = 2 , rodbus::response_timeout = 3 ,
  rodbus::bad_request = 4 , rodbus::bad_response = 5 , rodbus::io_error = 6 , rodbus::bad_framing = 7 ,
  rodbus::internal_error = 8 , rodbus::bad_argument = 9 , rodbus::modbus_exception_illegal_function = 10 , rodbus::modbus_exception_illegal_data_address = 11 ,
  rodbus::modbus_exception_illegal_data_value = 12 , rodbus::modbus_exception_server_device_failure = 13 , rodbus::modbus_exception_acknowledge = 14 , rodbus::modbus_exception_server_device_busy = 15 ,
  rodbus::modbus_exception_memory_parity_error = 16 , rodbus::modbus_exception_gateway_path_unavailable = 17 , rodbus::modbus_exception_gateway_target_device_failed_to_respond = 18 , rodbus::modbus_exception_unknown = 19
}
 Error information returned from asynchronous functions calls. More...
 
enum class  rodbus::ModbusException {
  rodbus::illegal_function = 1 , rodbus::illegal_data_address = 2 , rodbus::illegal_data_value = 3 , rodbus::server_device_failure = 4 ,
  rodbus::acknowledge = 5 , rodbus::server_device_busy = 6 , rodbus::memory_parity_error = 8 , rodbus::gateway_path_unavailable = 10 ,
  rodbus::gateway_target_device_failed_to_respond = 11 , rodbus::unknown = 255
}
 Error information returned during asynchronous API calls. More...
 
enum class  rodbus::DataBits { rodbus::five = 0 , rodbus::six = 1 , rodbus::seven = 2 , rodbus::eight = 3 }
 Number of bits per character. More...
 
enum class  rodbus::FlowControl { rodbus::none = 0 , rodbus::software = 1 , rodbus::hardware = 2 }
 Flow control modes. More...
 
enum class  rodbus::Parity { rodbus::none = 0 , rodbus::odd = 1 , rodbus::even = 2 }
 Parity checking modes. More...
 
enum class  rodbus::StopBits { rodbus::one = 0 , rodbus::two = 1 }
 Number of stop bits. More...
 
enum class  rodbus::MinTlsVersion { rodbus::v12 = 0 , rodbus::v13 = 1 }
 Minimum TLS version to allow. More...
 
enum class  rodbus::CertificateMode { rodbus::authority_based = 0 , rodbus::self_signed = 1 }
 Determines how the certificate(s) presented by the peer are validated. More...
 
enum class  rodbus::LogLevel {
  rodbus::error = 0 , rodbus::warn = 1 , rodbus::info = 2 , rodbus::debug = 3 ,
  rodbus::trace = 4
}
 Log level. More...
 
enum class  rodbus::LogOutputFormat { rodbus::text = 0 , rodbus::json = 1 }
 Describes how each log event is formatted. More...
 
enum class  rodbus::TimeFormat { rodbus::none = 0 , rodbus::rfc_3339 = 1 , rodbus::system = 2 }
 Describes if and how the time will be formatted in log messages. More...
 
enum class  rodbus::ClientState {
  rodbus::disabled = 0 , rodbus::connecting = 1 , rodbus::connected = 2 , rodbus::wait_after_failed_connect = 3 ,
  rodbus::wait_after_disconnect = 4 , rodbus::shutdown = 5
}
 State of the client connection. More...
 
enum class  rodbus::PortState { rodbus::disabled = 0 , rodbus::wait = 1 , rodbus::open = 2 , rodbus::shutdown = 3 }
 State of the serial port. More...
 
enum class  rodbus::Authorization { rodbus::allow = 0 , rodbus::deny = 1 }
 Authorization result used by AuthorizationHandler. More...
 

Functions

const char * rodbus::to_string (ParamError value)
 convert an instance of enum ParamError into a C-style string More...
 
const char * rodbus::to_string (Nothing value)
 convert an instance of enum Nothing into a C-style string More...
 
const char * rodbus::to_string (AppDecodeLevel value)
 convert an instance of enum AppDecodeLevel into a C-style string More...
 
const char * rodbus::to_string (FrameDecodeLevel value)
 convert an instance of enum FrameDecodeLevel into a C-style string More...
 
const char * rodbus::to_string (PhysDecodeLevel value)
 convert an instance of enum PhysDecodeLevel into a C-style string More...
 
const char * rodbus::to_string (RequestError value)
 convert an instance of enum RequestError into a C-style string More...
 
const char * rodbus::to_string (ModbusException value)
 convert an instance of enum ModbusException into a C-style string More...
 
const char * rodbus::to_string (DataBits value)
 convert an instance of enum DataBits into a C-style string More...
 
const char * rodbus::to_string (FlowControl value)
 convert an instance of enum FlowControl into a C-style string More...
 
const char * rodbus::to_string (Parity value)
 convert an instance of enum Parity into a C-style string More...
 
const char * rodbus::to_string (StopBits value)
 convert an instance of enum StopBits into a C-style string More...
 
const char * rodbus::to_string (MinTlsVersion value)
 convert an instance of enum MinTlsVersion into a C-style string More...
 
const char * rodbus::to_string (CertificateMode value)
 convert an instance of enum CertificateMode into a C-style string More...
 
const char * rodbus::to_string (LogLevel value)
 convert an instance of enum LogLevel into a C-style string More...
 
const char * rodbus::to_string (LogOutputFormat value)
 convert an instance of enum LogOutputFormat into a C-style string More...
 
const char * rodbus::to_string (TimeFormat value)
 convert an instance of enum TimeFormat into a C-style string More...
 
template<class T >
std::unique_ptr< Logger > rodbus::functional::logger (const T &lambda)
 construct an implementation of Logger based on a lambda expression More...
 
const char * rodbus::to_string (ClientState value)
 convert an instance of enum ClientState into a C-style string More...
 
template<class T >
std::unique_ptr< ClientStateListener > rodbus::functional::client_state_listener (const T &lambda)
 construct an implementation of ClientStateListener based on a lambda expression More...
 
const char * rodbus::to_string (PortState value)
 convert an instance of enum PortState into a C-style string More...
 
template<class T >
std::unique_ptr< PortStateListener > rodbus::functional::port_state_listener (const T &lambda)
 construct an implementation of PortStateListener based on a lambda expression More...
 
template<class T >
DatabaseCallbackLambda< T > rodbus::functional::database_callback (const T &lambda)
 construct an implementation of DatabaseCallback based on a lambda expression More...
 
const char * rodbus::to_string (Authorization value)
 convert an instance of enum Authorization into a C-style string More...
 

Variables

constexpr uint64_t rodbus::rodbus_version_major = 1
 major version number More...
 
constexpr uint64_t rodbus::rodbus_version_minor = 3
 minor version number More...
 
constexpr uint64_t rodbus::rodbus_version_patch = 1
 patch version number More...
 
constexpr char const * rodbus::rodbus_version_string = "1.3.1"
 version number as the string major.minor.patch More...
 

Detailed Description

C++ API for the rodbus library