diff --git a/routes/gsm_spy.py b/routes/gsm_spy.py index 03426d9..afef89e 100644 --- a/routes/gsm_spy.py +++ b/routes/gsm_spy.py @@ -34,6 +34,8 @@ REGIONAL_BANDS = { 'PCS1900': {'start': 1930e6, 'end': 1990e6, 'arfcn_start': 512, 'arfcn_end': 810} }, 'Europe': { + 'GSM800': {'start': 832e6, 'end': 862e6, 'arfcn_start': 438, 'arfcn_end': 511}, # E-GSM800 downlink + 'GSM850': {'start': 869e6, 'end': 894e6, 'arfcn_start': 128, 'arfcn_end': 251}, # Also used in some EU countries 'EGSM900': {'start': 925e6, 'end': 960e6, 'arfcn_start': 0, 'arfcn_end': 124}, 'DCS1800': {'start': 1805e6, 'end': 1880e6, 'arfcn_start': 512, 'arfcn_end': 885} }, @@ -226,6 +228,7 @@ def start_scanner(): data = request.get_json() or {} device_index = data.get('device', 0) region = data.get('region', 'Americas') + selected_bands = data.get('bands', []) # Get user-selected bands # Validate device index try: @@ -242,21 +245,24 @@ def start_scanner(): 'error_type': 'DEVICE_BUSY' }), 409 - # Get frequency range for region - bands = REGIONAL_BANDS.get(region, REGIONAL_BANDS['Americas']) + # If no bands selected, use all bands for the region (backwards compatibility) + if not selected_bands: + region_bands = REGIONAL_BANDS.get(region, REGIONAL_BANDS['Americas']) + selected_bands = list(region_bands.keys()) + logger.warning(f"No bands specified, using all bands for {region}: {selected_bands}") # Build grgsm_scanner command - # Example: grgsm_scanner --args="rtl=0" -b GSM850 -b PCS1900 + # Example: grgsm_scanner --args="rtl=0" -b GSM900 try: cmd = ['grgsm_scanner'] # Add device argument (--args for RTL-SDR device selection) cmd.extend(['--args', f'rtl={device_index}']) - # Add band arguments (grgsm_scanner uses band names, not frequencies) + # Add selected band arguments # Map EGSM900 to GSM900 since that's what grgsm_scanner expects - for band_name in bands.keys(): - # Normalize band name (EGSM900 -> GSM900) + for band_name in selected_bands: + # Normalize band name (EGSM900 -> GSM900, remove EGSM prefix) normalized_band = band_name.replace('EGSM', 'GSM') cmd.extend(['-b', normalized_band]) diff --git a/templates/gsm_spy_dashboard.html b/templates/gsm_spy_dashboard.html index 61b1188..78d1f17 100644 --- a/templates/gsm_spy_dashboard.html +++ b/templates/gsm_spy_dashboard.html @@ -1294,13 +1294,24 @@
GSM SCANNER
- - +
+ + +
+
BANDS TO SCAN:
+
+ +
+
+ 💡 Tip: Uncheck unused bands for faster scanning +
+
@@ -1329,6 +1340,24 @@ totalSignals: 0 }; + // Band configurations by region + const BAND_CONFIG = { + 'Europe': [ + { name: 'GSM900', label: 'GSM900 (925-960 MHz)', freq: '925-960 MHz', common: true, recommended: true }, + { name: 'GSM850', label: 'GSM850 (869-894 MHz)', freq: '869-894 MHz', common: true, recommended: true }, + { name: 'GSM800', label: 'GSM800 (832-862 MHz)', freq: '832-862 MHz', common: true, recommended: true }, + { name: 'DCS1800', label: 'DCS1800 (1805-1880 MHz)', freq: '1805-1880 MHz', common: false, recommended: false } + ], + 'Americas': [ + { name: 'GSM850', label: 'GSM850 (869-894 MHz)', freq: '869-894 MHz', common: true, recommended: true }, + { name: 'PCS1900', label: 'PCS1900 (1930-1990 MHz)', freq: '1930-1990 MHz', common: true, recommended: true } + ], + 'Asia': [ + { name: 'GSM900', label: 'GSM900 (925-960 MHz)', freq: '925-960 MHz', common: true, recommended: true }, + { name: 'DCS1800', label: 'DCS1800 (1805-1880 MHz)', freq: '1805-1880 MHz', common: true, recommended: true } + ] + }; + // ============================================ // INITIALIZATION // ============================================ @@ -1337,6 +1366,7 @@ loadObserverLocation(); initDeviceSelector(); startUtcClock(); + updateBandSelector(); // Initialize band selector with default region (Europe) }); function initMap() { @@ -1416,6 +1446,50 @@ } } + // ============================================ + // BAND SELECTOR + // ============================================ + function updateBandSelector() { + const region = document.getElementById('scannerRegion').value; + const bands = BAND_CONFIG[region] || []; + const container = document.getElementById('bandCheckboxes'); + + container.innerHTML = ''; + + bands.forEach(band => { + const checkbox = document.createElement('label'); + checkbox.style.cssText = 'display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 11px; color: var(--text-primary);'; + + const input = document.createElement('input'); + input.type = 'checkbox'; + input.value = band.name; + input.checked = band.recommended; // Recommended bands checked by default + input.style.cssText = 'cursor: pointer;'; + + const labelText = document.createElement('span'); + labelText.textContent = band.label; + + const badge = document.createElement('span'); + if (band.common) { + badge.textContent = '⭐ PRIMARY'; + badge.style.cssText = 'font-size: 8px; padding: 2px 6px; background: rgba(56, 193, 128, 0.2); color: #38c180; border-radius: 3px; font-weight: 600;'; + } else { + badge.textContent = 'SECONDARY'; + badge.style.cssText = 'font-size: 8px; padding: 2px 6px; background: rgba(159, 176, 199, 0.1); color: var(--text-dim); border-radius: 3px;'; + } + + checkbox.appendChild(input); + checkbox.appendChild(labelText); + checkbox.appendChild(badge); + container.appendChild(checkbox); + }); + } + + function getSelectedBands() { + const checkboxes = document.querySelectorAll('#bandCheckboxes input[type="checkbox"]:checked'); + return Array.from(checkboxes).map(cb => cb.value); + } + // ============================================ // SCANNER CONTROL // ============================================ @@ -1432,12 +1506,18 @@ const region = document.getElementById('scannerRegion').value; const lat = parseFloat(document.getElementById('obsLat').value); const lon = parseFloat(document.getElementById('obsLon').value); + const selectedBands = getSelectedBands(); if (isNaN(lat) || isNaN(lon)) { alert('Please enter valid GPS coordinates'); return; } + if (selectedBands.length === 0) { + alert('Please select at least one band to scan'); + return; + } + // Start backend scanner try { const response = await fetch('/gsm_spy/start', { @@ -1446,6 +1526,7 @@ body: JSON.stringify({ device: device, region: region, + bands: selectedBands, // Send selected bands lat: lat, lon: lon })