Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
Thecr0w
Posts: 178
Registered: ‎02-20-2011
My Device: 8700
My Carrier: at&t
Accepted Solution

W!F! Puzzles

Hi there, I have some questions: (1) How can I get current WiFi status? Is my code below right? int wlan = RadioInfo.WAF_WLAN; RadioInfo.getActiveWAFs(wlan); (2) How can I turn off all WiFi connections? Is my code below right? int wlan = RadioInfo.WAF_WLAN; int getActive = RadioInfo.getActiveWAFs(); Radio.deactivateWAFs((getActive & wlan)); (3)How can I get WiFi signal level? Is my code below right(the WiFiLevel is always -254 in 8820 simulator)? int WiFiLevel = 0; WLANInfo.WLANAPInfo APInfo = WLANInfo.getAPInfo(); if (APInfo != null) WiFiLevel = APInfo.getSignalLevel(); I am a newbie first deal with the WiFi,any help will be a great help to me! thanks in advance.

# I tried to change the world, but I couldn't find the source code #



Please use plain text.
Trusted Contributor
Thecr0w
Posts: 178
Registered: ‎02-20-2011
My Device: 8700
My Carrier: at&t

Re: W!F! Puzzles

Hi there, I have some questions: (1) How can I get current WiFi status? Is my code below right? int wlan = RadioInfo.WAF_WLAN; RadioInfo.getActiveWAFs(wlan); (2) How can I turn off all WiFi connections? Is my code below right? int wlan = RadioInfo.WAF_WLAN; int getActive = RadioInfo.getActiveWAFs(); Radio.deactivateWAFs((getActive & wlan)); (3)How can I get WiFi signal level? Is my code below right(the WiFiLevel is always -254 in 8820 simulator)? int WiFiLevel = 0; WLANInfo.WLANAPInfo APInfo = WLANInfo.getAPInfo(); if (APInfo != null) WiFiLevel = APInfo.getSignalLevel(); I am a newbie first deal with the WiFi,any help will be a great help to me! thanks in advance.

# I tried to change the world, but I couldn't find the source code #



Please use plain text.
Trusted Contributor
Thecr0w
Posts: 178
Registered: ‎02-20-2011
My Device: 8700
My Carrier: at&t

Re: W!F! Puzzles

Hi there, I have some questions: (1) How can I get current WiFi status? Is my code below right? int wlan = RadioInfo.WAF_WLAN; RadioInfo.getActiveWAFs(wlan); (2) How can I turn off all WiFi connections? Is my code below right? int wlan = RadioInfo.WAF_WLAN; int getActive = RadioInfo.getActiveWAFs(); Radio.deactivateWAFs((getActive & wlan)); (3)How can I get WiFi signal level? Is my code below right(the WiFiLevel is always -254 in 8820 simulator)? int WiFiLevel = 0; WLANInfo.WLANAPInfo APInfo = WLANInfo.getAPInfo(); if (APInfo != null) WiFiLevel = APInfo.getSignalLevel(); I am a newbie first deal with the WiFi,any help will be a great help to me! thanks in advance.

# I tried to change the world, but I couldn't find the source code #



Please use plain text.
Trusted Contributor
Thecr0w
Posts: 178
Registered: ‎02-20-2011
My Device: 8700
My Carrier: at&t

Re: W!F! Puzzles

[ Edited ]

Hi there, I have some questions:

 

(1) How can I get current WiFi status? Is my code below right?

int wlan = RadioInfo.WAF_WLAN; RadioInfo.getActiveWAFs(wlan);

 

(2) How can I turn off all WiFi connections? Is my code below right?

int wlan = RadioInfo.WAF_WLAN;

int getActive = RadioInfo.getActiveWAFs();

Radio.deactivateWAFs((getActive & wlan));

 

(3)How can I get WiFi signal level? Is my code below right(the WiFiLevel is always -254 in 8820 simulator)?

int WiFiLevel = 0;

WLANInfo.WLANAPInfo APInfo = WLANInfo.getAPInfo();

if (APInfo != null) WiFiLevel = APInfo.getSignalLevel();

 

I am a newbie first deal with the WiFi,any help will be a great help to me!

thanks in advance.

(All above is posted in google chrome browser!)

# I tried to change the world, but I couldn't find the source code #



Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: W!F! Puzzles

Looking briefly, you code looks OK. 

 

Can I suggest that you try all these on a Device?

Please use plain text.
Trusted Contributor
Thecr0w
Posts: 178
Registered: ‎02-20-2011
My Device: 8700
My Carrier: at&t

Re: W!F! Puzzles

[ Edited ]

I tried on both 8900 and 9800 device.

 

        public void WifiChanged() {
                        int getActive = RadioInfo.getActiveWAFs();
                        int wlan = RadioInfo.WAF_WLAN;
                       

                       if (getActive==5) { //only turn off when wifi is active
                             Radio.deactivateWAFs((getActive & wlan)); ///disable wifi
                             System.out.println("<i>deactivateWAFs() executed");
                       }
        }

 

The problem is : WiFi can be turned off when radio signal (3gpp) is open and can't be turned off when radio signal is closed.

# I tried to change the world, but I couldn't find the source code #



Please use plain text.