9 Commits

6 changed files with 44 additions and 36 deletions

8
.travis.yml Normal file
View File

@ -0,0 +1,8 @@
language: node_js
branches:
only:
- master
- develop
node_js:
- "4"
- "5"

View File

@ -1,6 +1,9 @@
/**
* Grunt file for node-wifi-scanner
* Grunt file for the ZigBeeSiteSurvey
*
* grunt update
* Updates the local common files with the ones from the editor project
* Create a new bugfix version (x.y.++):
* grunt v:patch
*
@ -10,7 +13,7 @@
* Create a new major version (++.0.0)
* grunt v:major
*
* Created by kc on 06.04.16
* Created by kc on 27.06.15.
*/
module.exports = function (grunt) {
@ -26,43 +29,18 @@ module.exports = function (grunt) {
commitFiles: ['-a'],
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'git@github.com:ancasicolica/ZigBeeSiteSurvey.git',
push: false,
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
regExp: false
}
},
zip: {
'make': {
src: ['./**/**'],
dest: '../ZigBeeSiteSurvey_x.y.z_OS_.zip',
compression: 'DEFLATE'
}
},
compress: {
main: {
options: {
archive: 'dist/ZigBeeSiteSurvey-' + grunt.file.readJSON('package.json').version + '-Win-x64.zip'
},
files: [{
src: ['*.js', 'LICENSE', '*.json', 'node.exe', '*.md', 'lib/**', 'node_modules/**', 'public/**', 'routes/**', 'views/**'],
dest: 'ZigBeeSiteSurvey-' + grunt.file.readJSON('package.json').version + '-Win-x64'
}]
}
}
});
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-zip');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.registerTask('minify', ['concat', 'uglify:js']);
grunt.registerTask('v:patch', ['bump:patch']);
grunt.registerTask('v:minor', ['bump:minor']);
grunt.registerTask('v:major', ['bump:major']);
grunt.registerTask('make', ['zip:make']);
};

View File

@ -1,5 +1,9 @@
#node-wifi-scanner
[![Build Status](https://travis-ci.org/ancasicolica/node-wifi-scanner.svg?branch=master)](https://travis-ci.org/ancasicolica/node-wifi-scanner)
[![npm](https://img.shields.io/npm/v/node-wifi-scanner.svg)]()
[![npm](https://img.shields.io/npm/dt/node-wifi-scanner.svg)](https://www.npmjs.com/package/node-wifi-scanner)
This module for node.js scans available wifi networks. The main purpose was to enhance my node.js based
[ZigBee Site Survey Tool](http://ancasicolica.github.io/ZigBeeSiteSurvey/) with WiFi coexistence charts. This tool
claims to be compatible with current versions of Mac OS-X, Windows and Linux so I'll fix bugs as fast as possible.
@ -19,6 +23,10 @@ It was tested with the following operating systems:
* Ubuntu 14.04
* Raspbian "Jessie"
## Installation
npm i node-wifi-scanner
## Usage
const scanner = require('node-wifi-scanner');
@ -77,3 +85,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -18,9 +18,13 @@ function parseOutput(str, callback) {
var wifis = [];
var err = null;
try {
if (blocks.length < 2) {
// 2nd try, with \r\n
blocks = str.split('\r\n\r\n')
}
if (!blocks || blocks.length === 1) {
// No WiFis found
return [];
return callback(null, []);
}
// Each block has the same structure, while some parts might be available and others

View File

@ -1,27 +1,35 @@
{
"name": "node-wifi-scanner",
"version": "0.0.2",
"version": "0.0.5",
"description": "node.js module for WiFi network detection",
"main": "index.js",
"keywords": [
"WiFi",
"Node.js",
"scanner"
"scanner",
"airport",
"netsh",
"iwlist",
"nmcli"
],
"author": {
"name": "Christian Kuster, CH-8342 Wernetshausen",
"email": "info@kusti.ch",
"url": "http://www.kusti.ch/"
},
"homepage": "http://www.ferropoly.ch/",
"homepage": "https://github.com/ancasicolica/node-wifi-scanner",
"bugs": {
"url": "https://github.com/ancasicolica/node-wifi-scanner/issues",
"email": "info@ancasicolica.ch"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ancasicolica/node-wifi-scanner.git"
},
"engines": {
"node": ">= 4.4.0",
"npm": ">= 2.14.0"
"node": ">= 4.0.0",
"npm": ">= 2.0.0"
},
"scripts": {
"test": "mocha test"
@ -31,6 +39,7 @@
},
"devDependencies": {
"grunt": "0.4.5",
"grunt-bump": "0.7.0"
"grunt-bump": "0.7.0",
"mocha": "2.2.5"
}
}

View File

@ -93,7 +93,7 @@ describe('netsh', function () {
netsh.parseOutput(fs.readFileSync(path.join(__dirname, 'fixtures', 'netsh', 'netsh_sp.txt'), {encoding: 'utf8'}), (err, info) => {
assert.ok(info);
assert.equal(info.length, 8);
console.log(info);
var ap = info[0];
assert.equal(ap.mac, '98:fc:11:b6:88:9e');
assert.equal(ap.ssid, 'CARAMANZANAS_BAJA');