C++ Based OPC UA Client/Server SDK  1.5.5.355
UaServerApplication Class Reference

Base class for the main OPC UA Server management object. More...

#include <uaserverapplication.h>

Inherits UaCoreServerApplication, and UaApplicationControlCallback.

Inherited by OpcServer.

Public Member Functions

 UaServerApplication ()
 Construction. More...
 
 UaServerApplication (int argc, char *argv[], bool bRunAsService, const UaString &sApplicationName)
 Construction. More...
 
virtual ~UaServerApplication ()
 Destruction. More...
 
OpcUa_UInt32 getEndpointCount ()
 Returns the number of OPC UA endpoints in the server. More...
 
UaEndpointgetEndpoint (OpcUa_UInt32 endpointIndex)
 Returns the endpoint at the sepcified index. More...
 
OpcUa_UInt32 addEndpoint (UaEndpoint *pEndpoint)
 Adds an endpoint to the server. More...
 
UaStatus openEndpoint (OpcUa_UInt32 endpointIndex)
 Opens the endpoint sepcified by the index. More...
 
UaStatus closeEndpoint (OpcUa_UInt32 endpointIndex)
 Closes the endpoint sepcified by the index. More...
 
UaStatus requestServerShutDown (OpcUa_Int32 secondsTillShutdown, const UaLocalizedText &shutdownReason, OpcUa_Boolean restart)
 Requests the shutdown of the OPC UA Server application from the SDK module through an OPC UA method. More...
 
void beforeEndpointOpen (UaEndpoint *pEndpoint, bool certificateAvailable)
 Information about an endpoint that will be opened by the server. More...
 
- Public Member Functions inherited from UaCoreServerApplication
 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...
 
NodeManagerConfiggetDefaultNodeManager ()
 Returns the default node manager for server specific nodes in namespace one. More...
 
ServerManagergetServerManager ()
 Returns the ServerManager object.
 
ServerConfiggetServerConfig ()
 Returns the ServerConfig object.
 
CoreModulegetCoreModule ()
 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.
 
- Public Member Functions inherited from UaApplicationControlCallback
 UaApplicationControlCallback ()
 Construction.
 
virtual ~UaApplicationControlCallback ()
 Destruction.
 

Protected Member Functions

virtual SessioncreateDefaultSession (OpcUa_Int32 sessionID, const UaNodeId &authenticationToken)
 Creates a session object for the OPC server. More...
 
virtual UaStatus afterInitialize ()
 This method needs to be implemented by the derived class and is called to finish the initialization of the UaCoreServerApplication. More...
 
virtual UaStatus afterStartUp ()
 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 ()
 This method needs to be implemented by the derived class and is called to start the shutdown of the UaCoreServerApplication. More...
 
- Protected Member Functions inherited from UaCoreServerApplication
virtual int main ()
 Main function for server process. More...
 

Detailed Description

Base class for the main OPC UA Server management object.

This class is a utility class managing all server SDK modules including the OPC UA communicaiton module 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 may overwrite the methods afterInitialize(), afterStartUp() and beforeShutdown() but must call also the base class methods. In addition the derived class must add the following code to the destructor to make sure beforeShutdown() is called before the object is deleted.

if ( isStarted() != OpcUa_False )
{
UaLocalizedText reason("en","Application shut down");
stop(0, reason);
}

Constructor & Destructor Documentation

UaServerApplication::UaServerApplication ( )

Construction.

UaServerApplication::UaServerApplication ( int  argc,
char *  argv[],
bool  bRunAsService,
const UaString sApplicationName 
)

Construction.

UaServerApplication::~UaServerApplication ( )
virtual

Destruction.

Member Function Documentation

OpcUa_UInt32 UaServerApplication::addEndpoint ( UaEndpoint pEndpoint)

Adds an endpoint to the server.

Returns
Index of added endpoint.
Parameters
[in]pEndpointEndpoiont to add to the server
UaStatus UaServerApplication::afterInitialize ( )
protectedvirtual

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.

Returns
Result code

Implements UaCoreServerApplication.

UaStatus UaServerApplication::afterStartUp ( )
protectedvirtual

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.

Returns
Result code

Implements UaCoreServerApplication.

Reimplemented in OpcServer.

void UaServerApplication::beforeEndpointOpen ( UaEndpoint pEndpoint,
bool  certificateAvailable 
)
virtual

Information about an endpoint that will be opened by the server.

This callbacks allows certificate checks or creation.

This method is used internally by the SDK to forward the information to the application callback.

Parameters
[in]pEndpointUaEndpoint that will be opened by the server
[in]certificateAvailableFlag indicating if a certificate is available

Implements UaApplicationControlCallback.

UaStatus UaServerApplication::beforeShutdown ( )
protectedvirtual

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.

Returns
Result code

Implements UaCoreServerApplication.

UaStatus UaServerApplication::closeEndpoint ( OpcUa_UInt32  endpointIndex)
virtual

Closes the endpoint sepcified by the index.

Parameters
[in]endpointIndexIndex of the Endpoint to close

Implements UaApplicationControlCallback.

Session * UaServerApplication::createDefaultSession ( OpcUa_Int32  sessionID,
const UaNodeId authenticationToken 
)
protectedvirtual

Creates a session object for the OPC server.

This is the default implementation. It can be overwritten by implementing the UaServerApplicationCallback.

Parameters
sessionIDSession Id created by the server application.
authenticationTokenSecret session Id created by the server application.
Returns
A pointer to the created session.

Implements UaCoreServerApplication.

UaEndpoint * UaServerApplication::getEndpoint ( OpcUa_UInt32  endpointIndex)
virtual

Returns the endpoint at the sepcified index.

Parameters
[in]endpointIndexIndex of the Endpoint to return

Implements UaApplicationControlCallback.

OpcUa_UInt32 UaServerApplication::getEndpointCount ( )
virtual

Returns the number of OPC UA endpoints in the server.

Implements UaApplicationControlCallback.

UaStatus UaServerApplication::openEndpoint ( OpcUa_UInt32  endpointIndex)
virtual

Opens the endpoint sepcified by the index.

Parameters
[in]endpointIndexIndex of the Endpoint to open

Implements UaApplicationControlCallback.

UaStatus UaServerApplication::requestServerShutDown ( OpcUa_Int32  secondsTillShutdown,
const UaLocalizedText shutdownReason,
OpcUa_Boolean  restart 
)
virtual

Requests the shutdown of the OPC UA Server application from the SDK module through an OPC UA method.

This method is used internally by the SDK. If you want to shutdown the server, call stop()

Returns
Result of the request. If the result is Bad, the application will not shut down
Parameters
[in]secondsTillShutdownSeconds till shutdown of the server
[in]shutdownReasonReason for the shutdown
[in]restartA flag indicating if the Server should be restarted after shutdown

Implements UaApplicationControlCallback.


The documentation for this class was generated from the following files: