unable to see :wifi state changing when simulating wifi connected

Hi,

i'm getting info about bt and wifi from the following:

            var btstate=null;
            btstate=System.getDeviceSettings().connectionInfo[:bluetooth];
            if (btstate!=null) {BtActive=btstate.state;} else {BtActive=0;}

            var wifistate=null;
            wifistate=System.getDeviceSettings().connectionInfo[:wifi];
            if (wifistate!=null) {WiFiActive=wifistate.state;} else {WiFiActive=0;}
Bt is correctly working: BtActive get 0,1, and 2 depending on not initialized, disconnected, connected. Unfortunately i cannot see WiFiActive getting the 2 value (connected)
I did a cross checking using 
var xxx=System.getDeviceSettings().connectionInfo;
somewhere inside the code and using a breakpoint and aiming to the xxx variable i never see wifi.state =2
what i am missing