Update public source
This commit is contained in:
+52
-42
@@ -2085,78 +2085,86 @@ def gps_test_start():
|
|||||||
|
|
||||||
global gps_test_service
|
global gps_test_service
|
||||||
|
|
||||||
if get_scanner_status()["running"]:
|
with scanner_lock:
|
||||||
|
|
||||||
with scanner_lock:
|
if (
|
||||||
|
scanner_starting
|
||||||
|
or
|
||||||
|
(
|
||||||
|
scanner_process is not None
|
||||||
|
and
|
||||||
|
scanner_process.poll() is None
|
||||||
|
)
|
||||||
|
):
|
||||||
|
|
||||||
scanner_output.append(
|
scanner_output.append(
|
||||||
"[GUI] GPS test cannot start "
|
"[GUI] GPS test cannot start "
|
||||||
"while scanner is running."
|
"while scanner is running."
|
||||||
)
|
)
|
||||||
|
|
||||||
return jsonify(
|
|
||||||
{
|
|
||||||
"ok": False,
|
|
||||||
"error":
|
|
||||||
"GPS test cannot start "
|
|
||||||
"while scanner is running."
|
|
||||||
}
|
|
||||||
), 409
|
|
||||||
|
|
||||||
with gps_test_lock:
|
|
||||||
|
|
||||||
if (
|
|
||||||
gps_test_service is not None
|
|
||||||
and
|
|
||||||
gps_test_service.running
|
|
||||||
):
|
|
||||||
|
|
||||||
return jsonify(
|
return jsonify(
|
||||||
{
|
{
|
||||||
"ok": False,
|
"ok": False,
|
||||||
"error":
|
"error":
|
||||||
"GPS test is already running."
|
"GPS test cannot start "
|
||||||
|
"while scanner is running."
|
||||||
}
|
}
|
||||||
), 409
|
), 409
|
||||||
|
|
||||||
try:
|
with gps_test_lock:
|
||||||
|
|
||||||
cfg = Config()
|
if (
|
||||||
|
gps_test_service is not None
|
||||||
gps_test_service = GPSTestService(
|
and
|
||||||
cfg,
|
gps_test_service.thread is not None
|
||||||
callback=gps_test_output
|
and
|
||||||
)
|
gps_test_service.thread.is_alive()
|
||||||
|
):
|
||||||
if not gps_test_service.start():
|
|
||||||
|
|
||||||
gps_test_service = None
|
|
||||||
|
|
||||||
return jsonify(
|
return jsonify(
|
||||||
{
|
{
|
||||||
"ok": False,
|
"ok": False,
|
||||||
"error":
|
"error":
|
||||||
"Failed to start GPS test."
|
"GPS test is already running."
|
||||||
}
|
}
|
||||||
), 500
|
), 409
|
||||||
|
|
||||||
except Exception as error:
|
try:
|
||||||
|
|
||||||
gps_test_service = None
|
cfg = Config()
|
||||||
|
|
||||||
with scanner_lock:
|
gps_test_service = GPSTestService(
|
||||||
|
cfg,
|
||||||
|
callback=gps_test_output
|
||||||
|
)
|
||||||
|
|
||||||
|
if not gps_test_service.start():
|
||||||
|
|
||||||
|
gps_test_service = None
|
||||||
|
|
||||||
|
return jsonify(
|
||||||
|
{
|
||||||
|
"ok": False,
|
||||||
|
"error":
|
||||||
|
"Failed to start GPS test."
|
||||||
|
}
|
||||||
|
), 500
|
||||||
|
|
||||||
|
except Exception as error:
|
||||||
|
|
||||||
|
gps_test_service = None
|
||||||
|
|
||||||
scanner_output.append(
|
scanner_output.append(
|
||||||
f"[GUI] Failed to start GPS test: "
|
f"[GUI] Failed to start GPS test: "
|
||||||
f"{error}"
|
f"{error}"
|
||||||
)
|
)
|
||||||
|
|
||||||
return jsonify(
|
return jsonify(
|
||||||
{
|
{
|
||||||
"ok": False,
|
"ok": False,
|
||||||
"error": str(error)
|
"error": str(error)
|
||||||
}
|
}
|
||||||
), 500
|
), 500
|
||||||
|
|
||||||
return jsonify(
|
return jsonify(
|
||||||
{
|
{
|
||||||
@@ -2425,6 +2433,8 @@ def scanner_start():
|
|||||||
|
|
||||||
with scanner_lock:
|
with scanner_lock:
|
||||||
|
|
||||||
|
scanner_starting = False
|
||||||
|
|
||||||
scanner_output.append(
|
scanner_output.append(
|
||||||
"[GUI] WiFi interface was not selected."
|
"[GUI] WiFi interface was not selected."
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user