22 #include <boost/chrono.hpp> 62 , Instance(CreateServerObject(services))
63 , ServerTime(Instance.GetVariable(GetCurrentTimeRelativepath()))
66 Timer.
Start(boost::posix_time::seconds(1), [
this]()
71 std::vector<std::string> uris;
72 uris.push_back(
"http://opcfoundation.org/UA/");
73 uris.push_back(
"http://freeopcua.github.io");
79 node.
SetValue(std::vector<std::string>({
"en" }));
95 if (
Debug) { std::clog <<
"server_object| canceling timer..." << std::endl; }
99 if (
Debug) { std::clog <<
"server_object| timer stopped." << std::endl; }
118 if (
Debug) { std::clog <<
"server_object| Updating server time: " << t << std::endl; }
123 catch (std::exception & ex)
125 std::cerr <<
"Failed to update time at server object: " << ex.what() << std::endl;
const char ServerStatus[]
Object GetObject(const NodeId &id) const
ServerObject(Services::SharedPtr services, boost::asio::io_service &io, bool debug)
Services::SharedPtr Server
Model::Variable ServerTime
OpcUa::RelativePathElement GetHierarchicalElement(const std::string &browseName)
void SetSourceTimestamp(const DateTime &t)
void SetValue(const Variant &value)
std::vector< RelativePathElement > Elements
OPC UA Address space part. GNU LGPL.
A Node object represent an OPC-UA node. It is high level object intended for developper who want to e...
static DateTime Current()
void SetServerTimestamp(const DateTime &t)
void SetValue(const Variant &val) const
Model::Object CreateServerObject(const Services::SharedPtr &services) const
void Start(const boost::asio::deadline_timer::duration_type &t, std::function< void()> handler)