virtual void StartEndpoints(const std::vector<EndpointDescription>& endpoints, OpcUa::Services::SharedPtr server) override
 {
   for (const EndpointDescription endpoint : endpoints)
   {
     const Common::Uri uri(endpoint.EndpointURL);
     if (uri.Scheme() == "opc.tcp")
     {
       std::shared_ptr<IncomingConnectionProcessor> processor(new OpcTcp(server, Debug));
       TcpParameters tcpParams;
       tcpParams.Port = uri.Port();
       if (Debug) std::clog << "opc_tcp_processor| Starting listen port " << tcpParams.Port << std::endl;
       TcpAddon.Listen(tcpParams, processor);
       Ports.push_back(tcpParams);
     }
   }
 }
Пример #2
0
void OpcUaProtocol::StartEndpoints(std::vector<EndpointDescription> endpoints, Common::AddonsManager& addons)
{
  InternalServer = addons.GetAddon<OpcUa::UaServer::ServicesRegistryAddon>(OpcUa::UaServer::ServicesRegistryAddonID);
  TcpAddon = addons.GetAddon<OpcUa::UaServer::TcpServerAddon>(OpcUa::UaServer::TcpServerAddonID);
  for (const EndpointDescription endpoint : endpoints)
  {
    const Common::Uri uri(endpoint.EndpointURL);
    if (uri.Scheme() == "opc.tcp")
    {
      std::shared_ptr<IncomingConnectionProcessor> processor = OpcUa::Internal::CreateOpcTcpProcessor(InternalServer->GetServer(), Debug);
      TcpParameters tcpParams;
      tcpParams.Port = uri.Port();
      if (Debug) std::clog << "Starting listen port " << tcpParams.Port << std::endl;
      TcpAddon->Listen(tcpParams, processor);
      Ports.push_back(tcpParams.Port);
    }
  }
}