Skip to content
Snippets Groups Projects
Commit 54ab4496 authored by Armin Co's avatar Armin Co
Browse files

SampleServer

parent 9c83ae64
No related branches found
No related tags found
No related merge requests found
...@@ -6,12 +6,14 @@ ...@@ -6,12 +6,14 @@
using namespace OpcUa; using namespace OpcUa;
UaServer server;
std::vector<OpcUa::Variant> my_method(NodeId context, std::vector<OpcUa::Variant> arguments) std::vector<OpcUa::Variant> my_method(NodeId context, std::vector<OpcUa::Variant> arguments)
{ {
std::cout << "Method triggered" << std::endl; std::cout << "Method triggered" << std::endl;
Node vat = server.GetNode("renewable_power");
std::cout << vat.ToString() << std::endl;
std::vector<OpcUa::Variant> result; std::vector<OpcUa::Variant> result;
result.push_back(Variant(static_cast<uint8_t>(0))); result.push_back(Variant(static_cast<uint8_t>(0)));
return result; return result;
...@@ -29,7 +31,7 @@ void add_nodes_to(uint32_t idx, Node &objects) ...@@ -29,7 +31,7 @@ void add_nodes_to(uint32_t idx, Node &objects)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
auto logger = spdlog::stderr_color_mt("server"); auto logger = spdlog::stderr_color_mt("server");
OpcUa::UaServer server(logger); server = UaServer(logger);
server.SetEndpoint("opc.tcp://localhost:4840/opcua/smartgridserver"); server.SetEndpoint("opc.tcp://localhost:4840/opcua/smartgridserver");
server.SetServerURI("Smart Grid OPC UA Server"); server.SetServerURI("Smart Grid OPC UA Server");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment