OpcUaCanOpen
CANopen OPC-UA server
AddressSpace::NmBuildingAutomation Class Reference

NmBuildingAutomation is a class defining all basic features of OpcUaCanOpenServer
More...

#include <NmBuildingAutomation.h>

Inherits NodeManagerBase.

Public Member Functions

 NmBuildingAutomation (shared_ptr< UserDevice::ControlInterface > conInterf, const UaString nameOfSerevr)
 
The constructor NmBuildingAutomation More...
 
virtual ~NmBuildingAutomation ()
 destructor More...
 
virtual UaStatus afterStartUp ()
 function create the address space for the bus based on XML parser information More...
 
virtual UaStatus beforeShutDown ()
 the place where the nodes should be created More...
 
virtual UaStatus readValues (const UaVariableArray &arrUaVariables, UaDataValueArray &arrDataValues)
 to executed need action to to the server softly More...
 
virtual UaStatus writeValues (const UaVariableArray &arrUaVariables, const PDataValueArray &arrpDataValues, UaStatusCodeArray &arrStatusCodes)
 IOManagerUaNode implementation to write. More...
 
virtual IOManager * getIOManager (UaNode *pUaNode, OpcUa_Int32 attributeId) const
 function for determining on iomanager for attribute of node More...
 
virtual VariableHandle * getVariableHandler (Session *session, VariableHandle::ServiceType serviceType, OpcUa_NodeId *nodeId, OpcUa_Int32 attributeId)
 get handler using OpcUa toolkit for io operations More...
 
UaNodeId getNewNodeId (const UaNode *, const UaString)
 function to create the new node id based on name More...
 
UaNodeId getTopNodeId (const UaNode *pNode) const
 produce new node id based on parent id and string More...
 
UaNode * getUpNode (const UaNode *pNode) const
 get top node id (canbus) More...
 
UaString getDefaultLocale () const
 get parent node More...
 
OpcUa_Int32 findUaVariables (const OpcUa::BaseObjectType *pParObj, string &pattern, UaControlVariableSet &storage)
 find set of variables in address space More...
 
OpcUa_Int32 findUaNodeVariables (UaNode *pNode, string &pattern, UaControlVariableSet &storage)
 get set of variable of type More...
 
UaObject * getInstanceDeclarationObject (OpcUa_UInt32 numericIdentifier, NodeManagerUaNode *nm)
 Connection to control interface. More...
 
UaVariable * getInstanceDeclarationVariable (const UaNodeId &n)
 get a variable based on node id ( if not return null) More...
 
UaObjectType * getInstanceDeclarationObjectType (OpcUa_UInt32 numericIdentifier)
 get an object type based on numerical id ( if not return null) More...
 
UaVariableType * getInstanceDeclarationVariableType (OpcUa_UInt32 numericIdentifier)
 get an object type based on numerical id ( if not return null) More...
 
UaNode * findNode (const UaNodeId &NodeId) const
 

Public Attributes

shared_ptr< UserDevice::ControlInterfacem_pControlInterface
 

Private Member Functions

 UA_DISABLE_COPY (NmBuildingAutomation)
 
template<typename X >
X * getInstanceDeclaration (OpcUa_UInt32 numericIdentifier, NodeManagerUaNode *nm)
 get parent node More...
 
template<typename X >
X * getInstanceDeclaration (const UaNodeId &n)
 
UaStatus createTypeNodes ()
 
UaStatus createNodeTypes ()
 create of ua node types More...
 
UaStatus createCanbuses ()
 create of cannode types More...
 

Private Attributes

UaString m_sNameNodeId
 create of canbuses More...
 
OpcUa_Int32 m_iNumNameNodeId
 
CanOpenOpcServerConfig::NODETYPE_sequence m_nodetypes
 XML configuration structure. More...
 
CanOpenOpcServerConfig::CANBUS_sequence m_canbuses
 list of nodes More...
 
CanOpenOpcServerConfig::ITEM_sequence m_items
 list of canbuses More...
 
CanOpenOpcServerConfig::REGEXPR_sequence m_regexprisson
 list of calculated items More...
 

Detailed Description

NmBuildingAutomation is a class defining all basic features of OpcUaCanOpenServer

This class inherits the abstract NodeManagerBase.
the afterStartUp() is to create address space of the server and . Opc Ua toolkit calls it after startup. All nodes (types, objects,variables, references) are created by it. Also user device object and connection with address space are defined here
The function beforeShutDown executes when the server shutdown to stop server softly.
The Opc Ua toolkit defines two modes of operations:

  1. UaVariable_Value_CacheIsSource is used for readable nodes, where data are stored in value attribute by user callback function.
    In OpcUaCanOpenServer this mode is used for taken pdo item, Emergence messages and bootup messages.
  2. UaVariable_Value_Cache is used to read and write value via input/output manager.
    • The NodeManagerBase has a default IOManager. In order to use them the virtual readValue and writeValue function should be redefined.
      OpcUaCanOpenServer uses the default readValue function. The writeValue function is redefined to send nmt and rtr message and also to set sync and nodeguarding interval.
    • In order to ensure the parallel execution pdo writing and sdo operation on can bus OpcUaCanOpenServer is using the special io manager.
      • IOManagerPDO is to write pdo manager. Each canbus object includes this manager<>br
      • IOManagerSDO is to read and write sdo and segmented sdo message. Each can node object has this manager. OpcUa tool kit calls getVariableHandler and getIOManager functions to determine which io manager should be used for variable.

Also the NmBuildingAutomation has several function to facilitate of manipulating of ua nodes.

Definition at line 52 of file NmBuildingAutomation.h.

Constructor & Destructor Documentation

◆ NmBuildingAutomation()

AddressSpace::NmBuildingAutomation::NmBuildingAutomation ( shared_ptr< UserDevice::ControlInterface conInterf,
const UaString  nameOfServer 
)


The constructor NmBuildingAutomation

The constructor NmBuildingAutomation.

Parameters
conInterfpointer to the device interface
nameOfServer- server name

Definition at line 32 of file NmBuildingAutomation.cpp.

◆ ~NmBuildingAutomation()

AddressSpace::NmBuildingAutomation::~NmBuildingAutomation ( )
virtual

destructor

Definition at line 86 of file NmBuildingAutomation.cpp.

Member Function Documentation

◆ afterStartUp()

UaStatus AddressSpace::NmBuildingAutomation::afterStartUp ( )
virtual

function create the address space for the bus based on XML parser information

Definition at line 93 of file NmBuildingAutomation.cpp.

◆ beforeShutDown()

UaStatus AddressSpace::NmBuildingAutomation::beforeShutDown ( )
virtual

the place where the nodes should be created

Definition at line 204 of file NmBuildingAutomation.cpp.

◆ createCanbuses()

UaStatus AddressSpace::NmBuildingAutomation::createCanbuses ( )
private

create of cannode types

◆ createNodeTypes()

UaStatus AddressSpace::NmBuildingAutomation::createNodeTypes ( )
private

create of ua node types

◆ createTypeNodes()

UaStatus AddressSpace::NmBuildingAutomation::createTypeNodes ( )
private

◆ findNode()

UaNode* AddressSpace::NmBuildingAutomation::findNode ( const UaNodeId &  NodeId) const
inline

Definition at line 167 of file NmBuildingAutomation.h.

◆ findUaNodeVariables()

OpcUa_Int32 AddressSpace::NmBuildingAutomation::findUaNodeVariables ( UaNode *  pNode,
string &  pattern,
UaControlVariableSet storage 
)

get set of variable of type

find set of variables starting from node

find set of variables starting from node

Parameters
pNodepointer to starting node
patternsearching pattern
storagereturn found variables
Returns
number of finding variables
Parameters
pNodepointer to starting node
patternsearching pattern
storagereturn found variables
Returns
number of finding variables

Definition at line 439 of file NmBuildingAutomation.cpp.

◆ findUaVariables()

OpcUa_Int32 AddressSpace::NmBuildingAutomation::findUaVariables ( const OpcUa::BaseObjectType *  pParObj,
string &  pattern,
UaControlVariableSet storage 
)

find set of variables in address space

find set of variables

Parameters
pParObjpointer to type node
patternsearching pattern
storagereturn found variables
Returns
number of finding variables

Definition at line 420 of file NmBuildingAutomation.cpp.

◆ getDefaultLocale()

UaString AddressSpace::NmBuildingAutomation::getDefaultLocale ( ) const
inline

get parent node

Definition at line 95 of file NmBuildingAutomation.h.

◆ getInstanceDeclaration() [1/2]

template<typename X >
X* AddressSpace::NmBuildingAutomation::getInstanceDeclaration ( OpcUa_UInt32  numericIdentifier,
NodeManagerUaNode *  nm 
)
inlineprivate

get parent node

Try to find the instance declaration node with the numeric identifier and the namespace index of this node manager

Definition at line 171 of file NmBuildingAutomation.h.

◆ getInstanceDeclaration() [2/2]

template<typename X >
X* AddressSpace::NmBuildingAutomation::getInstanceDeclaration ( const UaNodeId &  n)
inlineprivate

Try to find the instance declaration node with the numeric identifier and the namespace index of this node manager

Definition at line 181 of file NmBuildingAutomation.h.

◆ getInstanceDeclarationObject()

UaObject* AddressSpace::NmBuildingAutomation::getInstanceDeclarationObject ( OpcUa_UInt32  numericIdentifier,
NodeManagerUaNode *  nm 
)
inline

Connection to control interface.

get an object based on numerical id ( if not return null)

Definition at line 117 of file NmBuildingAutomation.h.

◆ getInstanceDeclarationObjectType()

UaObjectType* AddressSpace::NmBuildingAutomation::getInstanceDeclarationObjectType ( OpcUa_UInt32  numericIdentifier)
inline

get an object type based on numerical id ( if not return null)

Definition at line 129 of file NmBuildingAutomation.h.

◆ getInstanceDeclarationVariable()

