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

Function startRealtimeScan

web/scripts/ragnar_modern.js:3356–3389  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3354 }
3355}
3356
3357function wifiThroughputTest() {
3358 const st = document.getElementById('wifi-hm-tp-status');
3359 const iperf = (document.getElementById('wifi-hm-iperf').value || '').trim();
3360 const secs = parseInt(document.getElementById('wifi-hm-tp-secs').value) || 5;
3361 st.textContent = 'Testing (~' + (iperf ? secs * 2 + 5 : secs + 3) + 's)…';
3362 fetch('/api/net/wifi/heatmap', { method: 'POST', headers: { 'Content-Type': 'application/json' },
3363 body: JSON.stringify({ action: 'throughput', iperf_server: iperf, seconds: secs }) })
3364 .then(r => r.json()).then(d => {
3365 const dn = d.down_mbps != null ? d.down_mbps + '↓' : '—';
3366 const up = d.up_mbps != null ? ' ' + d.up_mbps + '↑' : '';
3367 const lat = d.latency_ms != null ? ` · ${d.latency_ms}ms` : '';
3368 const loss = d.loss_pct ? ` · ${d.loss_pct}% loss` : '';
3369 st.innerHTML = `<b>${dn}${up}</b> Mbps${lat}${loss} <span class="text-gray-600">(${d.method})</span>`
3370 + (d.error ? ` <span class="text-amber-400">⚠ ${d.error}</span>` : '');
3371 }).catch(() => { st.textContent = 'test failed'; });
3372}
3373
3374// ---- Design / predictive coverage ------------------------------------------
3375function wifiHmSetMode(m) {
3376 _wifiHm.mode = m;
3377 const survey = m === 'survey';
3378 document.getElementById('wifi-hm-mode-survey').className =
3379 'wifi-hm-seg-btn ' + (survey ? 'wifi-hm-seg-on' : 'wifi-hm-seg-off');
3380 document.getElementById('wifi-hm-mode-design').className =
3381 'wifi-hm-seg-btn ' + (!survey ? 'wifi-hm-seg-on' : 'wifi-hm-seg-off');
3382 document.getElementById('wifi-hm-design-tools').classList.toggle('hidden', survey);
3383 _wifiHm.wallStart = null;
3384 wifiHeatmapRender();
3385}
3386
3387function wifiHmSetTool(t) {
3388 _wifiHm.tool = t;
3389 _wifiHm.wallStart = null;
3390 const sel = (id, on) => { const el = document.getElementById(id); if (el)
3391 el.className = 'wifi-hm-seg-btn ' + (on ? 'wifi-hm-seg-on' : 'wifi-hm-seg-off'); };
3392 sel('wifi-hm-tool-wall', t === 'wall');

Callers

nothing calls this directly

Calls 4

errorMethod · 0.80
networkAwareFetchFunction · 0.70
addConsoleMessageFunction · 0.70
resetScanButtonsFunction · 0.70

Tested by

no test coverage detected