ChimeraTK-ControlSystemAdapter-OPCUAAdapter  04.00.01
ChimeraTK::ua_uaadapter Class Reference

This class provide the opcua server and manage the variable mapping. More...

#include <ua_adapter.h>

+ Inheritance diagram for ChimeraTK::ua_uaadapter:
+ Collaboration diagram for ChimeraTK::ua_uaadapter:

Public Member Functions

 ua_uaadapter (const string &configPath)
 Constructor of the class. More...
 
virtual ~ua_uaadapter ()
 Destrructor of the class. More...
 
UA_DateTime getSourceTimeStamp ()
 Return the timestamp of the node. More...
 
UA_Server * getMappedServer ()
 Return the OPC UA Server instance. More...
 
UA_NodeId createFolderPath (UA_NodeId basenodeid, vector< string > folderPathVector)
 Create a path of folders in the given parent node. More...
 
UA_NodeId createFolder (UA_NodeId basenodeid, const string &folderName, const string &description="")
 Creates a folder in the given parent node. More...
 
UA_NodeId existFolderPath (UA_NodeId basenodeid, const vector< string > &folderPath)
 Check if a folder path exist in opcua server. More...
 
UA_NodeId existFolder (UA_NodeId basenodeid, const string &folderName)
 Check if a folder exist in opcua server. More...
 
UA_NodeId enrollFolderPathFromString (const string &path, const string &seperator)
 Create folder structure based on the given path. More...
 
void implicitVarMapping (const std::string &varName, const boost::shared_ptr< ControlSystemPVManager > &csManager)
 Start implicit mapping process. More...
 
void applyMapping (const boost::shared_ptr< ControlSystemPVManager > &csManager)
 Read mapping file and apply the contained folders, additional variables and pv mappings. More...
 
void explicitVarMapping (const boost::shared_ptr< ControlSystemPVManager > &csManager)
 Read mapping file and apply contained PV mappings. More...
 
void addAdditionalVariables ()
 Read mapping file and add contained additional variables to the server. More...
 
void buildFolderStructure (const boost::shared_ptr< ControlSystemPVManager > &csManager)
 Read mapping file and and add contained folders to the server. More...
 
void deepCopyHierarchicalLayer (const boost::shared_ptr< ControlSystemPVManager > &csManager, UA_NodeId layer, UA_NodeId target)
 Copy (recursively) the content of a folder to a new location. More...
 
UA_NodeId getOwnNodeId ()
 Methode that returns the node id of the instanced class. More...
 
vector< ua_processvariable * > getVariables ()
 Methode that returns all <ua_processvariable> of the class. More...
 
void workerThread ()
 Create and start a thread for the opcua server instance. More...
 
void readConfig ()
 This Methode reads the config-tag form the given <variableMap.xml>. More...
 
vector< string > getAllNotMappableVariablesNames ()
 Methode to get all names from all potential VarableNodes from XML-Mappingfile which could not allocated. More...
 
vector< string > getAllMappedPvSourceNames ()
 
void fillBuildInfo (UA_ServerConfig *config) const
 Fill server build information. More...
 
ServerConfig get_server_config ()
 get ServerConfig. More...
 

Static Public Member Functions

static UA_StatusCode readLogLevel (UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, void *nodeContext, UA_Boolean sourceTimeStamp, const UA_NumericRange *range, UA_DataValue *dataValue)
 callback function used to read the servers logging level. More...
 
static UA_StatusCode writeLogLevel (UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, void *nodeContext, const UA_NumericRange *range, const UA_DataValue *data)
 callback function used to change the servers logging level. More...
 

Public Attributes

bool running = false
 
vector< string > exclude
 
vector< string > folder_with_history
 

Friends

class csa_opcua_adapter
 

Detailed Description

This class provide the opcua server and manage the variable mapping.

This Class create and start the opcua server also it contain all variables of the server. Especially it reads the config-file and add all Variables from a pv-manager and additional variables. For config purpose. The config-file parameter will parsed and set to the right variable.

Author
Chris Iatrou
Julian Rahm
Date
22.11.2016

Definition at line 100 of file ua_adapter.h.

Constructor & Destructor Documentation

◆ ua_uaadapter()

ChimeraTK::ua_uaadapter::ua_uaadapter ( const string &  configPath)

Constructor of the class.

