Return full GPS status dict.
(self)
| 374 | logger.error(self.error) |
| 375 | return False |
| 376 | except Exception as e: |
| 377 | self.error = f"GPS init failed: {e}" |
| 378 | logger.error(self.error) |
| 379 | return False |
| 380 | |
| 381 | def stop(self): |
| 382 | """Stop GPS reading.""" |
| 383 | self._running = False |
| 384 | self.connected = False |
| 385 | if self._serial: |
| 386 | try: |
| 387 | self._serial.close() |
| 388 | except Exception: |
| 389 | pass |
| 390 | self._serial = None |
| 391 | if self._gpsd_sock: |
| 392 | try: |
| 393 | self._gpsd_sock.close() |
| 394 | except Exception: |
| 395 | pass |
| 396 | self._gpsd_sock = None |
| 397 | logger.info("GPS stopped") |
| 398 | |
| 399 | def attach(self, port): |
| 400 | """(Re)point the GPS reader at a serial port — called by the wardriving |
| 401 | device monitor when a GPS puck is hot-plugged or re-enumerates. |
| 402 | |
| 403 | Idempotent: if already reading that port, do nothing. Prefers gpsd when |
| 404 | it is running (it owns the serial device). This is what makes GPS |
| 405 | self-healing — a puck that appears minutes after boot, or bounces |
| 406 | (disconnect→reconnect), is attached automatically with no restart. |
no test coverage detected