on scan result per second max!
This commit is contained in:
parent
354305d425
commit
795b853b3d
1 changed files with 11 additions and 10 deletions
|
@ -853,7 +853,7 @@ editor = {
|
||||||
$('#sidebar').on('click', '.wificollector .start', editor._wificollector_start)
|
$('#sidebar').on('click', '.wificollector .start', editor._wificollector_start)
|
||||||
.on('click', '.wificollector .stop', editor._wificollector_stop)
|
.on('click', '.wificollector .stop', editor._wificollector_stop)
|
||||||
.on('click', '.wificollector .reset', editor._wificollector_reset);
|
.on('click', '.wificollector .reset', editor._wificollector_reset);
|
||||||
editor._wificollector_scan_perhaps();
|
window.setInterval(editor._wificollector_scan_perhaps, 1000);
|
||||||
},
|
},
|
||||||
_wificollector_data: [],
|
_wificollector_data: [],
|
||||||
_wificollector_start: function () {
|
_wificollector_start: function () {
|
||||||
|
@ -878,12 +878,16 @@ editor = {
|
||||||
$collector.closest('form').addClass('scan-lock');
|
$collector.closest('form').addClass('scan-lock');
|
||||||
},
|
},
|
||||||
_last_max_last: 0,
|
_last_max_last: 0,
|
||||||
|
_last_result: 0,
|
||||||
_wificollector_result: function(data) {
|
_wificollector_result: function(data) {
|
||||||
var $collector = $('#sidebar').find('.wificollector.running'),
|
var $collector = $('#sidebar').find('.wificollector.running'),
|
||||||
$table = $collector.find('table'),
|
$table = $collector.find('table'),
|
||||||
item, i, line, apid, color, max_last = 0;
|
item, i, line, apid, color, max_last = 0, now = Date.now();
|
||||||
editor._wificollector_scan_perhaps();
|
editor._scan_waits = false;
|
||||||
|
|
||||||
if (!data.length) return;
|
if (!data.length) return;
|
||||||
|
if (now-1000 < editor._last_result) return;
|
||||||
|
editor._last_result = now;
|
||||||
|
|
||||||
// ignore this scan?
|
// ignore this scan?
|
||||||
for (i=0; i < data.length; i++) {
|
for (i=0; i < data.length; i++) {
|
||||||
|
@ -917,14 +921,11 @@ editor = {
|
||||||
$collector.find('.count').text(editor._wificollector_data.length);
|
$collector.find('.count').text(editor._wificollector_data.length);
|
||||||
$collector.siblings('[name=data]').val(JSON.stringify(editor._wificollector_data));
|
$collector.siblings('[name=data]').val(JSON.stringify(editor._wificollector_data));
|
||||||
},
|
},
|
||||||
_last_scan: 0,
|
_scan_waits: false,
|
||||||
_wificollector_scan_perhaps: function() {
|
_wificollector_scan_perhaps: function() {
|
||||||
if ($('#sidebar').find('.wificollector.running').length) {
|
if (!editor._scan_waits && $('#sidebar').find('.wificollector.running').length) {
|
||||||
var now = Date.now();
|
editor._scan_waits = true;
|
||||||
window.setTimeout(mobileclient.scanNow(), Math.max(0, 1000-(now-editor._last_scan)));
|
mobileclient.scanNow();
|
||||||
editor._last_scan = now;
|
|
||||||
} else {
|
|
||||||
window.setTimeout(editor._wificollector_scan_perhaps, 1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue