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

This class comprises all properties and functions to control Can bus This class has the implementation of two main abstract function from CanObject getDeviceMasage and sendDeviceMessage. More...

#include <PROGRAMitem.h>

Inherits CanOpen::CanObject.

Public Member Functions

 CanBusObject (UserDataBase *interf, CANBUS *ca, UaNode *link, int code)
 Constructor. More...
 
virtual ~CanBusObject (void)
 Destructor. More...
 
virtual void setPortError (const int err, const char *errmsg, timeval &tv)
 Callback function to set bus error. More...
 
virtual UaStatus getDeviceMessage (OpcUa_UInt32 code)
 this function is dummy for CanBusObject. There is no any readable data More...
 
void openCanBus ()
 open can bus More...
 
virtual UaStatus sendDeviceMessage (OpcUa_UInt32 code, UaDataValue *value=0)
 send message to canbus More...
 
void sendSync ()
 send sync message More...
 
virtual UaStatus connectCode (OpcUa_UInt32 code,::xsd::cxx::tree::type *conf, UaNode *blink)
 connect function code to ua node to pass data More...
 
CCanUACallbackgetCanUACallback ()
 get main can bus callback function More...
 
void addPDO (CanPDOObject *pdoo)
 Add pdo object. More...
 
busNodesgetListNodes ()
 
void addNode (CanNodeObject *pnode)
 add Can node to the bus More...
 
void sendInitNodeNmt ()
 send nmt message after startup More...
 
void initialize ()
 initialize the bus. send rtr after startup More...
 
void startSyncInterval ()
 start synch interval thread to send sync message More...
 
void startNodeGuardingInterval ()
 start nodeguarding interval thread to send NG messages More...
 
string & getCanBusName ()
 
string & getCanBusAddress ()
 
void waitData ()
 
- 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...
 
virtual UaVariant getPropertyValue (OpcUa_UInt32 code, ::xsd::cxx::tree::type *conf)=0
 
- 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 ()
 

Private Member Functions

 UA_DISABLE_COPY (CanBusObject)
 

Private Attributes

CCanUACallbackm_pCallback
 wait initial data after startup More...
 
SyncIntervalm_pSyncIn
 Call back class to take data from can bus. More...
 
NodeGuardingIntervalm_pNgIn
 Sync interval thread object. More...
 
OpcUa::BaseVariableType * m_iPortError
 Node Guarding thread object. More...
 
OpcUa::BaseVariableType * m_sPortErrorDescription
 Can Bus error reading from driver. More...
 
string m_sBusName
 Description of the port error. More...
 
string m_sBusParameters
 bus name More...
 
string m_sBusAddress
 buss parameters More...
 

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 comprises all properties and functions to control Can bus This class has the implementation of two main abstract function from CanObject getDeviceMasage and sendDeviceMessage.

Definition at line 19 of file PROGRAMitem.h.

Constructor & Destructor Documentation

◆ ~CanBusObject()

virtual CanOpen::PROGRAMitem::~CanBusObject ( void  )
virtual

Destructor.

Member Function Documentation

◆ addNode()

void CanOpen::PROGRAMitem::addNode ( CanNodeObject pnode)
inline

add Can node to the bus

Parameters
pnodenode to add

Definition at line 84 of file PROGRAMitem.h.

◆ addPDO()

void CanOpen::PROGRAMitem::addPDO ( CanPDOObject pdoo)
inline

Add pdo object.

Parameters
pdoopointer to CanPDOObject

Definition at line 78 of file PROGRAMitem.h.

◆ CanBusObject()

CanOpen::PROGRAMitem::CanBusObject ( UserDataBase *  interf,
CANBUS ca,
UaNode *  link,
int  code 
)

Constructor.

Parameters
interfpointer to parent object usually null for CanBusObject
caXML configuration entry
linkpointer to Ua Node
codecode of function

◆ connectCode()

virtual UaStatus CanOpen::PROGRAMitem::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
confXML object containing the configuration information for this object
blinkua node to pass data

Implements UserDevice::InterfaceUserDataBase.

