package at.casephonegap.wifiInfo;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.util.Log;

public class wifiInfo extends CordovaPlugin 
{ private int numberOfLevels;
  private int level;
  private String ssid;

  @Override
  public boolean execute(String action, JSONArray args, CallbackContext callback) throws JSONException 
  { // grab the correct methods
    Log.d("wifiInfo Plugin", action);
    if (action.equalsIgnoreCase("getConnectionInfo")) 
    { numberOfLevels = 5;
      try 
      { WifiManager wifiManager = (WifiManager) this.cordova.getActivity().getSystemService(Context.WIFI_SERVICE);
        WifiInfo wifiInfo = wifiManager.getConnectionInfo(); 

        level = WifiManager.calculateSignalLevel(wifiInfo.getRssi(), numberOfLevels);
        ssid = wifiInfo.getSSID().replaceAll("\"","");
        JSONObject obj = new JSONObject();
        obj.put("level", level);
        obj.put("ssid", ssid);
        //Log.i("wifiInfo Plugin", "Level: " + level); 
        //Log.i("wifiInfo Plugin", "SSID: " + ssid);
        callback.success(obj);
        return true; 
      }
      catch (Exception e) 
      { Log.d("wifiInfo Plugin", "Error: " + e.getMessage()); 
        callback.error("Fehler in wifiInfo");
        return false;
      }
    }
    else { callback.error("Unknown Action: " + action); }
  return false;
  }
}

@@ -595,16 +595,40 @@
 methods%0A
+    numberOfLevels = 5;%0A
     Log.
@@ -657,16 +657,16 @@
 ction);%0A
-
     if (
@@ -721,34 +721,8 @@
    %7B
- numberOfLevels = 5;%0A     
  try
@@ -900,17 +900,60 @@
 nfo(); %0A
+        Log.d(%22wifiInfo Plugin%22, wifiInfo);
 %0A
-
         
@@ -1030,16 +1030,68 @@
 evels);%0A
+        Log.d(%22wifiInfo Plugin%22, 'Level:' + level);%0A
         
@@ -1133,24 +1133,75 @@
 l(%22%5C%22%22,%22%22);%0A
+        Log.d(%22wifiInfo Plugin%22, 'SSID: ' + ssid);%0A
         JSON
@@ -1256,32 +1256,32 @@
 level%22, level);%0A
-
         obj.put(
@@ -1287,32 +1287,81 @@
 (%22ssid%22, ssid);%0A
+        Log.d(%22wifiInfo Plugin%22, 'Obj: ' + obj);%0A
         //Log.i(

Update wifiInfo.java