浏览代码

HistoryData: Rename ua_plugin_history_data_service.h to ua_plugin_historydatabase.h

Julius Pfrommer 5 年之前
父节点
当前提交
0c3cbfba9f
共有 5 个文件被更改,包括 31 次插入40 次删除
  1. 1 1
      CMakeLists.txt
  2. 11 11
      include/ua_plugin_history_data_service.h
  3. 2 2
      include/ua_server_config.h
  4. 2 2
      plugins/ua_config_default.c
  5. 15 24
      src/server/ua_services_attribute.c

+ 1 - 1
CMakeLists.txt

@@ -257,7 +257,7 @@ endif()
 
 if(UA_ENABLE_HISTORIZING)
     set(historizing_exported_headers
-        ${PROJECT_SOURCE_DIR}/include/ua_plugin_history_data_service.h
+        ${PROJECT_SOURCE_DIR}/include/ua_plugin_historydatabase.h
         )
     set(historizing_default_plugin_headers
         )

+ 11 - 11
include/ua_plugin_history_data_service.h

@@ -5,22 +5,22 @@
  *    Copyright 2018 (c) basysKom GmbH <opensource@basyskom.com> (Author: Peter Rustler)
  */
 
-#ifndef UA_PLUGIN_HISTORY_DATA_SERVICE_H_
-#define UA_PLUGIN_HISTORY_DATA_SERVICE_H_
+#ifndef UA_PLUGIN_HISTORYDATABASE_H_
+#define UA_PLUGIN_HISTORYDATABASE_H_
 
 #include "ua_types.h"
 #include "ua_server.h"
 
 _UA_BEGIN_DECLS
 
-struct UA_HistoryDataService;
-typedef struct UA_HistoryDataService UA_HistoryDataService;
+struct UA_HistoryDatabase;
+typedef struct UA_HistoryDatabase UA_HistoryDatabase;
 
