Serveur OPCUA générique
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Macros
cta_ua_pushmanager.h
Aller à la documentation de ce fichier.
1 #ifndef __CTAUAPUSHNANAGER_H__
2 #define __CTAUAPUSHMANAGER_H__
3 
4 #include "uabasenodes.h"
5 #include "uathread.h"
6 #include "servermanager.h"
7 #include "string"
8 #include <vector>
9 #include <list>
10 
11 #include "../uaclient/uasession.h"
12 
13 class Callback: public UaClientSdk::UaSessionCallback,
14  public UaClientSdk::UaSubscriptionCallback {
15 public:
16 
18  }
19  ;
20  virtual ~Callback() {
21  }
22  ;
23 
25  virtual void connectionStatusChanged(OpcUa_UInt32 clientConnectionId,
26  UaClientSdk::UaClient::ServerStatus serverStatus) {
27  printf("-- Event connectionStatusChanged ----------------------\n");
28  printf("clientConnectionId %d \n", clientConnectionId);
29  printf("serverStatus %d \n", serverStatus);
30  printf("-------------------------------------------------------\n");
31  }
32  ;
33 
35  virtual void dataChange(OpcUa_UInt32 clientSubscriptionHandle,
36  const UaDataNotifications& dataNotifications,
37  const UaDiagnosticInfos& /*diagnosticInfos*/) {
38  printf("-- Event dataChange -----------------------------------\n");
39  printf("-------------------------------------------------------\n");
40  }
41  ;
42 
45  OpcUa_UInt32 /*clientSubscriptionHandle*/,
46  const UaStatus& /*status*/) {
47  }
48  ;
49 
51  virtual void newEvents(OpcUa_UInt32 clientSubscriptionHandle,
52  UaEventFieldLists& eventFieldList) {
53  printf("-- Event newEvents ------------------------------------\n");
54  printf("-------------------------------------------------------\n");
55  }
56 };
57 
58 namespace CTA_UA {
59 class NodeManagerCTA;
60 class ControllerObject;
61 struct myStruct;
62 }
63 namespace CTA_Slc {
64 class XmlManager;
65 }
66 
67 namespace CTA_UA {
68 
69 class PushManager: public UaThread {
70  UA_DISABLE_COPY(PushManager);
71 
72 public:
74  static PushManager *getInstance();
75  PushManager();
76  virtual ~PushManager();
77  UaStatus connect(UaString& sUrl,
78  UaClientSdk::SessionSecurityInfo& sessionSecurityInfo);
79 
80  // Start up trame manager for internal monitoring
81  void startUp(ServerManager* pServerManager, std::string url);
82 
83  // Shut down trame manager to stop internal monitoring
84  void shutDown();
85 
86  // Add a variable for traming- must be called before startUp
87  void addVariableToPush(std::string name, ControllerObject *pControler);
88  void run();
89  void callMethod(std::string command);
90 
91 private:
92  // List of variable of trame
93  std::list<std::string> listPush;
94 
95  // Internal session used for monitoring
96  UaClientSdk::UaSession* m_pSession;
97  std::string m_dataIdDescriptorRef;
98 
99  CTA_Slc::XmlManager *m_pAnalyserManager;
100 
101  OpcUa_Boolean m_stop;
102  OpcUa_Boolean m_pause;
103 
104  // Server manager used for internal monitoring
105  ServerManager* m_pServerManager;
106  ControllerObject *m_pControler;
107 };
108 
109 } // end namespace
110 #endif
111