DEPRECATED: Old connection loss handler - replaced by endless loop logic
(self)
| 1226 | self._endless_loop_wifi_search() |
| 1227 | elif not self.known_networks_count: |
| 1228 | self.logger.debug( |
| 1229 | "Endless Loop: keeping AP up — no saved networks to rejoin") |
| 1230 | else: |
| 1231 | self.logger.debug( |
| 1232 | "Endless Loop: keeping AP up — scan is working, will hand over " |
| 1233 | "when a known network appears") |
| 1234 | |
| 1235 | def get_system_wifi_profiles(self): |
| 1236 | """Get all WiFi connection profiles from NetworkManager (system-wide)""" |
| 1237 | try: |
| 1238 | result = subprocess.run(['nmcli', '-t', '-f', 'NAME,TYPE', 'con', 'show'], |
| 1239 | capture_output=True, text=True, timeout=10) |
| 1240 | |
| 1241 | wifi_profiles = [] |
| 1242 | if result.returncode == 0: |
| 1243 | for line in result.stdout.strip().split('\n'): |
| 1244 | if line and ':' in line: |
| 1245 | parts = line.split(':') |
| 1246 | if len(parts) >= 2 and parts[1] == '802-11-wireless': |
| 1247 | wifi_profiles.append(parts[0]) |
| 1248 | |
| 1249 | self.logger.debug(f"Found {len(wifi_profiles)} system WiFi profiles: {wifi_profiles}") |
| 1250 | return wifi_profiles |
| 1251 | |
| 1252 | except Exception as e: |
| 1253 | self.logger.error(f"Error getting system WiFi profiles: {e}") |
| 1254 | return [] |
| 1255 | |
| 1256 | def _check_known_networks_available(self): |
| 1257 | """Check if any known WiFi networks (Ragnar or system) are currently available without disrupting AP mode""" |
| 1258 | try: |
| 1259 | # Get both Ragnar's known networks AND system profiles |
| 1260 | ragnar_known = [net['ssid'] for net in self.known_networks] |
| 1261 | system_profiles = self.get_system_wifi_profiles() |
| 1262 | all_known = list(set(ragnar_known + system_profiles)) # Combine and deduplicate |
nothing calls this directly
no test coverage detected