OpcUaCanOpen
CANopen OPC-UA server
CanOpen::CanNodeObject Class Reference

This class ensure the communication with CanOpen node. More...

#include <CanNodeObject.h>

Inherits CanOpen::CanObject.

Public Member Functions

 CanNodeObject (pUserDeviceStruct *interf, NODE *ca, UaNode *blink, OpcUa_UInt32 code)
 Constructor. More...
 
virtual ~CanNodeObject (void)
 Destructor. More...
 
virtual UaStatus getDeviceMessage (OpcUa_UInt32 code)
 Read data From device There is no any date for this object. More...
 
virtual UaStatus sendDeviceMessage (OpcUa_UInt32 code, UaDataValue *value=0)
 send data or command on device Abstract function to send data based on type id (buldingAutomationTypeIds.h) More...
 
void passSDO (const CanMsgStruct *cms)
 
virtual void setState (const CanMsgStruct *cms)
 send SDO message More...
 
virtual void setEmergencyEvent (const CanMsgStruct *cms)
 set value of nmt and bootup message More...
 
void setRequestSDO (CanSDOObject *msdo)
 set Emergency event More...
 
void freeRequestSDO ()
 unlock SDo operation More...
 
virtual UaStatus connectCode (OpcUa_UInt32 code,::xsd::cxx::tree::type *conf, UaNode *blink)
 connect function code to ua node to pass data More...
 
virtual UaVariant getPropertyValue (OpcUa_UInt32 code, ::xsd::cxx::tree::type *conf)
 
virtual void sendNG ()
 send NG message for this node More...
 
void NGComing (OpcUa_Byte st)
 Handle the ng message Set state or recover after bootup message. More...
 
void setInitLive ()
 
void decNGCounter ()
 counter of missing NG message ( 0 means node disconnected ) More...
 
- Public Member Functions inherited from CanOpen::CanObject
 CanObject (pUserDeviceStruct *parent,::xsd::cxx::tree::type *conf, UaNode *pAS, OpcUa_UInt32 code)
 Constructor. More...
 
virtual ~CanObject (void)
 Destructor. More...
 
OpcUa_Byte getCanNodeId ()
 get Node Id More...
 
void sendNMT (enum ::NMTcommand nmt)
 Send nmt message. More...
 
virtual void setInitNmt (enum NMTcommand iNMT)
 Save initial nmt message which will send to initialize devices. More...
 
virtual void setInitNmt (std::string sNmt)
 Save initial nmt message which will send to initialize devices. More...
 
virtual void sendInitNmt ()
 send initial nmt message More...
 
CCanAccessgetCanBusInterface ()
 get pointer to can bus interface More...
 
void setCanBusInterface (CCanAccess *ccac)
 save pointer to can bus interface More...
 
IOManager * getIOManager ()
 
- Public Member Functions inherited from UserDevice::InterfaceUserDataBase
 InterfaceUserDataBase (pUserDeviceStruct *parent,::xsd::cxx::tree::type *conf, UaNode *pAS, OpcUa_UInt code)
 Constructor Also create the shared mutex which can be used to synchronize operation on device using lock/unlock function. More...
 
virtual ~InterfaceUserDataBase (void)
 Destructor. More...
 
- Public Member Functions inherited from UserDevice::UserDeviceStruct
 UserDeviceStruct (pUserDeviceStruct *parent, ::xsd::cxx::tree::type *conf, UaNode *pAS, OpcUa_UInt code)
 constructor More...
 
void lock ()
 lock shared mutex to protect More...
 
void unlock ()
 unlock shared mutex More...
 
::UaMutexRefCounted * getShareMutex ()
 get mutex More...
 
void releaseMutex ()
 
OpcUa_Int32 countMutex ()
 
virtual ~UserDeviceStruct (void)
 
OpcUa_UInt getCodeFunction ()
 
UserDeviceStructgetParentDevice ()
 
pUserDeviceStructgetTopInterface ()
 
pUserDeviceStructgetParent ()
 
virtual void setInvalid ()
 
UaNode * getAddressSpaceEntry ()
 

Static Public Attributes

static OpcUa_Int16 ngCounter
 
static OpcUa_Boolean DisconectRecovery
 

Private Member Functions

void setDisconnectedState ()
 current sdo object executing sdo operation More...
 
void setStateRecursevely (UaNode *p, bool state)
 set disconnection state 1 for node More...
 
void setLastState ()
 
OpcUa_Boolean isAlive ()
 set the last state after disconnection More...
 

Private Attributes

UaMutex m_mutexReqSDO
 
CanSDOObjectm_requestedSDO
 sdo mutex to protect sdo operation . should one on one moment More...
 
OpcUa_Byte m_currentState
 
OpcUa_Byte m_lastState
 
OpcUa_Int16 m_repeatedCounter
 
OpcUa::BaseVariableType * m_state
 
OpcUa::BaseVariableType * m_iBootupCounter
 
OpcUa::BaseVariableType * m_EmergencyErrorCode
 
OpcUa::BaseVariableType * m_EmergencyCounter
 
OpcUa::BaseVariableType * m_Error
 
OpcUa::BaseVariableType * m_SpecificErrorCodeByte1
 
OpcUa::BaseVariableType * m_SpecificErrorCodeByte2
 
OpcUa::BaseVariableType * m_SpecificErrorCodeByte3
 
OpcUa::BaseVariableType * m_SpecificErrorCodeByte4
 
OpcUa::BaseVariableType * m_SpecificErrorCodeByte5
 
list< OpcUa::BaseVariableType * > m_programList
 

Additional Inherited Members

- Protected Attributes inherited from CanOpen::CanObject
CCanAccessm_pCommIf
 Address of can interface. More...
 
OpcUa_Byte m_CanNodeId
 Node Id for bus = 0. More...
 
enum NMTcommand m_initNMTcommand
 initial NMT commands More...
 
IOManager * m_pIOManager
 
- Protected Attributes inherited from UserDevice::UserDeviceStruct
UaMutexRefCounted * m_pSharedMutex
 

Detailed Description

This class ensure the communication with CanOpen node.

Can Node has unique node id.
CanOpen protocol defines several can message which cobid calculates based on nodeid.
These are emergency messages, nodeguarding and bootup messages
This object has links to UaVariable which the data are passed to
Also this object ensure the synchronization of sdo operation. Should be one operation in one moment.
Each can node has a state which is taken from NG or HB message.
Also CanNodeObject ensue to recover after rebooting or disconnection of node in proper state

Definition at line 27 of file CanNodeObject.h.

Constructor & Destructor Documentation

◆ CanNodeObject()

CanOpen::CanNodeObject::CanNodeObject ( pUserDeviceStruct interf,
NODE ca,
UaNode *  blink,
OpcUa_UInt32  code 
)

Constructor.

Parameters
interfthe parent interface in this case is a CanBUsObject
caXML description of node properties
blinkthe UaNode which control this device
codefunction code of operation

Definition at line 13 of file CanNodeObject.cpp.

◆ ~CanNodeObject()

CanOpen::CanNodeObject::~CanNodeObject ( void  )
virtual

Destructor.

Definition at line 27 of file CanNodeObject.cpp.

Member Function Documentation

◆ connectCode()

UaStatus CanOpen::CanNodeObject::connectCode ( OpcUa_UInt32  code,
::xsd::cxx::tree::type *  conf,
UaNode *  blink 
)
virtual

connect function code to ua node to pass data

Parameters
codefunction code defines the operation
confconfiguration data to link node
blinkua node to pass data

Implements UserDevice::InterfaceUserDataBase.

Definition at line 210 of file CanNodeObject.cpp.

◆ decNGCounter()

void CanOpen::CanNodeObject::decNGCounter ( )
inline

counter of missing NG message ( 0 means node disconnected )

Definition at line 105 of file CanNodeObject.h.

◆ freeRequestSDO()

void CanOpen::CanNodeObject::freeRequestSDO ( )
inline

unlock SDo operation

Definition at line 63 of file CanNodeObject.h.

◆ getDeviceMessage()

virtual UaStatus CanOpen::CanNodeObject::getDeviceMessage ( OpcUa_UInt32  code)
inlinevirtual

Read data From device There is no any date for this object.

Parameters
codefunction code of operation

Implements UserDevice::InterfaceUserDataBase.

Definition at line 47 of file CanNodeObject.h.

◆ getPropertyValue()

UaVariant CanOpen::CanNodeObject::getPropertyValue ( OpcUa_UInt32  code,
::xsd::cxx::tree::type *  conf 
)
virtual

Implements UserDevice::InterfaceUserDataBase.

Definition at line 282 of file CanNodeObject.cpp.

◆ isAlive()

OpcUa_Boolean CanOpen::CanNodeObject::isAlive ( )
inlineprivate

set the last state after disconnection

Definition at line 129 of file CanNodeObject.h.

◆ NGComing()

void CanOpen::CanNodeObject::NGComing ( OpcUa_Byte  st)
inline

Handle the ng message Set state or recover after bootup message.

Parameters
ststate byte from ng or boot up message

Definition at line 84 of file CanNodeObject.h.

◆ passSDO()

void CanOpen::CanNodeObject::passSDO ( const CanMsgStruct cms)

Definition at line 32 of file CanNodeObject.cpp.

◆ sendDeviceMessage()

