17 using namespace OpcUa;
25 virtual OpcUa::Services::SharedPtr GetServer()
const override;
26 virtual void RegisterEndpointsServices(EndpointServices::SharedPtr endpoints)
override;
27 virtual void UnregisterEndpointsServices()
override;
28 virtual void RegisterViewServices(ViewServices::SharedPtr views)
override;
29 virtual void UnregisterViewServices()
override;
30 virtual void RegisterMethodServices(MethodServices::SharedPtr method)
override;
31 virtual void UnregisterMethodServices()
override;
32 virtual void RegisterNodeManagementServices(NodeManagementServices::SharedPtr addr)
override;
33 virtual void UnregisterNodeManagementServices()
override;
34 virtual void RegisterAttributeServices(AttributeServices::SharedPtr attributes)
override;
35 virtual void UnregisterAttributeServices()
override;
36 virtual void RegisterSubscriptionServices(SubscriptionServices::SharedPtr service)
override;
37 virtual void UnregisterSubscriptionServices()
override;
41 std::shared_ptr<InternalServer> Comp;
54 virtual std::vector<OpcUa::ApplicationDescription> FindServers(
const FindServersParameters & params)
const 56 return std::vector<OpcUa::ApplicationDescription>();
61 return std::vector<OpcUa::EndpointDescription>();
68 virtual std::vector<CallMethodResult> Call(
const std::vector<CallMethodRequest> & methodsToCall)
70 return std::vector<CallMethodResult>();
73 virtual std::vector<AddNodesResult> AddNodes(
const std::vector<AddNodesItem> & items)
75 return std::vector<AddNodesResult>();
78 virtual std::vector<StatusCode> AddReferences(
const std::vector<AddReferencesItem> & items)
80 return std::vector<StatusCode>();
83 virtual void SetMethod(
const NodeId & node, std::function<std::vector<OpcUa::Variant> (
NodeId context, std::vector<OpcUa::Variant> arguments)> callback)
98 return std::vector<BrowseResult>();
101 virtual std::vector<BrowseResult> BrowseNext()
const 103 return std::vector<BrowseResult>();
108 return std::vector<BrowsePathResult>();
111 virtual std::vector<NodeId> RegisterNodes(
const std::vector<NodeId> & params)
const 113 return std::vector<NodeId>();
116 virtual void UnregisterNodes(
const std::vector<NodeId> & params)
const 126 return std::vector<OpcUa::DataValue>(filter.
AttributesToRead.size(), value);
129 virtual std::vector<OpcUa::StatusCode>
Write(
const std::vector<OpcUa::WriteValue> & filter)
144 virtual std::vector<StatusCode> DeleteSubscriptions(
const std::vector<uint32_t> & subscriptions)
146 return std::vector<StatusCode>();
151 return std::vector<MonitoredItemCreateResult>();
156 return std::vector<StatusCode>();
172 class ServicesRegistry::InternalServer :
public Services 192 (void)session_parameters;
201 virtual void CloseSecureChannel(uint32_t channelId)
override 210 virtual void AbortSession()
override 214 virtual DeleteNodesResponse DeleteNodes(
const std::vector<OpcUa::DeleteNodesItem> & nodesToDelete)
override 219 virtual EndpointServices::SharedPtr
Endpoints()
override 221 return EndpointsServices;
224 virtual std::shared_ptr<ViewServices>
Views()
override 226 return ViewsServices;
229 virtual std::shared_ptr<MethodServices>
Method()
override 231 return MethodsServices;
234 virtual std::shared_ptr<NodeManagementServices> NodeManagement()
override 239 virtual std::shared_ptr<AttributeServices> Attributes()
override 241 return AttributesServices;
244 virtual std::shared_ptr<SubscriptionServices> Subscriptions()
override 246 return SubscriptionsServices;
250 void SetEndpoints(std::shared_ptr<EndpointServices> endpoints)
252 EndpointsServices = endpoints ? endpoints :
Services;
255 void SetViews(std::shared_ptr<ViewServices> views)
257 ViewsServices = views ? views :
Services;
260 void SetMethod(std::shared_ptr<MethodServices> method)
262 MethodsServices = method ? method :
Services;
265 void SetAddressSpace(std::shared_ptr<NodeManagementServices> addrs)
267 NodeServices = addrs ? addrs :
Services;
270 void SetAttributes(std::shared_ptr<AttributeServices> attributes)
272 AttributesServices = attributes ? attributes :
Services;
275 void SetSubscriptions(std::shared_ptr<SubscriptionServices> subscriptions)
277 SubscriptionsServices = subscriptions ? subscriptions :
Services;
281 OpcUa::AttributeServices::SharedPtr AttributesServices;
282 OpcUa::ViewServices::SharedPtr ViewsServices;
283 OpcUa::MethodServices::SharedPtr MethodsServices;
284 OpcUa::NodeManagementServices::SharedPtr NodeServices;
285 OpcUa::EndpointServices::SharedPtr EndpointsServices;
286 OpcUa::SubscriptionServices::SharedPtr SubscriptionsServices;
287 std::shared_ptr<DefaultServices>
Services;
291 ServicesRegistry::ServicesRegistry()
292 : Comp(new InternalServer())
303 Comp->SetEndpoints(endpoints);
308 Comp->SetEndpoints(EndpointServices::SharedPtr());
313 Comp->SetViews(views);
318 Comp->SetViews(ViewServices::SharedPtr());
323 Comp->SetMethod(method);
328 Comp->SetMethod(MethodServices::SharedPtr());
333 Comp->SetAddressSpace(addr);
338 Comp->SetAddressSpace(NodeManagementServices::SharedPtr());
344 Comp->SetAttributes(attributes);
349 Comp->SetAttributes(AttributeServices::SharedPtr());
354 Comp->SetSubscriptions(service);
359 Comp->SetSubscriptions(SubscriptionServices::SharedPtr());
369 return Server::ServicesRegistry::UniquePtr(new ::ServicesRegistry());
std::vector< OpcUa::ReadValueId > AttributesToRead
virtual void UnregisterNodeManagementServices()=0
virtual void UnregisterAttributeServices()=0
virtual void UnregisterMethodServices()=0
virtual void UnregisterEndpointsServices()=0
void CloseSession(OpcUa::Binary::IOStream &stream, const OpcUa::Binary::CreateSessionResponse &session)
virtual void RegisterMethodServices(MethodServices::SharedPtr method)=0
const uint8_t DATA_VALUE_STATUS_CODE
std::vector< T > Browse(const NodeId &node, NodeClass nodeClassMask, Services::SharedPtr services)
virtual void UnregisterSubscriptionServices()=0
OpcUa::Binary::CreateSessionResponse CreateSession(OpcUa::Binary::IOStream &stream)
virtual void RegisterAttributeServices(OpcUa::AttributeServices::SharedPtr attributes)=0
OPC UA Address space part. GNU LGPL.
void ActivateSession(OpcUa::Binary::IOStream &stream, const OpcUa::Binary::CreateSessionResponse &session)
virtual std::shared_ptr< OpcUa::Services > GetServer() const =0
virtual void RegisterSubscriptionServices(OpcUa::SubscriptionServices::SharedPtr attributes)=0
virtual void UnregisterViewServices()=0
OpcUa::ResponseHeader Header
virtual void RegisterNodeManagementServices(OpcUa::NodeManagementServices::SharedPtr attributes)=0
virtual void RegisterEndpointsServices(OpcUa::EndpointServices::SharedPtr endpoints)=0
virtual void RegisterViewServices(OpcUa::ViewServices::SharedPtr views)=0
ServicesRegistry::UniquePtr CreateServicesRegistry()