During the construction of the class it instanciate a xml_file_handler and read the config, after that the server will be sonstructed and the namespace ist added to them. Concluding all additional nodes which are defined in the configFile are mapped into the server.

Parameters
configFileThis file provide the configuration and the mapping of the server

Definition at line 57 of file ua_adapter.cpp.

+ Here is the call graph for this function:

◆ ~ua_uaadapter()

ChimeraTK::ua_uaadapter::~ua_uaadapter ( )
virtual

Destrructor of the class.

It stop the server and delete the managed object.

Definition at line 65 of file ua_adapter.cpp.

Member Function Documentation

◆ addAdditionalVariables()

void ChimeraTK::ua_uaadapter::addAdditionalVariables ( )

Read mapping file and add contained additional variables to the server.

Definition at line 1331 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyMapping()

void ChimeraTK::ua_uaadapter::applyMapping ( const boost::shared_ptr< ControlSystemPVManager > &  csManager)

Read mapping file and apply the contained folders, additional variables and pv mappings.

Order -> Folder (without source) -> Folder (with source) -> additional variables -> PV mappings

Parameters
csManagercontrol system manager

Definition at line 662 of file ua_adapter.cpp.

+ Here is the call graph for this function:

◆ buildFolderStructure()

void ChimeraTK::ua_uaadapter::buildFolderStructure ( const boost::shared_ptr< ControlSystemPVManager > &  csManager)

Read mapping file and and add contained folders to the server.

Parameters
csManagercontrol system manager

Definition at line 801 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createFolder()

UA_NodeId ChimeraTK::ua_uaadapter::createFolder ( UA_NodeId  basenodeid,
const string &  folderName,
const string &  description = "" 
)

Creates a folder in the given parent node.

Parameters
basenodeIdNode id of the parent node
folderNameName of the new folder
descriptionA short description of the folder

Definition at line 1630 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createFolderPath()

UA_NodeId ChimeraTK::ua_uaadapter::createFolderPath ( UA_NodeId  basenodeid,
std::vector< string >  folderPath 
)

Create a path of folders in the given parent node.

Parameters
basenodeidNode id of the parent node
folderPathVectorEvery single string is a folder name, the path ist createt in the given order

Definition at line 1586 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deepCopyHierarchicalLayer()

void ChimeraTK::ua_uaadapter::deepCopyHierarchicalLayer ( const boost::shared_ptr< ControlSystemPVManager > &  csManager,
UA_NodeId  layer,
UA_NodeId  target 
)

Copy (recursively) the content of a folder to a new location.

Parameters
csManagercontrol system manager
layersource folder
targetdestination folder

Definition at line 734 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enrollFolderPathFromString()

UA_NodeId ChimeraTK::ua_uaadapter::enrollFolderPathFromString ( const string &  path,
const string &  seperator 
)

Create folder structure based on the given path.

Parameters
pathThe complete path
seperatorDelimiters with are used to split the path
Returns
nodeId of the last created folder (last part of path)

Definition at line 700 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ existFolder()

UA_NodeId ChimeraTK::ua_uaadapter::existFolder ( UA_NodeId  basenodeid,
const string &  folderName 
)

Check if a folder exist in opcua server.

Parameters
basenodeIdNode id of the parent node
folderNameThe name of folder, that be checked

Definition at line 1576 of file ua_adapter.cpp.

+ Here is the caller graph for this function:

◆ existFolderPath()

UA_NodeId ChimeraTK::ua_uaadapter::existFolderPath ( UA_NodeId  basenodeid,
const vector< string > &  folderPath 
)

Check if a folder path exist in opcua server.

Parameters
basenodeIdNode id of the parent node
folderPathVectorEvery single string is a folder name, the path ist checked in the given order

Definition at line 1565 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ explicitVarMapping()

void ChimeraTK::ua_uaadapter::explicitVarMapping ( const boost::shared_ptr< ControlSystemPVManager > &  csManager)

Read mapping file and apply contained PV mappings.

Parameters
csManagercontrol system manager

Definition at line 1052 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillBuildInfo()

void ChimeraTK::ua_uaadapter::fillBuildInfo ( UA_ServerConfig *  config) const

Fill server build information.

Parameters
configThe server configuration to be modified.

Definition at line 115 of file ua_adapter.cpp.

◆ get_server_config()

ServerConfig ChimeraTK::ua_uaadapter::get_server_config ( )

