projects
/
SaveMySugar
/
python3-savemysugar.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TODO: mention some of the known issues in the TODO list
[SaveMySugar/python3-savemysugar.git]
/
src
/
savemysugar
/
CallDistanceTransceiver.py
diff --git
a/src/savemysugar/CallDistanceTransceiver.py
b/src/savemysugar/CallDistanceTransceiver.py
index
aaadafd
..
f04c533
100755
(executable)
--- a/
src/savemysugar/CallDistanceTransceiver.py
+++ b/
src/savemysugar/CallDistanceTransceiver.py
@@
-161,6
+161,11
@@
class MorseDistanceModulator(object):
return distances
return distances
+def log_symbol(distance, symbol, extra_info=""):
+ logging.info("distance: %.2f Received \"%s\"%s", distance, symbol,
+ extra_info)
+
+
class CallDistanceTransceiver(object):
"""Transmit Morse messages using the distance between calls.
class CallDistanceTransceiver(object):
"""Transmit Morse messages using the distance between calls.
@@
-285,17
+290,13
@@
class CallDistanceTransceiver(object):
self.end_of_message = False
self.end_of_message = False
- def log_symbol(self, distance, symbol, extra_info=""):
- logging.info("distance: %.2f Received \"%s\"%s", distance, symbol,
- extra_info)
-
- def receive_character(self):
+ def receive_symbol(self):
current_ring_time = time.time()
if self.previous_ring_time == -1:
self.previous_ring_time = current_ring_time
self.previous_call_time = current_ring_time
current_ring_time = time.time()
if self.previous_ring_time == -1:
self.previous_ring_time = current_ring_time
self.previous_call_time = current_ring_time
-
self.
log_symbol(0, "", "(The very first ring)")
+ log_symbol(0, "", "(The very first ring)")
return
ring_distance = current_ring_time - self.previous_ring_time
return
ring_distance = current_ring_time - self.previous_ring_time
@@
-324,7
+325,7
@@
class CallDistanceTransceiver(object):
character = self.translator.signal_to_character(signal)
extra_info = " got \"%s\"" % character
character = self.translator.signal_to_character(signal)
extra_info = " got \"%s\"" % character
-
self.
log_symbol(call_distance, symbol, extra_info)
+ log_symbol(call_distance, symbol, extra_info)
if symbol != "EOM":
# Add spaces around the wordspace symbol to make it easier to split
if symbol != "EOM":
# Add spaces around the wordspace symbol to make it easier to split
@@
-340,7
+341,7
@@
class CallDistanceTransceiver(object):
def receive_loop(self):
while not self.end_of_message:
self.modem.get_response("RING")
def receive_loop(self):
while not self.end_of_message:
self.modem.get_response("RING")
- self.receive_
character
()
+ self.receive_
symbol
()
logging.debug("Current message: %s", self.morse_message)
self.end_of_message = False
logging.debug("Current message: %s", self.morse_message)
self.end_of_message = False