Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions iw.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,15 @@ function parse_scan(show_hidden, callback) {
* @param {function} callback The callback function.
*/
function scan(options, callback) {
var interface, show_hidden
var interface, show_hidden, exec_options
if (typeof options === 'string') {
var interface = options;
var show_hidden = false;
} else {
var interface = options.iface;
var show_hidden = options.show_hidden || false;
var exec_options = options.exec_options || {};
}

this.exec('iw dev ' + interface + ' scan', parse_scan(show_hidden, callback));
this.exec('iw dev ' + interface + ' scan', exec_options, parse_scan(show_hidden, callback));
}
8 changes: 4 additions & 4 deletions test/iw.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ var IW_SCAN_LINUX = "BSS 14:91:82:c7:76:b9(on wlan0)\n" +
describe('iw', function() {
describe('iw.scan(interface, callback)', function() {
it('should scan the specified interface', function(done) {
iw.exec = function(command, callback) {
iw.exec = function(command, exec_options, callback) {
should(command).eql('iw dev wlan0 scan');
callback(null, IW_SCAN_LINUX, '');
};
Expand Down Expand Up @@ -708,7 +708,7 @@ describe('iw', function() {
})

it('should scan the specified interface and show hidden ssid networks', function(done) {
iw.exec = function(command, callback) {
iw.exec = function(command, exec_options, callback) {
should(command).eql('iw dev wlan0 scan');
callback(null, IW_SCAN_LINUX, '');
};
Expand Down Expand Up @@ -781,7 +781,7 @@ describe('iw', function() {
})

it('should scan the specified interface and not show hidden ssid networks', function(done) {
iw.exec = function(command, callback) {
iw.exec = function(command, exec_options, callback) {
should(command).eql('iw dev wlan0 scan');
callback(null, IW_SCAN_LINUX, '');
};
Expand Down Expand Up @@ -847,7 +847,7 @@ describe('iw', function() {
})

it('should handle errors', function(done) {
iw.exec = function(command, callback) {
iw.exec = function(command, exec_options, callback) {
callback('error');
};

Expand Down