Reading the documentation and examples of the OPC-UA foundation and OPC-UA open62541 sdk, the variables nodes are always added before the statement to start run the server. Is it possible to add them after the server has been started? If I change the order of the statements that doesn't work.
Think with me the following situation: I need to do some http requests as soon we start running the application/software (not the server) asynchronously. Then the server starts, after my http request is done, I added variable nodes based on the information returned from the web.
I put some comments on the code to clarify what I am trying to do.
int main() {
signal(SIGINT, stopHandler);
signal(SIGTERM, stopHandler);
UA_ServerConfig *config = UA_ServerConfig_new_default();
UA_Server *server = UA_Server_new(config);
// If I put this statement after the other statement:
// UA_StatusCode retval = UA_Server_run(server, &running);
// The variables are not added.
addVariable(server);
// I would like to add some variables nodes after this statement,
// for example, like I said I request some information online
// and I will add the nodes after return from this request asynchronous.
UA_StatusCode retval = UA_Server_run(server, &running);
UA_Server_delete(server);
UA_ServerConfig_delete(config);
return retval == UA_STATUSCODE_GOOD ? EXIT_SUCCESS : EXIT_FAILURE;
}