UaStatus CanOpen::CanNodeObject::sendDeviceMessage ( OpcUa_UInt32  code,
UaDataValue *  value = 0 
)
virtual

send data or command on device Abstract function to send data based on type id (buldingAutomationTypeIds.h)

Parameters
codefunction code
valuedata to send

Implements UserDevice::InterfaceUserDataBase.

Definition at line 42 of file CanNodeObject.cpp.

◆ sendNG()

void CanOpen::CanNodeObject::sendNG ( )
virtual

send NG message for this node

Definition at line 200 of file CanNodeObject.cpp.

◆ setDisconnectedState()

void CanOpen::CanNodeObject::setDisconnectedState ( )
private

current sdo object executing sdo operation

Definition at line 331 of file CanNodeObject.cpp.

◆ setEmergencyEvent()

void CanOpen::CanNodeObject::setEmergencyEvent ( const CanMsgStruct cms)
virtual

set value of nmt and bootup message

distribute emergency message can message to different items

Definition at line 147 of file CanNodeObject.cpp.

◆ setInitLive()

void CanOpen::CanNodeObject::setInitLive ( )
inline

Definition at line 99 of file CanNodeObject.h.

◆ setLastState()

void CanOpen::CanNodeObject::setLastState ( )
private

Definition at line 306 of file CanNodeObject.cpp.

◆ setRequestSDO()

void CanOpen::CanNodeObject::setRequestSDO ( CanSDOObject msdo)
inline

set Emergency event

lock SDO operation

Definition at line 57 of file CanNodeObject.h.

◆ setState()

void CanOpen::CanNodeObject::setState ( const CanMsgStruct cms)
virtual

send SDO message

Definition at line 83 of file CanNodeObject.cpp.

◆ setStateRecursevely()

void CanOpen::CanNodeObject::setStateRecursevely ( UaNode *  p,
bool  state 
)
private

set disconnection state 1 for node

Definition at line 355 of file CanNodeObject.cpp.

Member Data Documentation

◆ DisconectRecovery

OpcUa_Boolean CanOpen::CanNodeObject::DisconectRecovery
static

Definition at line 118 of file CanNodeObject.h.

◆ m_currentState

OpcUa_Byte CanOpen::CanNodeObject::m_currentState
private

Definition at line 131 of file CanNodeObject.h.

◆ m_EmergencyCounter

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_EmergencyCounter
private

Definition at line 138 of file CanNodeObject.h.

◆ m_EmergencyErrorCode

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_EmergencyErrorCode
private

Definition at line 137 of file CanNodeObject.h.

◆ m_Error

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_Error
private

Definition at line 139 of file CanNodeObject.h.

◆ m_iBootupCounter

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_iBootupCounter
private

Definition at line 136 of file CanNodeObject.h.

◆ m_lastState

OpcUa_Byte CanOpen::CanNodeObject::m_lastState
private

Definition at line 132 of file CanNodeObject.h.

◆ m_mutexReqSDO

UaMutex CanOpen::CanNodeObject::m_mutexReqSDO
private

Definition at line 122 of file CanNodeObject.h.

◆ m_programList

list<OpcUa::BaseVariableType *> CanOpen::CanNodeObject::m_programList
private

Definition at line 145 of file CanNodeObject.h.

◆ m_repeatedCounter

OpcUa_Int16 CanOpen::CanNodeObject::m_repeatedCounter
private

Definition at line 133 of file CanNodeObject.h.

◆ m_requestedSDO

CanSDOObject* CanOpen::CanNodeObject::m_requestedSDO
private

sdo mutex to protect sdo operation . should one on one moment

Definition at line 123 of file CanNodeObject.h.

◆ m_SpecificErrorCodeByte1

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_SpecificErrorCodeByte1
private

Definition at line 140 of file CanNodeObject.h.

◆ m_SpecificErrorCodeByte2

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_SpecificErrorCodeByte2
private

Definition at line 141 of file CanNodeObject.h.

◆ m_SpecificErrorCodeByte3

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_SpecificErrorCodeByte3
private

Definition at line 142 of file CanNodeObject.h.

◆ m_SpecificErrorCodeByte4

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_SpecificErrorCodeByte4
private

Definition at line 143 of file CanNodeObject.h.

◆ m_SpecificErrorCodeByte5

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_SpecificErrorCodeByte5
private

Definition at line 144 of file CanNodeObject.h.

◆ m_state

OpcUa::BaseVariableType* CanOpen::CanNodeObject::m_state
private

Definition at line 135 of file CanNodeObject.h.

◆ ngCounter

OpcUa_Int16 CanOpen::CanNodeObject::ngCounter
static

Definition at line 117 of file CanNodeObject.h.


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