MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / _call_datachange

Method _call_datachange

opcua/common/subscription.py:142–163  ·  view source on GitHub ↗
(self, datachange)

Source from the content-addressed store, hash-verified

140 self.server.publish([ack])
141
142 def _call_datachange(self, datachange):
143 for item in datachange.MonitoredItems:
144 with self._lock:
145 if item.ClientHandle not in self._monitoreditems_map:
146 self.logger.warning("Received a notification for unknown handle: %s", item.ClientHandle)
147 self.has_unknown_handlers = True
148 continue
149 data = self._monitoreditems_map[item.ClientHandle]
150 if hasattr(self._handler, "datachange_notification"):
151 event_data = DataChangeNotif(data, item)
152 try:
153 self._handler.datachange_notification(data.node, item.Value.Value.Value, event_data)
154 except Exception:
155 self.logger.exception("Exception calling data change handler")
156 elif hasattr(self._handler, "data_change"): # deprecated API
157 self.logger.warning("data_change method is deprecated, use datachange_notification")
158 try:
159 self._handler.data_change(data.server_handle, data.node, item.Value.Value.Value, data.attribute)
160 except Exception:
161 self.logger.exception("Exception calling deprecated data change handler")
162 else:
163 self.logger.error("DataChange subscription created but handler has no datachange_notification method")
164
165 def _call_event(self, eventlist):
166 for event in eventlist.Events:

Callers 1

publish_callbackMethod · 0.95

Calls 3

DataChangeNotifClass · 0.85
data_changeMethod · 0.80

Tested by

no test coverage detected