Adds logging for modem reconnections.
This commit is contained in:
@@ -250,7 +250,7 @@ def monitor_gps(ser, output_file):
|
||||
ser.readline()
|
||||
try:
|
||||
while ser.is_open:
|
||||
nmea_sentence = ser.readline() #GPRMC
|
||||
nmea_sentence = ser.readline() # GPRMC
|
||||
nmea_str = nmea_sentence.decode("utf-8")
|
||||
if nmea_str.startswith("$GPRMC"):
|
||||
write_to_file(output_file, nmea_str)
|
||||
@@ -603,7 +603,6 @@ class Client:
|
||||
sleep(2)
|
||||
print_message("done...")
|
||||
|
||||
|
||||
def ping(self):
|
||||
c = "ping {} -I {} -i {} -c {}".format(
|
||||
self.config["server"],
|
||||
@@ -769,6 +768,12 @@ class Client:
|
||||
print_message("Use ws filter: {}".format(ws_filter))
|
||||
for n in range(1, self.config["number_of_measurements"] + 1):
|
||||
if not is_modem_connected():
|
||||
background_write_to_file(
|
||||
filepath="{}{}_reconnect.log".format(
|
||||
self.config["folder"], self.config["prefix"]
|
||||
),
|
||||
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||
)
|
||||
reconnect_modem()
|
||||
print_message(
|
||||
"{} of {}".format(n, self.config["number_of_measurements"])
|
||||
@@ -813,12 +818,26 @@ class Client:
|
||||
iperf_return = 0
|
||||
while not is_measurement_done or iperf_return != 0:
|
||||
if iperf_return != 0:
|
||||
background_write_to_file(
|
||||
filepath="{}{}_reconnect.log".format(
|
||||
self.config["folder"], self.config["prefix"]
|
||||
),
|
||||
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||
)
|
||||
reconnect_modem()
|
||||
try:
|
||||
try:
|
||||
iperf_return = subprocess.call(iperf_command, timeout=float(time) + TIMEOUT_OFFSET)
|
||||
iperf_return = subprocess.call(
|
||||
iperf_command, timeout=float(time) + TIMEOUT_OFFSET
|
||||
)
|
||||
except:
|
||||
print_message("iPerf timed out...")
|
||||
background_write_to_file(
|
||||
filepath="{}{}_reconnect.log".format(
|
||||
self.config["folder"], self.config["prefix"]
|
||||
),
|
||||
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||
)
|
||||
reconnect_modem()
|
||||
except KeyboardInterrupt:
|
||||
exit()
|
||||
@@ -838,6 +857,12 @@ class Client:
|
||||
print_message("tcp probe is now enabled")
|
||||
for n in range(1, self.config["number_of_measurements"] + 1):
|
||||
if not is_modem_connected():
|
||||
background_write_to_file(
|
||||
filepath="{}{}_reconnect.log".format(
|
||||
self.config["folder"], self.config["prefix"]
|
||||
),
|
||||
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||
)
|
||||
reconnect_modem()
|
||||
print_message(
|
||||
"{} of {}".format(n, self.config["number_of_measurements"])
|
||||
@@ -881,12 +906,26 @@ class Client:
|
||||
iperf_return = 0
|
||||
while not is_measurement_done or iperf_return != 0:
|
||||
if iperf_return != 0:
|
||||
background_write_to_file(
|
||||
filepath="{}{}_reconnect.log".format(
|
||||
self.config["folder"], self.config["prefix"]
|
||||
),
|
||||
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||
)
|
||||
reconnect_modem()
|
||||
try:
|
||||
try:
|
||||
iperf_return = subprocess.call(iperf_command, timeout=float(time) + TIMEOUT_OFFSET)
|
||||
iperf_return = subprocess.call(
|
||||
iperf_command, timeout=float(time) + TIMEOUT_OFFSET
|
||||
)
|
||||
except:
|
||||
print_message("iPerf timed out...")
|
||||
background_write_to_file(
|
||||
filepath="{}{}_reconnect.log".format(
|
||||
self.config["folder"], self.config["prefix"]
|
||||
),
|
||||
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||
)
|
||||
reconnect_modem()
|
||||
except KeyboardInterrupt:
|
||||
exit()
|
||||
|
||||
Reference in New Issue
Block a user