def __init__(self): self.logger = logging.getLogger(__name__) self.endpoints = [] self._channel_id_counter = 5 self.allow_remote_admin = True self.disabled_clock = False # for debugging we may want to disable clock that writes too much in log self._known_servers = {} # used if we are a discovery server self.aspace = AddressSpace() self.attribute_service = AttributeService(self.aspace) self.view_service = ViewService(self.aspace) self.method_service = MethodService(self.aspace) self.node_mgt_service = NodeManagementService(self.aspace) # import address space from code generated from xml standard_address_space.fill_address_space(self.node_mgt_service) # import address space from save db to disc #standard_address_space.fill_address_space_from_disk(self.aspace) # import address space directly from xml, this has preformance impact so disabled #importer = xmlimporter.XmlImporter(self.node_mgt_service) #importer.import_xml("/home/olivier/python-opcua/schemas/Opc.Ua.NodeSet2.xml") self.loop = utils.ThreadLoop() self.subscription_service = SubscriptionService(self.loop, self.aspace) # create a session to use on server side self.isession = InternalSession(self, self.aspace, self.subscription_service, "Internal", user=User.Admin) self.current_time_node = Node(self.isession, ua.NodeId(ua.ObjectIds.Server_ServerStatus_CurrentTime)) uries = ["http://opcfoundation.org/UA/"] ns_node = Node(self.isession, ua.NodeId(ua.ObjectIds.Server_NamespaceArray)) ns_node.set_value(uries)
def __init__(self, shelffile=None, user_manager=None, session_cls=None): self.logger = logging.getLogger(__name__) self.server_callback_dispatcher = CallbackDispatcher() self.endpoints = [] self._channel_id_counter = 5 self.disabled_clock = False # for debugging we may want to disable clock that writes too much in log self._local_discovery_service = None # lazy-loading self.aspace = AddressSpace() self.attribute_service = AttributeService(self.aspace) self.view_service = ViewService(self.aspace) self.method_service = MethodService(self.aspace) self.node_mgt_service = NodeManagementService(self.aspace) self.load_standard_address_space(shelffile) self.loop = None self.asyncio_transports = [] self.subscription_service = SubscriptionService(self.aspace) self.history_manager = HistoryManager(self) self.user_manager = user_manager # create a session to use on server side self.session_cls = session_cls or InternalSession self.isession = self.session_cls(self, self.aspace, \ self.subscription_service, "Internal", user=UserManager.User.Admin) self.current_time_node = Node(self.isession, ua.NodeId(ua.ObjectIds.Server_ServerStatus_CurrentTime)) self._address_space_fixes() self.setup_nodes()
def __init__(self, cacheFile=None): self.logger = logging.getLogger(__name__) self.server_callback_dispatcher = CallbackDispatcher() self.endpoints = [] self._channel_id_counter = 5 self.allow_remote_admin = True self.disabled_clock = False # for debugging we may want to disable clock that writes too much in log self._known_servers = {} # used if we are a discovery server self.aspace = AddressSpace() self.attribute_service = AttributeService(self.aspace) self.view_service = ViewService(self.aspace) self.method_service = MethodService(self.aspace) self.node_mgt_service = NodeManagementService(self.aspace) self.load_standard_address_space(cacheFile) self.loop = utils.ThreadLoop() self.asyncio_transports = [] self.subscription_service = SubscriptionService(self.loop, self.aspace) self.history_manager = HistoryManager(self) # create a session to use on server side self.isession = InternalSession(self, self.aspace, self.subscription_service, "Internal", user=User.Admin) self.current_time_node = Node(self.isession, ua.NodeId(ua.ObjectIds.Server_ServerStatus_CurrentTime)) self.setup_nodes()