Serveur OPCUA générique
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Macros
cta_ua_historymanager.h
Aller à la documentation de ce fichier.
1 #ifndef __CTAUAHISTORYMANAGER_H__
2 #define __CTAUAHISTORYMANAGER_H__
3 
4 #include "historymanagerbase.h"
5 #include "uabasenodes.h"
6 #include "servermanager.h"
7 
8 #include "nodemanagerbase.h"
9 
10 namespace CTA_UA {
11 class ControllerObject;
12 }
13 
14 namespace CTA_UA {
15 
16 class TrameData: public IOVariableCallback {
17 public:
18  TrameData();
19  virtual ~TrameData();
20  void dataChange(const UaDataValue& dataValue);
21 
22 };
23 
24 class HistorizedVariable: public IOVariableCallback {
25 
26  UA_DISABLE_COPY(HistorizedVariable);
27 
28 public:
30  virtual ~HistorizedVariable();
31 
32  void dataChange(const UaDataValue& dataValue);
33  UaDataValue getLastValue();
34 
35  // Mutex for the data and settings
36  UaMutex m_mutex;
37 
38  // Variable to historize
39  UaVariable* m_pVariable;
40  // MonitoredItemId for internal monitoring
41  OpcUa_UInt32 m_monitoredItemId;
42 
43  // Flag indicating if the variable is valid
44  OpcUa_Boolean m_isValid;
45 
46  // Memory buffer for the changed values
47  std::list<UaDataValue> m_values;
49 };
50 
51 class HistoryManager: public HistoryManagerBase {
52  UA_DISABLE_COPY(HistoryManager);
53 
54 public:
56  virtual ~HistoryManager();
57  virtual UaStatus readRaw(const ServiceContext& serviceContext,
58  HistoryVariableHandle* pVariableHandle,
59  HistoryReadCPUserDataBase** ppContinuationPoint,
60  OpcUa_TimestampsToReturn timestampsToReturn, OpcUa_UInt32 maxValues,
61  OpcUa_DateTime& startTime, OpcUa_DateTime& endTime,
62  OpcUa_Boolean returnBounds, UaDataValues& dataValues);
63 
64  // Start up history manager for internal monitoring
65  void startUp(ServerManager* pServerManager);
66 
67  // Shut down history manager to stop internal monitoring
68  void shutDown();
69 
70  // Add a variable for historizing - must be called before startUp
71  void addVariableToHistorize(UaNode* pNode,
72  CTA_UA::ControllerObject *pControler);
73 
74 private:
75  // List of variable to historize
76  std::map<UaNodeId, HistorizedVariable*> m_mapVariables;
77 
78  // Internal session used for monitoring
79  Session* m_pSession;
80 
81  // Server manager used for internal monitoring
82  ServerManager* m_pServerManager;
83 };
84 
85 } // end namespace
86 #endif // __CTAUAHISTORYMANAGER_H__