OpcUaCanOpen
CANopen OPC-UA server
IOManagerSDO.h
Go to the documentation of this file.
1 #ifndef __IOMANAGERSDO_H__
2 #define __IOMANAGERSDO_H__
3 
4 #include "iomanager.h"
5 #include "uathreadpool.h"
6 #include "samplingengine.h"
8 #include "UaCanNodeObject.h"
9 #include "SamplingSDO.h"
10 
11 namespace CanOpen
12 {
20  class IOManagerSDO : public IOManager
21  {
23  public:
24 
28  IOManagerSDO(UaCanNodeObject *pCanNode);
29 
31  virtual ~IOManagerSDO();
32 
33  //- Interface IOManager ------------------------------------------------------------------
34  UaStatus beginTransaction(IOManagerCallback* pCallback, const ServiceContext& serviceContext, OpcUa_UInt32 hTransaction, OpcUa_UInt32 totalItemCountHint,
35  OpcUa_Double maxAge, OpcUa_TimestampsToReturn timestampsToReturn, TransactionType transactionType, OpcUa_Handle& hIOManagerContext);
37  UaStatus beginStartMonitoring(OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, IOVariableCallback* pIOVariableCallback,
38  VariableHandle* pVariableHandle, MonitoringContext& monitoringContext);
39  UaStatus beginModifyMonitoring(OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, OpcUa_UInt32 hIOVariable, MonitoringContext& monitoringContext);
40  UaStatus beginStopMonitoring(OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, OpcUa_UInt32 hIOVariable);
41  UaStatus beginRead(OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, VariableHandle* pVariableHandle, OpcUa_ReadValueId* pReadValueId);
42  UaStatus beginWrite(OpcUa_Handle hIOManagerContext, OpcUa_UInt32 callbackHandle, VariableHandle* pVariableHandle, OpcUa_WriteValue* pWriteValue);
43  UaStatus finishTransaction(OpcUa_Handle hIOManagerContext);
44  //- Interface NodeManager ------------------------------------------------------------------
45 
48  UaStatus setAvailableSamplingRates(const UaUInt32Array& availableSamplingRates);
49 
50  void executeRead(AddressSpace::IOTransactionContextSDO* pTransactionContext);
51  void executeWrite(AddressSpace::IOTransactionContextSDO* pTransactionContext);
55 
56  private:
57  UaUInt32Array sdoSamplingRates;
58 
60 
61  UaMutex m_mutex;
62 
63  UaThreadPool *m_pThreadPool;
64  SamplingEngine *m_pSamplingEngine;
65 
66  HandleManager<AddressSpace::SamplingSDO> m_handlesSampleItems;
67  };
68 
69  class IOManagerSDOJob: public UaThreadPoolJob
70  {
72  public:
74  {
75  m_pTransactionContext = pTransactionContext;
76  };
77 
78  virtual ~IOManagerSDOJob()
79  {
81  {
82  delete m_pTransactionContext;
83  }
84  };
85 
86  void execute();
87 
88  private:
90  };
91 
92 }
93 #endif // __IOMANAGERSDO_H__