Parcourir la source

Client: Move non-config definitions out of ua_client_config.h

Julius Pfrommer il y a 6 ans
Parent
commit
a71df69e12
3 fichiers modifiés avec 29 ajouts et 30 suppressions
  1. 24 0
      include/ua_client.h
  2. 5 29
      include/ua_client_config.h
  3. 0 1
      include/ua_server.h

+ 24 - 0
include/ua_client.h

@@ -95,6 +95,9 @@ UA_Client_delete(UA_Client *client);
  * Connect to a Server
  * ------------------- */
 
+typedef void (*UA_ClientAsyncServiceCallback)(UA_Client *client, void *userdata,
+        UA_UInt32 requestId, void *response);
+
 /* Connect to the server
  *
  * @param client to use
@@ -452,6 +455,27 @@ __UA_Client_AsyncServiceEx(UA_Client *client, const void *request,
                            void *userdata, UA_UInt32 *requestId,
                            UA_UInt32 timeout);
 
+/**
+ * Repeated Callbacks
+ * ------------------
+ * Repeated callbacks can be attached to a client and will be executed in the
+ * defined interval. */
+
+typedef void (*UA_ClientCallback)(UA_Client *client, void *data);
+
+UA_StatusCode
+UA_Client_addRepeatedCallback(UA_Client *client,
+                              UA_ClientCallback callback,
+                              void *data, UA_UInt32 interval,
+                              UA_UInt64 *callbackId);
+
+UA_StatusCode
+UA_Client_changeRepeatedCallbackInterval(UA_Client *client,
+                                         UA_UInt64 callbackId,
+                                         UA_UInt32 interval);
+
+UA_StatusCode UA_Client_removeRepeatedCallback(UA_Client *client,
+                                               UA_UInt64 callbackId);
 
 /**
  * .. toctree::

+ 5 - 29
include/ua_client_config.h

@@ -14,6 +14,9 @@
 
 _UA_BEGIN_DECLS
 
+struct UA_Client;
+typedef struct UA_Client UA_Client;
+
 /**
  * .. _client-config:
  *
@@ -45,34 +48,7 @@ typedef enum {
     UA_CLIENTSTATE_SESSION_RENEWED       /* A session with the server is open (renewed) */
 } UA_ClientState;
 
-struct UA_Client;
-typedef struct UA_Client UA_Client;
-
-typedef void (*UA_ClientAsyncServiceCallback)(UA_Client *client, void *userdata,
-        UA_UInt32 requestId, void *response);
-
-/**
- * Repeated Callbacks
- * ^^^^^^^^^^^^^^^^^^ */
-
-typedef void (*UA_ClientCallback)(UA_Client *client, void *data);
-
-UA_StatusCode
-UA_Client_addRepeatedCallback(UA_Client *Client, UA_ClientCallback callback,
-        void *data, UA_UInt32 interval, UA_UInt64 *callbackId);
-
-UA_StatusCode
-UA_Client_changeRepeatedCallbackInterval(UA_Client *Client,
-        UA_UInt64 callbackId, UA_UInt32 interval);
-
-UA_StatusCode UA_Client_removeRepeatedCallback(UA_Client *Client,
-        UA_UInt64 callbackId);
-
-/**
- * Client Configuration Data
- * ^^^^^^^^^^^^^^^^^^^^^^^^^ */
-
-typedef struct UA_ClientConfig {
+typedef struct {
     UA_UInt32 timeout;               /* ASync + Sync response timeout in ms */
     UA_UInt32 secureChannelLifeTime; /* Lifetime in ms (then the channel needs
                                         to be renewed) */
@@ -82,7 +58,7 @@ typedef struct UA_ClientConfig {
     /* Callbacks for async connection handshakes */
     UA_ConnectClientConnection connectionFunc;
     UA_ConnectClientConnection initConnectionFunc;
-    UA_ClientCallback pollConnectionFunc;
+    void (*pollConnectionFunc)(UA_Client *client, void *context);
 
     /* Custom DataTypes */
     size_t customDataTypesSize;

+ 0 - 1
include/ua_server.h

@@ -27,7 +27,6 @@ typedef struct UA_ServerConfig UA_ServerConfig;
 struct UA_Server;
 typedef struct UA_Server UA_Server;
 
-struct UA_ClientConfig;
 struct UA_Client;
 
 /**