def count_transmit(self, unit1, module1, port_number1, unit2, module2, port_number2): """Deducing two functions(count() and transmit()) as one function. :param unit: the unit (generator) number as a string to be selected :param module: the module (network card) number as a string to be selected :param port_number: the port number as a string to be selected """ self.message = port.count(unit1, module1, port_number1) self.message = self.message + port.count(unit2, module2, port_number2) self.message = self.message + port.transmit(unit1, module1, port_number1) self.message = self.message + port.transmit(unit2, module2, port_number2) self.socket.send(''.join(self.message))
def transmit(self, unit1, module1, port_number1, unit2, module2, port_number2): """Start transmitting on a port. :param unit: the unit (generator) number as a string to be selected :param module: the module (network card) number as a string to be selected :param port_number: the port number as a string to be selected """ self.messages = port.transmit(unit1, module1, port_number1, unit2, module2, port_number2) self.send_msg(self.messages)