def parse_service_type_fb(self, fb, fb_xml): self.__parse_all_fb(fb, fb_xml) # create the ua method to call fb = self.ua_peer.config.get_fb(self.fb_name) # creates the connection to initialize the fb self.ua_peer.config.create_connection( '{0}.{1}'.format('START', 'COLD'), '{0}.{1}'.format(self.fb_name, 'INIT')) # virtualize the method that allows the remote running ua_method.Method2Call('RUN', fb, self.ua_peer)
def __dm_method(self, method_xml): """ Receives a method in the XML format and creates it's OPC-UA representation. The XML representation comes from the data model XML. :param method_xml: XML method from the data_model.xml. """ method_name = method_xml.attrib['name'] # gets the created fb fb = self.ua_peer.config.get_fb(self.fb_name) method2call = ua_method.Method2Call(method_name, fb, self.ua_peer) # parses the method from the xml method2call.from_xml(method_xml) # virtualize (opc-ua) the method method2call.virtualize(self.methods_idx, self.methods_path, method2call.method_name) # save the method in the dictionary self.methods_dict[method_name] = method2call
def __fb_method(self, input_event, input_vars_xml, output_vars_xml): """ Receives a method in the XML format and creates it's OPC-UA representation. The XML representation comes from the function block XML. :param input_event: event that represents the method name. :param input_vars_xml: method input variables XML :param output_vars_xml: method output variables XML """ # gets the method name method_name = input_event.attrib['Name'] # gets the created fb fb = self.ua_peer.config.get_fb(self.fb_name) # creates the opc-ua method method2call = ua_method.Method2Call(method_name, fb, self.ua_peer) # parses the inputs_vars and the output_vars method2call.from_fb(input_vars_xml, output_vars_xml) # virtualize (opc-ua) the method method2call.virtualize(self.methods_idx, self.methods_path, method2call.method_name) # save the method in the dictionary self.methods_dict[method_name] = method2call