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

Method publish_callback

opcua/common/subscription.py:117–140  ·  view source on GitHub ↗
(self, publishresult)

Source from the content-addressed store, hash-verified

115 self.server.publish()
116
117 def publish_callback(self, publishresult):
118 self.logger.info("Publish callback called with result: %s", publishresult)
119 if not self.is_ready():
120 self.logger.warning(
121 "Result received but subscription not ready %s", publishresult)
122 return
123
124 if publishresult.NotificationMessage.NotificationData is not None:
125 for notif in publishresult.NotificationMessage.NotificationData:
126 if isinstance(notif, ua.DataChangeNotification):
127 self._call_datachange(notif)
128 elif isinstance(notif, ua.EventNotificationList):
129 self._call_event(notif)
130 elif isinstance(notif, ua.StatusChangeNotification):
131 self._call_status(notif)
132 else:
133 self.logger.warning("Notification type not supported yet for notification %s", notif)
134 else:
135 self.logger.warning("NotificationMessage is None.")
136
137 ack = ua.SubscriptionAcknowledgement()
138 ack.SubscriptionId = self.subscription_id
139 ack.SequenceNumber = publishresult.NotificationMessage.SequenceNumber
140 self.server.publish([ack])
141
142 def _call_datachange(self, datachange):
143 for item in datachange.MonitoredItems:

Callers

nothing calls this directly

Calls 5

is_readyMethod · 0.95
_call_datachangeMethod · 0.95
_call_eventMethod · 0.95
_call_statusMethod · 0.95
publishMethod · 0.45

Tested by

no test coverage detected