get ServerConfig.

Parameters
returnsthe serveConfig.

Definition at line 658 of file ua_adapter.cpp.

◆ getAllMappedPvSourceNames()

vector< string > ChimeraTK::ua_uaadapter::getAllMappedPvSourceNames ( )

Definition at line 1646 of file ua_adapter.cpp.

+ Here is the call graph for this function:

◆ getAllNotMappableVariablesNames()

vector< string > ChimeraTK::ua_uaadapter::getAllNotMappableVariablesNames ( )

Methode to get all names from all potential VarableNodes from XML-Mappingfile which could not allocated.

Returns
vector<string> notMappableVariablesNames List with all VariableNodes which could not allocated a Varaible in PV-Manager.

Definition at line 1660 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMappedServer()

UA_Server * ChimeraTK::ua_uaadapter::getMappedServer ( )

Return the OPC UA Server instance.

Returns
UA_Server *

Definition at line 1690 of file ua_adapter.cpp.

+ Here is the caller graph for this function:

◆ getOwnNodeId()

UA_NodeId ChimeraTK::ua_uaadapter::getOwnNodeId ( )

Methode that returns the node id of the instanced class.

Returns
UA_NodeId

Definition at line 1561 of file ua_adapter.cpp.

+ Here is the caller graph for this function:

◆ getSourceTimeStamp()

UA_DateTime ChimeraTK::ua_uaadapter::getSourceTimeStamp ( )
virtual

Return the timestamp of the node.

Returns
UA_DateTime

Implements ChimeraTK::ua_mapped_class.

Definition at line 1686 of file ua_adapter.cpp.

+ Here is the caller graph for this function:

◆ getVariables()

vector< ua_processvariable * > ChimeraTK::ua_uaadapter::getVariables ( )

Methode that returns all <ua_processvariable> of the class.

Returns
A vector of all <ua_processvariable>

Definition at line 1426 of file ua_adapter.cpp.

+ Here is the caller graph for this function:

◆ implicitVarMapping()

void ChimeraTK::ua_uaadapter::implicitVarMapping ( const std::string &  varName,
const boost::shared_ptr< ControlSystemPVManager > &  csManager 
)

Start implicit mapping process.

Parameters
basenodeIdNode id of the parent node
folderPathVectorEvery single string is a folder name, the path ist checked in the given order

Definition at line 713 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readConfig()

void ChimeraTK::ua_uaadapter::readConfig ( )

This Methode reads the config-tag form the given <variableMap.xml>.

Definition at line 291 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readLogLevel()

UA_StatusCode ChimeraTK::ua_uaadapter::readLogLevel ( UA_Server *  server,
const UA_NodeId *  sessionId,
void *  sessionContext,
const UA_NodeId *  nodeId,
void *  nodeContext,
UA_Boolean  sourceTimeStamp,
const UA_NumericRange *  range,
UA_DataValue *  dataValue 
)
static

callback function used to read the servers logging level.

Read the current logging level stored in adapter->serverConfig.logLevel.

Definition at line 1694 of file ua_adapter.cpp.

◆ workerThread()

void ChimeraTK::ua_uaadapter::workerThread ( )

Create and start a thread for the opcua server instance.

Definition at line 671 of file ua_adapter.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLogLevel()

UA_StatusCode ChimeraTK::ua_uaadapter::writeLogLevel ( UA_Server *  server,
const UA_NodeId *  sessionId,
void *  sessionContext,
const UA_NodeId *  nodeId,
void *  nodeContext,
const UA_NumericRange *  range,
const UA_DataValue *  data 
)
static

callback function used to change the servers logging level.

Set the new logging level entered by the user. Replace the servers logger by a new one.

Definition at line 1704 of file ua_adapter.cpp.

Friends And Related Function Documentation

◆ csa_opcua_adapter

friend class csa_opcua_adapter
friend

Definition at line 336 of file ua_adapter.h.

Member Data Documentation

◆ exclude

vector<string> ChimeraTK::ua_uaadapter::exclude

Definition at line 160 of file ua_adapter.h.

◆ folder_with_history

vector<string> ChimeraTK::ua_uaadapter::folder_with_history

Definition at line 161 of file ua_adapter.h.

◆ running

bool ChimeraTK::ua_uaadapter::running = false

Definition at line 158 of file ua_adapter.h.


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