MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _flush_serial_entry

Method _flush_serial_entry

wardriving.py:4021–4054  ·  view source on GitHub ↗

Flush a buffered HuginnESP multi-line entry to the session.

(self, gps_lat, gps_lon, gps_alt, companion: '_CompanionState')

Source from the content-addressed store, hash-verified

4019 name = m.group(2).strip()
4020 if mac not in seen_macs and name != '(unknown)':
4021 seen_macs.add(mac)
4022 devices.append({'mac': mac, 'name': name, 'rssi': -85, 'type': 'BLE'})
4023 except Exception as e:
4024 logger.warning(f"hcitool lescan failed: {e}")
4025
4026 return devices
4027
4028 # ------------------------------------------------------------------
4029 # Cell network scanning
4030 # ------------------------------------------------------------------
4031
4032 def _cell_scan_loop(self):
4033 """Background loop: scan for cell towers every ~30 seconds."""
4034 logger.info("Cell network scan loop started")
4035 while self._running:
4036 try:
4037 pos = self._gps.get_position() if self._gps else None
4038 lat = pos['lat'] if pos else None
4039 lon = pos['lon'] if pos else None
4040
4041 towers = self._scan_cell_networks()
4042 for t in towers:
4043 self.session.upsert_cell_tower(
4044 cell_id=t['cell_id'], mcc=t.get('mcc', ''), mnc=t.get('mnc', ''),
4045 lac=t.get('lac', ''), tech=t.get('tech', ''),
4046 provider=t.get('provider', ''), signal_dbm=t.get('signal', -120),
4047 band_freq=t.get('band', ''), lat=lat, lon=lon
4048 )
4049 self.cell_count = len(towers)
4050 except Exception as e:
4051 logger.debug(f"Cell scan error: {e}")
4052 time.sleep(30)
4053 logger.info("Cell network scan loop stopped")
4054
4055 def _scan_cell_networks(self):
4056 """Scan for cell networks using ModemManager (mmcli)."""
4057 towers = []

Callers 2

_parse_serial_lineMethod · 0.95

Calls 2

upsert_networkMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected