hoerresb / WifiWizard

A Cordova plugin for managing Wifi networks
Apache License 2.0
205 stars 176 forks source link

getScanResults old level always returns 0 #17

Closed ThibaultNocchi closed 9 years ago

ThibaultNocchi commented 9 years ago

Hello again! With your update on the level value for the getScanResults method, it seems that the old level value always returns "0". Here is my code:

WifiWizard.getScanResults({numLevels:1}, function(result){
    alert(result);
    showScanned(parseScan(result));
});

The alert() show me this:

[{"level":0,"SSID":"fenelonsio","BSSID":"58:8d:09:e2:ad:ad"},{"level":0,"SSID":"OKLM","BSSID":"a2:80:f5:41:3f:0d"}]

Is it a bug in the plugin or did I do something wrong? Thanks!

parsonsmatt commented 9 years ago

An integer value for the level will return an integer between 0 and n-1. If you want the old behavior, you can pass true or 5. Let me know if that works for you. On Feb 2, 2015 8:38 AM, "Thibault" notifications@github.com wrote:

Hello again! With your update on the level value for the getScanResults method, it seems that the old level value always returns "0". Here is my code:

WifiWizard.getScanResults({numLevels:1}, function(result){ alert(result); showScanned(parseScan(result)); });

The alert() show me this:

[{"level":0,"SSID":"fenelonsio","BSSID":"58:8d:09:e2:ad:ad"},{"level":0,"SSID":"OKLM","BSSID":"a2:80:f5:41:3f:0d"}]

Is it a bug in the plugin or did I do something wrong? Thanks!

— Reply to this email directly or view it on GitHub https://github.com/parsonsmatt/WifiWizard/issues/17.

ThibaultNocchi commented 9 years ago

Well it works, I thought giving 1 would be similar to true. Thanks a lot!

Sokarion commented 9 years ago

For me it isn't ok, when i add an option WifiWizard.getScanResults({numLevels:5},... I've no result and i've an error like "getScanResults first parameter be a function to handle list."

hoerresb commented 9 years ago

Try using true instead of 5. E.g. WifiWizard.getScanResults({numLevels:true},...

parsonsmatt commented 9 years ago

The relevant code is here. The error message should definitely be updated. You would be seeing that error if neither the first nor second parameters to the getScanResults call were functions. Can you post the entire calling code that is getting you the error?