Serveur OPCUA générique
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Macros
cta_ua_controllerobject.h
Aller à la documentation de ce fichier.
1 #ifndef __CONTROLLEROBJECT_H__
2 #define __CONTROLLEROBJECT_H__
3 
4 #include "uaobjecttypes.h"
5 #include "methodmanager.h"
6 #include "opcua_offnormalalarmtype.h"
7 
8 #include <string>
10 
11 class UaMethodGeneric;
12 class HardWareCommunicationInterface;
13 
14 namespace CTA_UA {
15 class ClientManager;
16 }
17 
18 namespace CTA_Slc_Dict {
19 //class DeviceCollector;
20 class InterfaceManager;
21 }
22 
23 namespace CTA_UA {
24 
25 class ControllerObject: public UaObjectBase, public MethodManager {
26  UA_DISABLE_COPY(ControllerObject);
27 public:
28  struct Tab {
29  int taille;
30  std::string* element;
31  };
32 
33  ControllerObject(const UaString& name, const UaString& nameParent,
34  const UaNodeId& newNodeId, const UaString& defaultLocaleId,
35  int alarmFlag, CTA_Hardware::HardWareInterface *hardwareComm);
36 
37  virtual ~ControllerObject(void);
38  //void set();
39  void init();
40  void setAlarm(int onOff, std::string message, int severity);
41  // Implement UaObject interface
42  OpcUa_Byte eventNotifier() const;
43  // Override UaObject method implementation
44  MethodManager* getMethodManager(UaMethod* pMethod) const;
45  void addMethod(UaMethodGeneric* m_pMethod);
46 
47  // Implement MethodManager interface
48  virtual UaStatus beginCall(MethodManagerCallback* pCallback,
49  const ServiceContext& serviceContext, OpcUa_UInt32 callbackHandle,
50  MethodHandle* pMethodHandle, const UaVariantArray& inputArguments);
51  OpcUa_Int16 getTypeNamespace();
52 
53  // Own synchronous call implementation the can be overridden in subclasses
54  UaStatus call(UaMethod* /*pMethod*/,
55  const UaVariantArray& /*inputArguments*/,
56  UaVariantArray& /*outputArguments*/,
57  UaStatusCodeArray& /*inputArgumentResults*/,
58  UaDiagnosticInfos& /*inputArgumentDiag*/);
59 
60  std::map<std::string, Tab> mymap;
61  std::map<std::string, std::string> elementmap;
62  UaString m_fichierMain;
63  static OpcUa_Int16 s_namespaceIndex;
65 
66  virtual UaNodeId typeDefinitionId() const;
67  void setEvent(std::map<std::string, std::string> m_eventList);
68 
69 protected:
70  UaMutexRefCounted* m_pSharedMutex;
71  OpcUa_UInt32 m_deviceAddress;
72 
73 private:
74  void caseSet(std::string &commandString,std::string chemin, std::string element);
75  int caseGet(std::string commandString,std::string chemin, std::string element,UaVariantArray& outputArguments);
76  void buildResult(std::string resultString,UaVariantArray& outputArguments);
77  void buildCommand(std::string &commandString,const UaVariantArray& inputArguments ,int terminal,vector<int> index);
78 
79  ClientManager *m_pClientManager;
80  CTA_Hardware::HardWareInterface *m_hardwareComm;
81  UaMethodGeneric* m_pMethod;
82  UaMethodGeneric* m_pMethodStop;
83  UaString m_name;
84  CTA_Slc_Dict::InterfaceManager *m_interfaceManager;
85 
86  std::string m_pname;
87  std::string m_parent;
88  std::string m_full;
89  std::string m_address;
90  int m_port;
91  int m_eventFlag;
92  int m_alarmFlag;
93  OpcUa::OffNormalAlarmType* m_pStateOffNormalAlarm;
94  std::map<std::string, std::string> m_eventList;
95 };
96 } // end namespace
97 #endif