00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 #include <opc/ua/server/addons/endpoints_services.h> 00012 00013 #include "endpoints_parameters.h" 00014 00015 #include <opc/common/addons_core/addon_manager.h> 00016 #include <opc/ua/server/addons/services_registry.h> 00017 #include <opc/ua/services/endpoints.h> 00018 00019 using namespace OpcUa; 00020 using namespace OpcUa::Server; 00021 00022 namespace 00023 { 00024 00025 class EndpointServicesRegistry : public OpcUa::Server::EndpointsRegistry 00026 { 00027 public: 00028 DEFINE_CLASS_POINTERS(EndpointServices); 00029 00030 public: 00031 virtual std::vector<ApplicationDescription> FindServers(const FindServersParameters& params) const 00032 { 00033 // TODO apply filter 00034 return Applications; 00035 } 00036 00037 virtual std::vector<EndpointDescription> GetEndpoints(const GetEndpointsParameters& filter) const 00038 { 00039 // TODO apply filter. 00040 return Endpoints; 00041 } 00042 00043 virtual void RegisterServer(const OpcUa::ServerParameters& parameters) override 00044 { 00045 } 00046 00047 public: 00048 virtual void AddEndpoints(const std::vector<EndpointDescription>& endpoints) override 00049 { 00050 Endpoints.insert(Endpoints.begin(), endpoints.begin(), endpoints.end()); 00051 } 00052 00053 void AddApplications(const std::vector<OpcUa::ApplicationDescription>& applications) override 00054 { 00055 Applications.insert(Applications.begin(), applications.begin(), applications.end()); 00056 } 00057 00058 private: 00059 Server::ServicesRegistry::SharedPtr InternalServer; 00060 bool Debug; 00061 00062 std::vector<EndpointDescription> Endpoints; 00063 std::vector<ApplicationDescription> Applications; 00064 }; 00065 00066 } // namespace 00067 00068 00069 namespace OpcUa 00070 { 00071 Server::EndpointsRegistry::UniquePtr Server::CreateEndpointsRegistry() 00072 { 00073 return Server::EndpointsRegistry::UniquePtr(new EndpointServicesRegistry); 00074 } 00075 } 00076