00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 #pragma once 00013 00014 #include <opc/common/addons_core/addon.h> 00015 #include <opc/ua/event.h> 00016 #include <opc/ua/server/address_space.h> 00017 #include <opc/ua/server/services_registry.h> 00018 #include <opc/ua/services/view.h> 00019 #include <opc/ua/services/subscriptions.h> 00020 00021 namespace OpcUa 00022 { 00023 namespace Internal 00024 { 00025 00026 class AddressSpaceAddon 00027 : public Common::Addon 00028 , public Server::AddressSpace 00029 { 00030 public: 00031 DEFINE_CLASS_POINTERS(AddressSpaceAddon); 00032 00033 AddressSpaceAddon(); 00034 virtual ~AddressSpaceAddon(); 00035 00036 public: 00037 virtual void Initialize(Common::AddonsManager& addons, const Common::AddonParameters& params); 00038 virtual void Stop(); 00039 00040 public: // NodeManagementServices 00041 virtual std::vector<AddNodesResult> AddNodes(const std::vector<AddNodesItem>& items); 00042 virtual std::vector<StatusCode> AddReferences(const std::vector<AddReferencesItem>& items); 00043 00044 public: // ViewServices 00045 virtual std::vector<BrowseResult> Browse(const OpcUa::NodesQuery& query) const; 00046 virtual std::vector<BrowseResult> BrowseNext() const; 00047 virtual std::vector<BrowsePathResult> TranslateBrowsePathsToNodeIds(const TranslateBrowsePathsParameters& params) const; 00048 virtual std::vector<NodeId> RegisterNodes(const std::vector<NodeId>& params) const; 00049 virtual void UnregisterNodes(const std::vector<NodeId>& params) const; 00050 00051 public: // AttribueServices 00052 virtual std::vector<DataValue> Read(const OpcUa::ReadParameters& filter) const; 00053 virtual std::vector<StatusCode> Write(const std::vector<OpcUa::WriteValue>& filter); 00054 00055 public: // Server internal methods 00056 virtual uint32_t AddDataChangeCallback(const NodeId& node, AttributeId attribute, std::function<Server::DataChangeCallback> callback); 00057 virtual void DeleteDataChangeCallback(uint32_t clienthandle); 00058 virtual StatusCode SetValueCallback(const NodeId& node, AttributeId attribute, std::function<DataValue(void)> callback); 00059 00060 private: 00061 struct Options 00062 { 00063 bool Debug = false; 00064 }; 00065 00066 private: 00067 Options GetOptions(const Common::AddonParameters& addonParams); 00068 00069 private: 00070 OpcUa::Server::AddressSpace::SharedPtr Registry; 00071 std::shared_ptr<OpcUa::Server::ServicesRegistry> InternalServer; 00072 }; 00073 00074 } // namespace UaServer 00075 } // namespace OpcUa