equal
deleted
inserted
replaced
146 if self.DataProducer is None: |
146 if self.DataProducer is None: |
147 return None |
147 return None |
148 |
148 |
149 # Subscribe data consumer to DataProducer |
149 # Subscribe data consumer to DataProducer |
150 result = self.DataProducer.SubscribeDebugIECVariable( |
150 result = self.DataProducer.SubscribeDebugIECVariable( |
151 iec_path, consumer, buffer_list) |
151 iec_path, consumer, buffer_list) |
152 if result is not None and consumer != self: |
152 if result is not None and consumer != self: |
153 |
153 |
154 # Store data consumer if successfully subscribed and inform |
154 # Store data consumer if successfully subscribed and inform |
155 # consumer of variable data type |
155 # consumer of variable data type |
156 self.DataConsumers[consumer] = iec_path |
156 self.DataConsumers[consumer] = iec_path |
166 # Remove consumer from data consumer list |
166 # Remove consumer from data consumer list |
167 iec_path = self.DataConsumers.pop(consumer, None) |
167 iec_path = self.DataConsumers.pop(consumer, None) |
168 |
168 |
169 # Unsubscribe consumer from DataProducer |
169 # Unsubscribe consumer from DataProducer |
170 if iec_path is not None: |
170 if iec_path is not None: |
171 self.DataProducer.UnsubscribeDebugIECVariable( |
171 self.DataProducer.UnsubscribeDebugIECVariable(iec_path, consumer) |
172 iec_path, consumer) |
|
173 |
172 |
174 def SubscribeAllDataConsumers(self): |
173 def SubscribeAllDataConsumers(self): |
175 """ |
174 """ |
176 Called to Subscribe all data consumers contained in DebugViewer. |
175 Called to Subscribe all data consumers contained in DebugViewer. |
177 May be overridden by inherited classes. |
176 May be overridden by inherited classes. |
190 if self.SubscribeTick and tick and self.Debug: |
189 if self.SubscribeTick and tick and self.Debug: |
191 self.DataProducer.UnsubscribeDebugIECVariable("__tick__", self) |
190 self.DataProducer.UnsubscribeDebugIECVariable("__tick__", self) |
192 |
191 |
193 # Unsubscribe all data consumers in list |
192 # Unsubscribe all data consumers in list |
194 for consumer, iec_path in self.DataConsumers.iteritems(): |
193 for consumer, iec_path in self.DataConsumers.iteritems(): |
195 self.DataProducer.UnsubscribeDebugIECVariable( |
194 self.DataProducer.UnsubscribeDebugIECVariable(iec_path, consumer) |
196 iec_path, consumer) |
|
197 |
195 |
198 self.DataConsumers = {} |
196 self.DataConsumers = {} |
199 |
197 |
200 def GetDataType(self, iec_path): |
198 def GetDataType(self, iec_path): |
201 """ |
199 """ |
205 """ |
203 """ |
206 if self.DataProducer is not None: |
204 if self.DataProducer is not None: |
207 |
205 |
208 # Search for variable informations in project compilation files |
206 # Search for variable informations in project compilation files |
209 data_type = self.DataProducer.GetDebugIECVariableType( |
207 data_type = self.DataProducer.GetDebugIECVariableType( |
210 iec_path.upper()) |
208 iec_path.upper()) |
211 if data_type is not None: |
209 if data_type is not None: |
212 return data_type |
210 return data_type |
213 |
211 |
214 # Search for variable informations in project data |
212 # Search for variable informations in project data |
215 infos = self.DataProducer.GetInstanceInfos(iec_path) |
213 infos = self.DataProducer.GetInstanceInfos(iec_path) |