-struct UA_HistoryDataService {
+struct UA_HistoryDatabase {
     void *context;
 
     void
-    (*deleteMembers)(UA_HistoryDataService *service);
+    (*deleteMembers)(UA_HistoryDatabase *hdb);
 
     /* This function will be called when a nodes value is set.
      * Use this to insert data into your database(s) if polling is not suitable
@@ -28,14 +28,14 @@ struct UA_HistoryDataService {
      * Set it to NULL if you do not need it.
      *
      * server is the server this node lives in.
-     * hdsContext is the context of the UA_HistoryDataService. UA_HistoryDataService.context
+     * hdbContext is the context of the UA_HistoryDatabase.
      * sessionId and sessionContext identify the session which set this value.
      * nodeId is the node id for which data was set.
      * historizing is the nodes boolean flag for historizing
      * value is the new value. */
     void
     (*setValue)(UA_Server *server,
-                void *hdsContext,
+                void *hdbContext,
                 const UA_NodeId *sessionId,
                 void *sessionContext,
                 const UA_NodeId *nodeId,
@@ -47,7 +47,7 @@ struct UA_HistoryDataService {
      * response with statuscode UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED.
      *
      * server is the server this node lives in.
-     * hdsContext is the context of the UA_HistoryDataService. UA_HistoryDataService.context
+     * hdbContext is the context of the UA_HistoryDatabase.
      * sessionId and sessionContext identify the session which set this value.
      * requestHeader, historyReadDetails, timestampsToReturn, releaseContinuationPoints
      * nodesToReadSize and nodesToRead is the requested data from the client. It is from the request object.
@@ -62,7 +62,7 @@ struct UA_HistoryDataService {
      *             Index in the array is the same as in nodesToRead and the UA_HistoryReadResult array. */
     void
     (*readRaw)(UA_Server *server,
-               void *hdsContext,
+               void *hdbContext,
                const UA_NodeId *sessionId,
                void *sessionContext,
                const UA_RequestHeader *requestHeader,
@@ -80,4 +80,4 @@ struct UA_HistoryDataService {
 
 _UA_END_DECLS
 
-#endif /* UA_PLUGIN_HISTORY_DATA_SERVICE_H_ */
+#endif /* UA_PLUGIN_HISTORYDATABASE_H_ */

+ 2 - 2
include/ua_server_config.h

@@ -24,7 +24,7 @@
 #endif
 
 #ifdef UA_ENABLE_HISTORIZING
-#include "ua_plugin_history_data_service.h"
+#include "ua_plugin_historydatabase.h"
 #endif
 
 _UA_BEGIN_DECLS
@@ -194,7 +194,7 @@ struct UA_ServerConfig {
 
     /* Historical Access */
 #ifdef UA_ENABLE_HISTORIZING
-    UA_HistoryDataService historyDataService;
+    UA_HistoryDatabase historyDatabase;
     
     UA_Boolean accessHistoryDataCapability;
     UA_UInt32  maxReturnDataValues; /* 0 -> unlimited size */

+ 2 - 2
plugins/ua_config_default.c

@@ -654,8 +654,8 @@ UA_ServerConfig_delete(UA_ServerConfig *config) {
 
     /* Historical data */
 #ifdef UA_ENABLE_HISTORIZING
-    if (config->historyDataService.deleteMembers)
-        config->historyDataService.deleteMembers(&config->historyDataService);
+    if (config->historyDatabase.deleteMembers)
+        config->historyDatabase.deleteMembers(&config->historyDatabase);
 #endif
 
     UA_free(config);

+ 15 - 24
src/server/ua_services_attribute.c

@@ -22,6 +22,10 @@
 #include "ua_types_encoding_binary.h"
 #include "ua_services.h"
 
+#ifdef UA_ENABLE_HISTORIZING
+#include "ua_plugin_historydatabase.h"
+#endif
+
 /******************/
 /* Access Control */
 /******************/
@@ -1107,14 +1111,10 @@ writeValueAttribute(UA_Server *server, UA_Session *session,
         /* node is a UA_VariableNode*, but it may also point to a UA_VariableTypeNode */
         /* UA_VariableTypeNode doesn't have the historizing attribute */
         if(retval == UA_STATUSCODE_GOOD && node->nodeClass == UA_NODECLASS_VARIABLE &&
-                server->config.historyDataService.setValue)
-            server->config.historyDataService.setValue(server,
-                                                       server->config.historyDataService.context,
-                                                       &session->sessionId,
-                                                       session->sessionHandle,
-                                                       &node->nodeId,
-                                                       node->historizing,
-                                                       &adjustedValue);
+                server->config.historyDatabase.setValue)
+            server->config.historyDatabase.setValue(server, server->config.historyDatabase.context,
+                                                    &session->sessionId, session->sessionHandle,
+                                                    &node->nodeId, node->historizing, &adjustedValue);
 #endif
         /* Callback after writing */
         if(retval == UA_STATUSCODE_GOOD && node->value.data.callback.onWrite)
@@ -1422,9 +1422,6 @@ __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId,
 }
 
 #ifdef UA_ENABLE_HISTORIZING
-
-#include "ua_plugin_history_data_service.h"
-
 void
 Service_HistoryRead(UA_Server *server,
                     UA_Session *session,
@@ -1441,7 +1438,7 @@ Service_HistoryRead(UA_Server *server,
             response->responseHeader.serviceResult = UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED;
             return;
         } else {
-            if (server->config.historyDataService.readRaw) {
+            if (server->config.historyDatabase.readRaw) {
                 response->resultsSize = request->nodesToReadSize;
 
                 response->results = (UA_HistoryReadResult*)UA_Array_new(response->resultsSize, &UA_TYPES[UA_TYPES_HISTORYREADRESULT]);
@@ -1453,18 +1450,12 @@ Service_HistoryRead(UA_Server *server,
                     response->results[i].historyData.content.decoded.data = data;
                     historyData[i] = data;
                 }
-                server->config.historyDataService.readRaw(server,
-                                                          server->config.historyDataService.context,
-                                                          &session->sessionId,
-                                                          session->sessionHandle,
-                                                          &request->requestHeader,
-                                                          details,
-                                                          request->timestampsToReturn,
-                                                          request->releaseContinuationPoints,
-                                                          request->nodesToReadSize,
-                                                          request->nodesToRead,
-                                                          response,
-                                                          historyData);
+                server->config.historyDatabase.readRaw(server, server->config.historyDatabase.context,
+                                                       &session->sessionId, session->sessionHandle,
+                                                       &request->requestHeader, details,
+                                                       request->timestampsToReturn, request->releaseContinuationPoints,
+                                                       request->nodesToReadSize, request->nodesToRead,
+                                                       response, historyData);
                 UA_free(historyData);
                 return;
             }