From: Antonio Ospite Date: Sat, 2 Jan 2016 15:46:06 +0000 (+0100) Subject: CallDistanceTransceiver.py: destination_number does not have to be a member X-Git-Url: https://git.ao2.it/SaveMySugar/python3-savemysugar.git/commitdiff_plain/2e3fc2121ee7ab540ada6043714a67a549881ce6?ds=sidebyside;hp=f96fc57c9e932cc92f63c11e6c9e33efd9b4fd36 CallDistanceTransceiver.py: destination_number does not have to be a member The destination_number is only used int he transmit functions, it can very well be just an argument of the transmit functions. --- diff --git a/src/savemysugar/CallDistanceTransceiver.py b/src/savemysugar/CallDistanceTransceiver.py index fbc347a..aaadafd 100755 --- a/src/savemysugar/CallDistanceTransceiver.py +++ b/src/savemysugar/CallDistanceTransceiver.py @@ -216,8 +216,6 @@ class CallDistanceTransceiver(object): self.modem = modem self.translator = MorseTranslator() - self.destination_number = "" - self.call_setup_time_max = call_setup_time_max if add_inter_call_distance: @@ -352,7 +350,7 @@ class CallDistanceTransceiver(object): def get_text(self): return self.text_message - def transmit_symbol(self, symbol, sleep_time): + def transmit_symbol(self, destination_number, symbol, sleep_time): logging.info("Dial and wait %.2f = %.2f + %.2f seconds " "(transmitting '%s')", self.call_setup_time_max + sleep_time, @@ -363,15 +361,13 @@ class CallDistanceTransceiver(object): # Dial, then wait self.call_setup_time_max to make sure the receiver # gets at least one RING, and then hangup and sleep the time needed to # transmit a symbol. - self.modem.send_command("ATDT" + self.destination_number + ";") + self.modem.send_command("ATDT" + destination_number + ";") time.sleep(self.call_setup_time_max) self.modem.send_command("ATH") self.modem.get_response() time.sleep(sleep_time) def transmit(self, message, destination_number): - self.destination_number = destination_number - morse_message = self.translator.text_to_morse(message) distances = self.modulator.modulate(morse_message) @@ -384,7 +380,7 @@ class CallDistanceTransceiver(object): total_sleep_time = self.call_setup_time_max + distance symbol = self.modulator.distance_to_symbol(total_sleep_time) - self.transmit_symbol(symbol, distance) + self.transmit_symbol(destination_number, symbol, distance) def estimate_transmit_duration(self, message): morsemessage = self.translator.text_to_morse(message)