OpcServer Class Reference

#include <opcserver.h>

Collaboration diagram for OpcServer:

List of all members.

Public Member Functions

 OpcServer ()
 ~OpcServer ()
int setServerConfig (const UaString &configurationFile, const UaString &applicationPath)
int setServerConfig (ServerConfig *pServerConfig)
int addNodeManager (NodeManager *pNodeManager)
int setCallback (OpcServerCallback *pOpcServerCallback)
int start ()
int stop (OpcUa_Int32 secondsTillShutdown, const UaLocalizedText &shutdownReason)
NodeManagerConfiggetDefaultNodeManager ()

Detailed Description

Main OPC Server object. This class is a utility class managing all server SDK modules for common use cases in a simplified way. Enhanced users may replace this class with their own implementation to be able to use derived classes to overwrite SDK functionality.


Constructor & Destructor Documentation

OpcServer::OpcServer (  )

Construction.

OpcServer::~OpcServer (  )

Destruction.


Member Function Documentation

int OpcServer::addNodeManager ( NodeManager pNodeManager )

Adds a node manager to the SDK. The node manager will be managed by this class including starting, stopping and deletion of the node manager. The method can be called several times for a list of node managers. If the method is called before start, all node managers will be started during the call of the start method. If this method is called if the server is already started the node manager will be started by this method.

Returns:
Success code for the operation. Return 0 if adding the node manager succedded and -1 if adding the node manager failed.
NodeManagerConfig * OpcServer::getDefaultNodeManager (  )

Returns the default node manager for server specific nodes in namespace one. This node manager can be used to create objects and variables for data access. It can not be used for enhanced OPC UA features. Usind features like events, methods and historical access requires the implementation of a specific node manager.

Returns:
NodeManagerConfig interface used to add and delete UaNode objects in the node manager. Returns NULL if the server is not started.
int OpcServer::setCallback ( OpcServerCallback pOpcServerCallback )

Sets the callback interface for the server object. This callback interface needs to be implemented if the application wants to implement user authentication.

Parameters:
pOpcServerCallbackInterface pointer of the callback interface.
Returns:
Success code for the operation. Return 0 if the call succedded and -1 if the call failed. This call fails if it is called after starting the server with the method start.
int OpcServer::setServerConfig ( ServerConfig pServerConfig )

Sets the server configuration by passing a server configuration object. One of the overloaded methods needs to be called to give the server a valid configuration.
This version allows to pass in a ServerConfig object with a user specific implementation.

Parameters:
pServerConfigInterface pointer of the object implementing the ServerConfig interface.
Returns:
Success code for the operation. Return 0 if the call succedded and -1 if the call failed. This call fails if it is called after starting the server with the method start.
int OpcServer::setServerConfig ( const UaString configurationFile,
const UaString applicationPath 
)

Sets the server configuration by passing the path of the configuration file. One of the overloaded methods needs to be called to give the server a valid configuration.
This version forces the server to use the default implementation for the ServerConfig object and allows to specify the configuraiton file and the path to the application or the directory containing the configuration and the PKI store..

Parameters:
configurationFilePath and file name of the configuration file. The file can be one of the two file formats supported by the SDK, a XML file format and an INI file format. The XML file format requires linking of the XML parser module and needs to be activated by compiling this class with the compiler switch SUPPORT_XML_CONFIG
applicationPathThe path of the configuration file and PKI store used to replace path placeholders in the configuration file
Returns:
Success code for the operation. Return 0 if the call succedded and -1 if the call failed. This call fails if it is called after starting the server with the method start.
int OpcServer::start (  )

Starts the OPC server Initializes and starts up all NodeManagers and SDK modules. It is possible to add more NodeManagers after the server is started.

Returns:
Success code for the operation. Return 0 if the server start succedded and -1 if the server start failed.
int OpcServer::stop ( OpcUa_Int32  secondsTillShutdown,
const UaLocalizedText shutdownReason 
)

Stopps the OPC server Shutdown and deletes all SDK modules and NodeManagers.

Parameters:
secondsTillShutdownSeconds till shutdown of the server if clients are connected.
shutdownReasonReason for the shutdown.
Returns:
Success code for the operation. Return 0 if the server stop succedded and -1 if the server stop failed.

The documentation for this class was generated from the following files:
  • /home/buildbot/work/uasdkcpp/examples/utilities/opcserver.h
  • /home/buildbot/work/uasdkcpp/examples/utilities/opcserver.cpp