UaVariable* AddressSpace::NmBuildingAutomation::getInstanceDeclarationVariable ( const UaNodeId &  n)
inline

get a variable based on node id ( if not return null)

Definition at line 123 of file NmBuildingAutomation.h.

◆ getInstanceDeclarationVariableType()

UaVariableType* AddressSpace::NmBuildingAutomation::getInstanceDeclarationVariableType ( OpcUa_UInt32  numericIdentifier)
inline

get an object type based on numerical id ( if not return null)

Definition at line 148 of file NmBuildingAutomation.h.

◆ getIOManager()

IOManager * AddressSpace::NmBuildingAutomation::getIOManager ( UaNode *  pUaNode,
OpcUa_Int32  attributeId 
) const
virtual

function for determining on iomanager for attribute of node

This function returns IOManager for mode and attribute

Parameters
pUaNodenode asking the io manager
attributeIdattribute id for different attribute can be used different io manager
Returns
point to IOManager
Parameters
pUaNodepointer to UaN asking the IO manager
attributeIdid of attribute of node

Definition at line 339 of file NmBuildingAutomation.cpp.

◆ getNewNodeId()

UaNodeId AddressSpace::NmBuildingAutomation::getNewNodeId ( const UaNode *  pNode,
const UaString  name 
)

function to create the new node id based on name

Definition at line 40 of file NmBuildingAutomation.cpp.

◆ getTopNodeId()

UaNodeId AddressSpace::NmBuildingAutomation::getTopNodeId ( const UaNode *  pNode) const

produce new node id based on parent id and string

Get NodeId of top node.

Definition at line 58 of file NmBuildingAutomation.cpp.

◆ getUpNode()

UaNode * AddressSpace::NmBuildingAutomation::getUpNode ( const UaNode *  pNode) const

get top node id (canbus)

Definition at line 70 of file NmBuildingAutomation.cpp.

◆ getVariableHandler()

VariableHandle * AddressSpace::NmBuildingAutomation::getVariableHandler ( Session *  session,
VariableHandle::ServiceType  serviceType,
OpcUa_NodeId *  nodeid,
OpcUa_Int32  attributeId 
)
virtual

get handler using OpcUa toolkit for io operations

Get the variable handle for the passed node Id.

Parameters
sessionpoint to session structure
serviceTypetype of operation (read, write and monitoring)
nodeidnode identifier of variable
attributeIdidentifier of attribute of variable
Returns
variableHandler used core to make an operation. this handler contains pointer on IOManager

Definition at line 355 of file NmBuildingAutomation.cpp.

◆ readValues()

UaStatus AddressSpace::NmBuildingAutomation::readValues ( const UaVariableArray &  arrUaVariables,
UaDataValueArray &  arrDataValues 
)
virtual

to executed need action to to the server softly

IOManagerUaNode implementation to read

Definition at line 244 of file NmBuildingAutomation.cpp.

◆ UA_DISABLE_COPY()

AddressSpace::NmBuildingAutomation::UA_DISABLE_COPY ( NmBuildingAutomation  )
private

◆ writeValues()

UaStatus AddressSpace::NmBuildingAutomation::writeValues ( const UaVariableArray &  arrUaVariables,
const PDataValueArray &  arrpDataValues,
UaStatusCodeArray &  arrStatusCodes 
)
virtual

IOManagerUaNode implementation to write.

Trace level settings

Send data or execute the command = type id numeric value

Definition at line 278 of file NmBuildingAutomation.cpp.

Member Data Documentation

◆ m_canbuses

CanOpenOpcServerConfig::CANBUS_sequence AddressSpace::NmBuildingAutomation::m_canbuses
private

list of nodes

Definition at line 202 of file NmBuildingAutomation.h.

◆ m_iNumNameNodeId

OpcUa_Int32 AddressSpace::NmBuildingAutomation::m_iNumNameNodeId
private

Definition at line 198 of file NmBuildingAutomation.h.

◆ m_items

CanOpenOpcServerConfig::ITEM_sequence AddressSpace::NmBuildingAutomation::m_items
private

list of canbuses

Definition at line 203 of file NmBuildingAutomation.h.

◆ m_nodetypes

CanOpenOpcServerConfig::NODETYPE_sequence AddressSpace::NmBuildingAutomation::m_nodetypes
private

XML configuration structure.

Definition at line 201 of file NmBuildingAutomation.h.

◆ m_pControlInterface

shared_ptr<UserDevice::ControlInterface> AddressSpace::NmBuildingAutomation::m_pControlInterface

Definition at line 115 of file NmBuildingAutomation.h.

◆ m_regexprisson

CanOpenOpcServerConfig::REGEXPR_sequence AddressSpace::NmBuildingAutomation::m_regexprisson
private

list of calculated items

Definition at line 204 of file NmBuildingAutomation.h.

◆ m_sNameNodeId

UaString AddressSpace::NmBuildingAutomation::m_sNameNodeId
private

create of canbuses

Definition at line 197 of file NmBuildingAutomation.h.


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