C++ Based OPC UA Client/Server/PubSub SDK
1.7.9.586
|
Base class for the main OPC Server management object. More...
#include <uacoreserverapplication.h>
Inherits UaApplication.
Inherited by UaServerApplication.
Public Member Functions | |
UaCoreServerApplication () | |
Creates an instance of UaCoreServerApplication with default settings. More... | |
UaCoreServerApplication (int argc, char *argv[], bool bRunAsService, const UaString &sApplicationName) | |
Creates an instance of UaCoreServerApplication with service related settings. More... | |
virtual | ~UaCoreServerApplication () |
Destroys the UaCoreServerApplication object. More... | |
int | setServerConfig (const UaString &configurationFile, const UaString &sApplicationPath) |
Sets the server configuration by passing the path of the configuration file. More... | |
int | setServerConfig (const UaString &configurationFile, const UaString &sApplicationPath, const UaString &sConfigPath, const UaString &sTracePath) |
Sets the server configuration by passing the path of the configuration file. More... | |
int | setServerConfig (ServerConfig *pServerConfig) |
Sets the server configuration by passing a server configuration object. More... | |
int | addNodeManager (NodeManager *pNodeManager) |
Adds a node manager to the SDK. More... | |
int | addModule (UaServerApplicationModule *pModule) |
Adds a Module to the SDK. More... | |
int | removeNodeManager (NodeManager *pNodeManager) |
Removes and deletes the NodeManager from the SDK. More... | |
int | removeModule (UaServerApplicationModule *pModule) |
Removes and deletes the Module from the SDK. More... | |
int | setCallback (UaServerApplicationCallback *pUaServerApplicationCallback) |
Sets the callback interface for the server object. More... | |
void | setSecondsTillShutdown (OpcUa_Int32 secondsTillShutdown) |
Set seconds till shudown sent to OPC UA client during shut down. | |
void | setShutdownReason (const UaLocalizedText &shutdownReason) |
Set shudown reason sent to OPC UA client during shut down. | |
int | start () |
Starts the OPC server Initializes and starts up all NodeManagers and SDK modules. More... | |
int | stop (OpcUa_Int32 secondsTillShutdown, const UaLocalizedText &shutdownReason) |
Stopps the OPC server Shutdown and deletes all SDK modules and NodeManagers. More... | |
NodeManagerConfig * | getDefaultNodeManager () |
Returns the default node manager for server specific nodes in namespace one. More... | |
ServerManager * | getServerManager () |
Returns the ServerManager object. | |
ServerConfig * | getServerConfig () |
Returns the ServerConfig object. | |
CoreModule * | getCoreModule () |
Returns the CoreModule object. | |
OpcUa_Boolean | isStarted () |
Returns the isStarted flag. | |
OpcUa_Int32 | secondsTillShutdown () |
Get seconds till shudown sent to OPC UA client during shut down. | |
UaLocalizedText | shutdownReason () |
Get shudown reason sent to OPC UA client during shut down. | |
virtual Session * | createDefaultSession (OpcUa_Int32 sessionID, const UaNodeId &authenticationToken)=0 |
Creates a session object for the OPC server. More... | |
Protected Member Functions | |
virtual UaStatus | afterInitialize ()=0 |
This method needs to be implemented by the derived class and is called to finish the initialization of the UaCoreServerApplication. More... | |
virtual UaStatus | afterStartUp ()=0 |
This method needs to be implemented by the derived class and is called to finish the start-up of the UaCoreServerApplication. More... | |
virtual UaStatus | beforeShutdown ()=0 |
This method needs to be implemented by the derived class and is called to start the shutdown of the UaCoreServerApplication. More... | |
virtual int | main () |
Main function for server process. More... | |
Base class for the main OPC Server management 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.
A derived class must implement the methods afterInitialize(), afterStartUp() and beforeShutdown(). In addition the derived class must add the following code to the destructor to make sure beforeShutdown() is called before the object is deleted.
UaCoreServerApplication::UaCoreServerApplication | ( | ) |
Creates an instance of UaCoreServerApplication with default settings.
UaCoreServerApplication::UaCoreServerApplication | ( | int | argc, |
char * | argv[], | ||
bool | bRunAsService, | ||
const UaString & | sApplicationName | ||
) |
Creates an instance of UaCoreServerApplication with service related settings.
|
virtual |
Destroys the UaCoreServerApplication object.
int UaCoreServerApplication::addModule | ( | UaServerApplicationModule * | pModule | ) |
Adds a Module to the SDK.
The module will be managed by this class including starting, stopping and deletion of the module. The method can be called several times for a list of modules.
If the method is called before start, all modules will be started during the call of the start method. If this method is called if the server is already started the module will be started by this method.
The class manages takes ownership of the module and will delete the module at shut-down or removal.
int UaCoreServerApplication::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.
The class manages takes ownership of the node manager and will delete the module at shut-down or removal.
|
protectedpure virtual |
This method needs to be implemented by the derived class and is called to finish the initialization of the UaCoreServerApplication.
This method is typically used to initialize the communication modules like the UaModule.
Implemented in UaServerApplication.
|
protectedpure virtual |
This method needs to be implemented by the derived class and is called to finish the start-up of the UaCoreServerApplication.
This method is typically used to start up the communication modules like the UaModule.
Implemented in UaServerApplication, and OpcServer.
|
protectedpure virtual |
This method needs to be implemented by the derived class and is called to start the shutdown of the UaCoreServerApplication.
This method is typically used to stop the communication modules like the UaModule.
Implemented in UaServerApplication.
|
pure virtual |
Creates a session object for the OPC server.
This is the default implementation. It can be overwritten by implementing the UaServerApplicationCallback.
sessionID | Session Id created by the server application. |
authenticationToken | Secret session Id created by the server application. |
Implemented in UaServerApplication.
NodeManagerConfig * UaCoreServerApplication::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.
|
protectedvirtual |
int UaCoreServerApplication::removeModule | ( | UaServerApplicationModule * | pModule | ) |
Removes and deletes the Module from the SDK.
Shuts down and removes the Module from the management. Deletes the Module after shut down.
pModule | Module to remove. |
int UaCoreServerApplication::removeNodeManager | ( | NodeManager * | pNodeManager | ) |
Removes and deletes the NodeManager from the SDK.
Shuts down and removes the NodeManager from the management. Deletes the NodeManager after shut down.
pNodeManager | NodeManager to remove. |
int UaCoreServerApplication::setCallback | ( | UaServerApplicationCallback * | pUaServerApplicationCallback | ) |
Sets the callback interface for the server object.
This callback interface needs to be implemented if the application wants to implement user authentication.
pUaServerApplicationCallback | Interface pointer of the callback interface. |
int UaCoreServerApplication::setServerConfig | ( | const UaString & | configurationFile, |
const UaString & | sApplicationPath | ||
) |
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.
configurationFile | Path 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_PARSER set to 1 |
sApplicationPath | The path of the application folder used to replace the [ApplicationPath] placeholders in the configuration file |
int UaCoreServerApplication::setServerConfig | ( | const UaString & | configurationFile, |
const UaString & | sApplicationPath, | ||
const UaString & | sConfigPath, | ||
const UaString & | sTracePath | ||
) |
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.
configurationFile | Path 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_PARSER set to 1 |
sApplicationPath | The path of the application folder used to replace the [ApplicationPath] placeholders in the configuration file |
sConfigPath | The path of the configuration files and PKI store used to replace the [ConfigPath] placeholders in the configuration file |
sTracePath | The path of the trace file folder used to replace the [TracePath] placeholders in the configuration file |
int UaCoreServerApplication::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.
pServerConfig | Interface pointer of the object implementing the ServerConfig interface. |
int UaCoreServerApplication::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.
int UaCoreServerApplication::stop | ( | OpcUa_Int32 | secondsTillShutdown, |
const UaLocalizedText & | shutdownReason | ||
) |
Stopps the OPC server Shutdown and deletes all SDK modules and NodeManagers.
secondsTillShutdown | Seconds till shutdown of the server if clients are connected. |
shutdownReason | Reason for the shutdown. |