OpcUaCanOpen
CANopen OPC-UA server
CanPDOObject.h
Go to the documentation of this file.
1 #ifndef __CANPDOOBJECT_H__
2 #define __CANPDOOBJECT_H__
3 
4 #include "uaobjecttypes.h"
5 #include "uasemaphore.h"
6 #include "CanOpenObject.h"
7 #include "uabytearray.h"
8 #include "Ids.h"
9 //#include "BuildingAutomationTypeIds.h"
10 #include "CanOpenData.h"
11 #include <vector>
12 #include <map>
13 #include <opcua_basedatavariabletype.h>
14 
15 namespace CanOpen
16 {
17  class CanPDOItem;
18 
23  {
24  public:
25 
34  PDO *conf,UaNode *blink,OpcUa_UInt32 code);
35 
36  virtual ~CanPDOObject(void)
37  {
38 // cout << "Delete " << getCobId() << endl;
39  };
40 
41  virtual void pass(const CanMsgStruct *);
42 
43 // UaStatus pack(const OpcUa_Variant *sData,CanPDOItem *item);
44  void setItem(OpcUa_Byte ch,CanPDOItem *pdoi);
45  virtual UaStatus getDeviceMessage(OpcUa_UInt32 commandCode)
46  {
47  OpcUa_ReferenceParameter(commandCode);
48  return OpcUa_Good;
49  }
50  virtual UaStatus sendDeviceMessage(OpcUa_UInt32 code, UaDataValue *value = 0) ;
51  OpcUa_UInt32 getNumberChennal() { return m_iMaxCount; }
52  UaByteArray& getBuffer(OpcUa_Byte ch) { return m_pdoBuffer[ch]; }
53  void setBuffer( UaByteArray& buf,OpcUa_Byte ch) { m_pdoBuffer[ch] = buf; }
54  virtual void getInitRTRData();
55 
61  virtual UaStatus connectCode(OpcUa_UInt32 code, ::xsd::cxx::tree::type *conf, UaNode *blink);
62  virtual UaVariant getPropertyValue(OpcUa_UInt32 code, ::xsd::cxx::tree::type *conf);
63 
65  virtual void sendRTR()
66  {
68  }
69 
71 
75  void addNodeId(bool type);
76 
77 
78  virtual void waitRTRData()
79  {
80  if (m_bInitRTR) {
81  waitOperation(0);
82  }
83  }
84 
85  protected:
86  OpcUa_Boolean m_bInitRTR;
87  OpcUa::BaseVariableType *m_pRTRCommand;
88 
89 
90  vector<UaByteArray> m_pdoBuffer;
91  multimap<OpcUa_Byte,CanPDOItem *> m_cPDOs;
92 
93  };
94 
95 }
96 #endif