OpcUaCanOpen
CANopen OPC-UA server
IOTransactionContextCanOpen.h
Go to the documentation of this file.
1 #ifndef __IOTERANSACTIONCANOPEN_H__
2 #define __IOTERANSACTIONCANOPEN_H__
3 
4 #include "iomanager.h"
5 #include "variablehandleuanode.h"
6 #include "opcuatypesinternal.h"
7 #include "CanPDOObject.h"
8 
9 namespace AddressSpace
10 {
11 
12  using namespace CanOpen;
13 
14  typedef UaPointerArray<VariableHandleUaNode> PVariableHandleUaNodeArray;
15  typedef UaPointerArray<CanPDOObject> PCanPDOObjectArray;
16 
20  {
21  public:
24  {
25  m_pCallback = NULL;
26  m_hTransaction = 0;
27  m_totalItemCountHint = 0;
28  m_maxAge = 0;
29  m_pIOManager = NULL;
30  m_timestampsToReturn = OpcUa_TimestampsToReturn_Both;
31  m_pSession = NULL;
32  m_transactionType = IOManager::TransactionInvalid;
33  m_returnDiagnostics = 0;
34  };
37  {
38  if ( m_pSession )
39  {
40  m_pSession->releaseReference();
41  }
42  OpcUa_UInt32 count = m_arrUaVariableHandles.length();
43  for ( OpcUa_UInt32 i=0; i<count; i++ )
44  {
45  if (m_arrUaVariableHandles[i]) {
46  m_arrUaVariableHandles[i]->releaseReference();
47  m_arrUaVariableHandles[i] = NULL;
48  }
49  }
50 
51  };
52 
56  void setSession(Session* pSession)
57  {
58  if ( pSession )
59  {
60  m_pSession = pSession;
61  pSession->addReference();
62  }
63  };
64 
68  inline Session* pSession()
69  {
70  return m_pSession;
71  };
72 
73  IOManager::TransactionType m_transactionType;
74  OpcUa_UInt32 m_returnDiagnostics;
75  IOManager* m_pIOManager;
76  IOManagerCallback* m_pCallback;
77  OpcUa_UInt32 m_hTransaction;
78  OpcUa_UInt32 m_totalItemCountHint;
79  OpcUa_Double m_maxAge;
80  OpcUa_TimestampsToReturn m_timestampsToReturn;
81 
82  OpcUa_UInt32 m_nAsyncCount;
83  UaUInt32Array m_arrCallbackHandles;
85 
86  private:
87  Session* m_pSession;
88  };
89 
94  {
95  public:
97  {
98  m_iPDONumber.clear();
99  }
100  OpcUa_Boolean isNewCanPDOObject(CanPDOObject *cPDO)
101  {
102  if (m_iPDONumber.size()) {
103  for(OpcUa_UInt32 t = 0; t < m_iPDONumber.size(); t++)
104  {
105  if (m_arrCanPDOObject[t] == cPDO) return false;
106  }
107  }
108  return true;
109  }
111  std::vector<OpcUa_UInt> m_iPDONumber;
112  };
113 
115  {
116  public:
118  {
119  m_pIOManager = NULL;
120  }
121 
123  {
124  m_arrWriteValues.clear();
125  }
126  PDataValueArray m_arrWriteValues;
127  UaUInt32Array m_arrSamplingHandles;
128  };
129 
130 }
131 #endif