How to give the opc-server a friendly name?

165 views
Skip to first unread message

Fire Heart

unread,
Mar 15, 2021, 2:16:39 AM3/15/21
to open62541
Hello Forum

Now that I am able to send variables to and fro, I'd like to give my opc-server a friendly name. When I look for servers (with UaExpert), it finds a server called "open62541-based OPC UA Application". How can I change this name?

I was trying to work with the UA_ServerConfig. But every attemt to alter this structure makes my server crash immediately.

Regards
FireHeart

Julius Pfrommer

unread,
Mar 15, 2021, 4:59:43 AM3/15/21
to open62541
Altering the ServerConfig definitely works.
Can you show a small snippet of the crashing code?
Also, the valgrind tool should give helpful debug output.

Regards

Fire Heart

unread,
Mar 22, 2021, 6:49:55 AM3/22/21
to open62541
Hello Forum

Obviously I was a little bit confused with the string conventions ... sometimes, you have to allocate the string-buffers yourself, sometimes not.
pCfg->pOPC = UA_Server_new();
UA_ServerConfig *pUACFG = UA_Server_getConfig(pCfg->pOPC);
UA_ServerConfig_setMinimal(pUACFG,pCfg->OPC.Port,(pCfg->OPC.ena_cert && pCfg->OPC.certificate.length)?&pCfg->OPC.certificate:NULL);
if (pCfg->OPC.strName[0]) pUACFG->applicationDescription.applicationName = UA_LOCALIZEDTEXT("en-US",pCfg->OPC.strName);

This code works now.

Thanks
FireHeart

Reply all
Reply to author
Forward
0 new messages