Commit add3c46d authored by Ivan Tyagov's avatar Ivan Tyagov

Enable binding to a custom hostname / IPV4 address for OPC UA server.

parent a09a56ae
......@@ -37,9 +37,7 @@ static char doc[] = "rPLC coupler OPC UA server.";
static char args_doc[] = "...";
static struct argp_option options[] = {
{"port", 'p', "4840", 0, "Port to bind to.", 0},
/*
{"server-ip-address", 'a', "", 0, "[not yet available] Server address to bind to.", 0},
*/
{"server-ip-address", 'a', "", 0, "Server address to bind to.", 0},
{"device", 'd', "/dev/i2c-1", 0, "Linux' I2C bus device path.", 0},
{"slave-address-list", 's', "0x58", 0, "Comma separated list of slave I2C addresses.", 0},
{"mode", 'm', "0", 0, "Set different modes of operation of coupler. Default (0) is set attached I2C's state state. Virtual (1) which does NOT set any I2C slaves' state.", 0},
......
......@@ -126,10 +126,18 @@ int main(int argc, char **argv)
signal(SIGTERM, stopHandler);
server = UA_Server_new();
UA_ServerConfig *config = UA_Server_getConfig(server);
// set hostname
if (OPC_UA_ADDRESS) {
UA_String customServerUrls = UA_STRING(OPC_UA_ADDRESS);
config->customHostname = customServerUrls;
}
if (!ENABLE_X509){
UA_ServerConfig_setMinimal(UA_Server_getConfig(server), OPC_UA_PORT, NULL);
UA_ServerConfig_setMinimal(config, OPC_UA_PORT, NULL);
}
UA_ServerConfig *config = UA_Server_getConfig(server);
config->verifyRequestTimestamp = UA_RULEHANDLING_ACCEPT;
// add variables representing physical relays / inputs, etc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment