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

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.
 
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.
 

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 101 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 58 of file ua_adapter.cpp.

◆ ~ua_uaadapter()

ChimeraTK::ua_uaadapter::~ua_uaadapter ( )
virtual

Destrructor of the class.

It stop the server and delete the managed object.

Definition at line 66 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 1328 of file ua_adapter.cpp.

◆ 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 660 of file ua_adapter.cpp.

◆ 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 798 of file ua_adapter.cpp.

◆ 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 1627 of file ua_adapter.cpp.

◆ 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 1583 of file ua_adapter.cpp.

◆ 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 731 of file ua_adapter.cpp.

◆ 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 697 of file ua_adapter.cpp.

◆ 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 1573 of file ua_adapter.cpp.

◆ 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 1562 of file ua_adapter.cpp.

◆ 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 1049 of file ua_adapter.cpp.

◆ fillBuildInfo()

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

Fill server build information.

Parameters
configThe server configuration to be modified.

Definition at line 116 of file ua_adapter.cpp.

◆ get_server_config()

ServerConfig ChimeraTK::ua_uaadapter::get_server_config ( )

get ServerConfig.

Parameters
returnsthe serveConfig.

Definition at line 656 of file ua_adapter.cpp.

◆ getAllMappedPvSourceNames()

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

Definition at line 1643 of file ua_adapter.cpp.

◆ 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 1657 of file ua_adapter.cpp.

◆ getMappedServer()

UA_Server * ChimeraTK::ua_uaadapter::getMappedServer ( )

Return the OPC UA Server instance.

Returns
UA_Server *

Definition at line 1699 of file ua_adapter.cpp.

◆ getOwnNodeId()

UA_NodeId ChimeraTK::ua_uaadapter::getOwnNodeId ( )

Methode that returns the node id of the instanced class.

Returns
UA_NodeId

Definition at line 1558 of file ua_adapter.cpp.

◆ 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 1695 of file ua_adapter.cpp.

◆ 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 1423 of file ua_adapter.cpp.

◆ 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 710 of file ua_adapter.cpp.

◆ readConfig()

void ChimeraTK::ua_uaadapter::readConfig ( )

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

Definition at line 289 of file ua_adapter.cpp.

◆ 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 1703 of file ua_adapter.cpp.

◆ workerThread()

void ChimeraTK::ua_uaadapter::workerThread ( )

Create and start a thread for the opcua server instance.

Definition at line 669 of file ua_adapter.cpp.

◆ 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 1713 of file ua_adapter.cpp.

Friends And Related Symbol Documentation

◆ csa_opcua_adapter

friend class csa_opcua_adapter
friend

Definition at line 338 of file ua_adapter.h.

Member Data Documentation

◆ exclude

vector<string> ChimeraTK::ua_uaadapter::exclude

Definition at line 162 of file ua_adapter.h.

◆ folder_with_history

vector<string> ChimeraTK::ua_uaadapter::folder_with_history

Definition at line 163 of file ua_adapter.h.

◆ running

bool ChimeraTK::ua_uaadapter::running = false

Definition at line 160 of file ua_adapter.h.


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