Update public source

This commit is contained in:
2026-10-17 06:33:57 +03:00
parent bc5a0b42be
commit 2b25a01d45
2 changed files with 68 additions and 10 deletions
+59
View File
@@ -16,6 +16,8 @@ class GPSTestService:
self.cfg = cfg
self.callback = callback
self.source = None
self.source_lock = threading.Lock()
self.thread = None
self.stop_event = threading.Event()
@@ -76,6 +78,34 @@ class GPSTestService:
self.stop_event.set()
with self.source_lock:
source = self.source
if source is None:
return
connection = getattr(
source,
"socket",
None
)
if connection is not None:
try:
connection.shutdown(2)
except OSError:
pass
try:
source.close()
except Exception as error:
self.emit(
f"[GPS TEST] Stop close error: {error}"
)
def worker(self):
@@ -93,11 +123,19 @@ class GPSTestService:
self.cfg
)
with self.source_lock:
self.source = source
if self.stop_event.is_set():
return
self.emit(
"[GPS TEST] Connecting to GPS source..."
)
file = source.open()
if self.stop_event.is_set():
return
self.state = "CONNECTED"
@@ -122,6 +160,10 @@ class GPSTestService:
line = file.readline()
if not line:
if self.stop_event.wait(0.1):
break
continue
self.nmea_count += 1
@@ -199,6 +241,8 @@ class GPSTestService:
except Exception as error:
if not self.stop_event.is_set():
self.state = "ERROR"
self.error = str(error)
@@ -208,6 +252,17 @@ class GPSTestService:
finally:
if file is not None:
try:
file.close()
except Exception as error:
self.emit(
f"[GPS TEST] File close error: {error}"
)
if source is not None:
try:
@@ -219,6 +274,10 @@ class GPSTestService:
f"[GPS TEST] Close error: {error}"
)
with self.source_lock:
if self.source is source:
self.source = None
self.running = False
if self.state != "ERROR":
+1 -2
View File
@@ -1052,7 +1052,6 @@ class WiFiConnectionService:
except NetworkCommandError as error:
if success:
restore_error = str(
error
)
@@ -1084,7 +1083,7 @@ class WiFiConnectionService:
raise NetworkRestoreError(
f"{verification_error}"
"The previous Wi-Fi connection could not be restored: "
"The previous Wi-Fi state could not be restored: "
f"{restore_error}. "
+ (
f"The temporary profile could not be deleted: {cleanup_error}"