mirror of
https://github.com/open62541/open62541.git
synced 2026-10-29 13:20:10 +08:00
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:
committed by
Julius Pfrommer
parent
9703c27a52
commit
bcb30aa72d
@@ -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);
|
||||
|
||||
@@ -458,7 +458,8 @@ const UA_ClientConfig UA_ClientConfig_default = {
|
||||
|
||||
0, /* .customDataTypesSize */
|
||||
NULL, /*.customDataTypes */
|
||||
NULL /*.stateCallback */
|
||||
NULL, /*.stateCallback */
|
||||
NULL /*.clientContext */
|
||||
};
|
||||
|
||||
/****************************************/
|
||||
|
||||
@@ -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 */
|
||||
/****************/
|
||||
|
||||
Reference in New Issue
Block a user