Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Stroika::Frameworks::Modbus Namespace Reference

Classes

struct  IModbusService
 
struct  ModbusRegisterDescriptor
 

Typedefs

using CoilsDescriptorType = ModbusRegisterDescriptor< uint16_t, bool >
 
using DiscreteInputDescriptorType = ModbusRegisterDescriptor< uint16_t, bool >
 
using InputRegisterDescriptorType = ModbusRegisterDescriptor< uint16_t, uint16_t >
 
using HoldingRegisterDescriptorType = ModbusRegisterDescriptor< uint16_t, uint16_t >
 

Enumerations

enum class  ExceptionCode : uint8_t
 

Functions

Execution::Thread::Ptr MakeModbusTCPServerThread (const shared_ptr< IModbusService > &serviceHandler, const ServerOptions &options=ServerOptions{})
 

Detailed Description

Note
Code-Status: Beta
This code is basically all based on http://www.modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf
Code-Status: Beta
Testing Note This code was tested and used by a client as of around Stroika v2.0a204, but may not have been used since, and probably has not undergone testing since. It could have small breaks, but I don't have stuff with which to test, so as-is - sorry

Typedef Documentation

◆ CoilsDescriptorType

From http://www.modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf page 8 Coils Single bit Read-Write This type of data can be alterable by an application program

Definition at line 49 of file IModbusService.h.

◆ DiscreteInputDescriptorType

From http://www.modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf page 8 Discretes Input Single bit Read-Only ThiThis type of data can be provided by an I/O system

Definition at line 55 of file IModbusService.h.

◆ InputRegisterDescriptorType

From http://www.modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf page 8 Input Registers 16-bit word Read-Only This type of data can be provided by an I/O system

Definition at line 61 of file IModbusService.h.

◆ HoldingRegisterDescriptorType

This is for 2-byte read/write data - data read from the server, and which may be written to the server.

Definition at line 66 of file IModbusService.h.

Enumeration Type Documentation

◆ ExceptionCode

enum class Stroika::Frameworks::Modbus::ExceptionCode : uint8_t
strong

From http://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf page 49

Note
These really don't appear to capture any application logic or application notion of failure, and principally deal with communications failure.

SLAVE_DEVICE_FAILURE may be the only exception, which is somewhat of a blanket - server failed - HTTP 503 like - (or so it appears).

Definition at line 77 of file IModbusService.h.

Function Documentation

◆ MakeModbusTCPServerThread()

Thread::Ptr Stroika::Frameworks::Modbus::MakeModbusTCPServerThread ( const shared_ptr< IModbusService > &  serviceHandler,
const ServerOptions &  options = ServerOptions{} 
)

Construct a Modbus TCP Listener which will listen for Modbus connections, run them using the optionally provided thread pool (and other configuration options) and send actual handler requests to the argument IModbusService handler.

Supported Function Codes: o kReadCoils (#1) o ReadDiscreteInputs (#2) o ReadHoldingResisters (#3) o ReadInputRegister (#4) o WriteSingleCoil (#5)

Precondition
serviceHandler != nullptr

Definition at line 435 of file Server.cpp.