44 virtual
void Initialize(
Common::AddonsManager & addons, const
Common::AddonParameters & params) override;
45 virtual
void Stop() override;
48 void PublishApplicationsInformation(
std::vector<
OpcUa::ApplicationDescription> applications,
std::vector<
OpcUa::EndpointDescription> endpoints, const
Common::AddonsManager & addons) const;
51 Common::Logger::SharedPtr Logger;
56 void AsyncOpcTcpAddon::Initialize(
Common::AddonsManager & addons, const
Common::AddonParameters & addonParams)
58 Logger = addons.GetLogger();
61 LOG_DEBUG(Logger,
"opc_tcp_async | parameters:");
70 Logger->debug(
"opc_tcp_async | Endpoint is: {}",
d.Endpoints.front().EndpointUrl);
74 std::vector<OpcUa::ApplicationDescription> applicationDescriptions;
75 std::vector<OpcUa::EndpointDescription> endpointDescriptions;
79 applicationDescriptions.push_back(application.Application);
80 endpointDescriptions.insert(endpointDescriptions.end(), application.Endpoints.begin(), application.Endpoints.end());
83 if (endpointDescriptions.empty())
85 LOG_ERROR(Logger,
"opc_tcp_async | Endpoints parameter not present in configuration");
89 if (endpointDescriptions.size() > 1)
91 LOG_ERROR(Logger,
"opc_tcp_async | too many endpoints specified in configuration");
95 PublishApplicationsInformation(applicationDescriptions, endpointDescriptions, addons);
100 Endpoint =
CreateAsyncOpcTcp(params, internalServer->GetServer(), asio->GetIoService(), Logger);
104 void AsyncOpcTcpAddon::PublishApplicationsInformation(std::vector<OpcUa::ApplicationDescription> applications, std::vector<OpcUa::EndpointDescription> endpoints,
const Common::AddonsManager & addons)
const 110 LOG_ERROR(Logger,
"opc_tcp_async | cannot publish information about endpoints. Endpoints services addon not registered.");
114 endpointsAddon->AddEndpoints(endpoints);
115 endpointsAddon->AddApplications(applications);
118 void AsyncOpcTcpAddon::Stop()
120 Endpoint->Shutdown();
133 return Common::Addon::UniquePtr(
new AsyncOpcTcpAddon());
const char EndpointsRegistryAddonId[]
Addon interface definition GNU LGPL.
virtual std::shared_ptr< Addon > GetAddon(const AddonId &id) const =0
getting addon by id
#define LOG_ERROR(__logger__,...)
#define LOG_DEBUG(__logger__,...)
const char ServicesRegistryAddonId[]
OPC UA Address space part. GNU LGPL.
AsyncOpcTcp::Parameters GetOpcTcpParameters(const Common::AddonParameters &addonParams)
virtual Common::Addon::UniquePtr CreateAddon() override
Create instance of addon.
std::vector< Server::ApplicationData > ParseEndpointsParameters(const std::vector< Common::ParametersGroup > &rootGroup, const Common::Logger::SharedPtr &logger)
#define DEFINE_CLASS_POINTERS(ClassName)
Exception declarations GNU LGPL.
AsyncOpcTcp::UniquePtr CreateAsyncOpcTcp(const AsyncOpcTcp::Parameters ¶ms, Services::SharedPtr server, boost::asio::io_service &io, const Common::Logger::SharedPtr &logger)