def _receive(self): msg = self._connection.receive_from_socket(self._socket) if msg is None: return elif isinstance(msg, ua.Message): self._call_callback(msg.request_id(), msg.body()) elif isinstance(msg, ua.Acknowledge): self._call_callback(0, msg) elif isinstance(msg, ua.ErrorMessage): self.logger.fatal("Received an error: %s", msg) self._call_callback(0, ua.UaStatusCodeError(msg.Error.value)) else: raise ua.UaError("Unsupported message type: %s", msg)
def delete_reference(self, target, reftype, forward=True, bidirectional=True): """ Delete given node's references from address space """ known_refs = self.get_references(reftype, includesubtypes=False) targetid = _to_nodeid(target) for r in known_refs: if r.NodeId == targetid and r.IsForward == forward: rdesc = r break else: raise ua.UaStatusCodeError(ua.StatusCodes.BadNotFound) ditem = self._fill_delete_reference_item(rdesc, bidirectional) self.server.delete_references([ditem])[0].check()