◆ getCanBusAddress()

string& CanOpen::PROGRAMitem::getCanBusAddress ( )
inline

Definition at line 97 of file PROGRAMitem.h.

◆ getCanBusName()

string& CanOpen::PROGRAMitem::getCanBusName ( )
inline

Definition at line 96 of file PROGRAMitem.h.

◆ getCanUACallback()

CCanUACallback* CanOpen::PROGRAMitem::getCanUACallback ( )
inline

get main can bus callback function

Definition at line 73 of file PROGRAMitem.h.

◆ getDeviceMessage()

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

this function is dummy for CanBusObject. There is no any readable data

Implements UserDevice::InterfaceUserDataBase.

Definition at line 44 of file PROGRAMitem.h.

◆ getListNodes()

busNodes& CanOpen::PROGRAMitem::getListNodes ( )
inline

Definition at line 79 of file PROGRAMitem.h.

◆ initialize()

void CanOpen::PROGRAMitem::initialize ( )

initialize the bus. send rtr after startup

◆ openCanBus()

void CanOpen::PROGRAMitem::openCanBus ( )

open can bus

◆ sendDeviceMessage()

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

send message to canbus

Parameters
codecode of function
valuedata to send

Implements UserDevice::InterfaceUserDataBase.

◆ sendInitNodeNmt()

void CanOpen::PROGRAMitem::sendInitNodeNmt ( )
inline

send nmt message after startup

Definition at line 86 of file PROGRAMitem.h.

◆ sendSync()

void CanOpen::PROGRAMitem::sendSync ( )
inline

send sync message

Definition at line 60 of file PROGRAMitem.h.

◆ setPortError()

virtual void CanOpen::PROGRAMitem::setPortError ( const int  err,
const char *  errmsg,
timeval &  tv 
)
virtual

Callback function to set bus error.

Parameters
errerror code
errmsgerror message
tvtimestamps

◆ startNodeGuardingInterval()

void CanOpen::PROGRAMitem::startNodeGuardingInterval ( )
inline

start nodeguarding interval thread to send NG messages

Definition at line 94 of file PROGRAMitem.h.

◆ startSyncInterval()

void CanOpen::PROGRAMitem::startSyncInterval ( )
inline

start synch interval thread to send sync message

Definition at line 91 of file PROGRAMitem.h.

◆ UA_DISABLE_COPY()

CanOpen::PROGRAMitem::UA_DISABLE_COPY ( CanBusObject  )
private

◆ waitData()

void CanOpen::PROGRAMitem::waitData ( )

Member Data Documentation

◆ m_iPortError

OpcUa::BaseVariableType* CanOpen::PROGRAMitem::m_iPortError
private

Node Guarding thread object.

Definition at line 108 of file PROGRAMitem.h.

◆ m_pCallback

CCanUACallback* CanOpen::PROGRAMitem::m_pCallback
private

wait initial data after startup

Definition at line 103 of file PROGRAMitem.h.

◆ m_pNgIn

NodeGuardingInterval* CanOpen::PROGRAMitem::m_pNgIn
private

Sync interval thread object.

Definition at line 106 of file PROGRAMitem.h.

◆ m_pSyncIn

SyncInterval* CanOpen::PROGRAMitem::m_pSyncIn
private

Call back class to take data from can bus.

Definition at line 105 of file PROGRAMitem.h.

◆ m_sBusAddress

string CanOpen::PROGRAMitem::m_sBusAddress
private

buss parameters

Definition at line 113 of file PROGRAMitem.h.

◆ m_sBusName

string CanOpen::PROGRAMitem::m_sBusName
private

Description of the port error.

Definition at line 111 of file PROGRAMitem.h.

◆ m_sBusParameters

string CanOpen::PROGRAMitem::m_sBusParameters
private

bus name

Definition at line 112 of file PROGRAMitem.h.

◆ m_sPortErrorDescription

OpcUa::BaseVariableType* CanOpen::PROGRAMitem::m_sPortErrorDescription
private

Can Bus error reading from driver.

Definition at line 109 of file PROGRAMitem.h.


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