FieldTalk Modbus® Slave Library C++ Editions |
![]() |
This class realises the MODBUS/TCP slave protocol. It provides functions to start-up and to execute the server engine. This server engine can handle multiple master connections and is implemented as a single threaded TCP server. Upon receipt of a valid master query the server engine calls Data Provider methods to exchange data with the user application. For a more detailed description which Modbus data and control functions have been implemented in the server engine see section Server Functions common to all Protocol Flavours.
MODBUS/TCP Server Management Functions | |
MbusTcpSlaveProtocol () | |
Constructs a MbusTcpSlaveProtocol object. | |
MbusTcpSlaveProtocol (MbusDataTableInterface *dataTablePtr) | |
Constructs a MbusTcpSlaveProtocol object data and associates it with a Data Provider. | |
int | startupServer () |
Puts the Modbus server into operation. | |
int | startupServer (const char *const hostName) |
Puts the Modbus server into operation. | |
int | startupServer (int slaveAddr) |
Puts the Modbus server into operation using a single slave address and data table. | |
int | startupServer (int slaveAddr, const char *const hostName) |
Puts the Modbus server into operation using a single slave address and data table. | |
void | shutdownServer () |
Shuts down the Modbus server. | |
int | serverLoop () |
MODBUS/TCP slave server loop. | |
int | isStarted () |
Returns if server has been started up. | |
int | getConnectionStatus () |
Checks if a Modbus master is polling periodically. | |
int | setPort (unsigned short portNo) |
Sets the TCP port number to be used by the protocol. | |
void | installIpAddrValidationCallBack (int(*f)(char *masterIpAddrSz)) |
This function installs a callback handler for validating a master's IP address. | |
unsigned short | getPort () |
Returns the TCP port number used by the protocol. | |
Server Management Functions | |
int | addDataTable (int slaveAddr, MbusDataTableInterface *dataTablePtr) |
Associates a protocol object with a Data Provider and a slave address. | |
Protocol Configuration | |
long | setTimeout (long timeOut) |
Configures master transmit time-out supervision. | |
long | getTimeout () |
Returns the master time-out supervision value. | |
Transmission Statistic Functions | |
unsigned long | getTotalCounter () |
Returns how often a message transfer has been executed. | |
void | resetTotalCounter () |
Resets total message transfer counter. | |
unsigned long | getSuccessCounter () |
Returns how often a message transfer was successful. | |
void | resetSuccessCounter () |
Resets successful message transfer counter. | |
Utility Functions | |
static char * | getPackageVersion () |
Returns the package version number. |
|
Constructs a MbusTcpSlaveProtocol object. The association with a Data Provider is done after construction using the addDataTable method. |
|
Constructs a MbusTcpSlaveProtocol object data and associates it with a Data Provider. Function is kept for compatibility with previous API versions, do not use for new implementations.
|
|
Puts the Modbus server into operation. The server accepts connections on any interface. This function opens a TCP/IP socket, binds the configured TCP port to the Modbus/TCP protocol and initialises the server engine.
|
|
Puts the Modbus server into operation. The server accepts connections only on the interfaces which match the supplied hostname or IP address. This method allows to run different servers on multiple interfaces (so called multihomed servers). This function opens a TCP/IP socket, binds the configured TCP port to the Modbus/TCP protocol and initialises the server engine.
|
|
Puts the Modbus server into operation using a single slave address and data table. The server accepts connections on any interface. Function is kept for compatibility with previous API versions, do not use for new implementations.
|
|
Puts the Modbus server into operation using a single slave address and data table. Function is kept for compatibility with previous API versions, do not use for new implementations.
|
|
Shuts down the Modbus server. This function closes all TCP/IP connections to MODBUS/TCP masters and releases any system resources associated with the connections. Reimplemented from MbusSlaveServer. |
|
MODBUS/TCP slave server loop. This server loop must be called continuously. It must not be blocked. The server has to be started before calling the serverLoop() method. This server engine can handle multiple TCP/IP connections at the same time.
Implements MbusSlaveServer. |
|
Returns if server has been started up.
Implements MbusSlaveServer. |
|
Checks if a Modbus master is polling periodically.
Implements MbusSlaveServer. |
|
Sets the TCP port number to be used by the protocol.
|
|
This function installs a callback handler for validating a master's IP address. Pass a pointer to a function with checks a master's IP address and either accepts or rejects a master's connection.
|
|
Returns the TCP port number used by the protocol.
|
Copyright © 2002-2006
FOCUS Software Engineering Pty Ltd, Australia.
All rights reserved.
Please see the Notices page for trademark notices. Last updated: 20 Oct 2006 |