Add client context to UA_Client

The client context is set in UA_ClientConfig and can be
retrieved using UA_Client_getContext().
This commit is contained in:
Jannis Voelker
2018-01-22 18:21:05 +01:00
committed by Julius Pfrommer
parent 9703c27a52
commit bcb30aa72d
3 changed files with 14 additions and 1 deletions
+5
View File
@@ -70,6 +70,7 @@ typedef struct UA_ClientConfig {
/* Callback function */
UA_ClientStateCallback stateCallback;
void *clientContext;
} UA_ClientConfig;
@@ -81,6 +82,10 @@ UA_Client_new(UA_ClientConfig config);
UA_ClientState UA_EXPORT
UA_Client_getState(UA_Client *client);
/* Get the client context */
void UA_EXPORT *
UA_Client_getContext(UA_Client *client);
/* Reset a client */
void UA_EXPORT
UA_Client_reset(UA_Client *client);
+2 -1
View File
@@ -458,7 +458,8 @@ const UA_ClientConfig UA_ClientConfig_default = {
0, /* .customDataTypesSize */
NULL, /*.customDataTypes */
NULL /*.stateCallback */
NULL, /*.stateCallback */
NULL /*.clientContext */
};
/****************************************/
+7
View File
@@ -80,6 +80,13 @@ UA_Client_getState(UA_Client *client) {
return client->state;
}
void *
UA_Client_getContext(UA_Client *client) {
if(!client)
return NULL;
return client->config.clientContext;
}
/****************/
/* Raw Services */
/****************/