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

Native Development

Reply
New Developer
swaroop7
Posts: 16
Registered: ‎10-23-2013
My Device: Z10
My Carrier: vodafone
Accepted Solution

Get WI-FI state events

Hi,

I am developing BB10 native app.
How to get WI-FI state events like connected/disconnected?

 

Thank you

Please use plain text.
Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Get WI-FI state events

You may be looking for the wifi service library, depending on what you are trying to do: https://developer.blackberry.com/native/reference/core/com.qnx.doc.wifi_service.lib_ref/topic/about_...

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Please use plain text.
BlackBerry Development Advisor (Retired)
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: Get WI-FI state events

Hi

 

take a look here: https://developer.blackberry.com/native/reference/core/com.qnx.doc.wifi_service.lib_ref/topic/about_...

 

Basically you need to use 

 

wifi_service_initialize(wifi_service_t **wifi_service)

 

and then interpet events of type wifi_event_t assisted by wifi_station_connection_get_state(

 

Regards

 

Martin

 

 

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
BlackBerry Development Advisor (Retired)
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: Get WI-FI state events

In fact this has been completely explained in another post from John Murray:

 

http://supportforums.blackberry.com/t5/Native-Development/Get-Wifi-Scan-Result/m-p/2674385#M53333

 

This should give you what you need I think :-)

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
New Developer
swaroop7
Posts: 16
Registered: ‎10-23-2013
My Device: Z10
My Carrier: vodafone

Re: Get WI-FI state events

Thank you mwoolley for solution.

 

Is there any signal slot mechanism for the same?
I have to read events in infinite loop and using either select or poll.
Will this affect device battery or application performance?

 

 

Please use plain text.
BlackBerry Development Advisor (Retired)
mwoolley
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: Get WI-FI state events

You're welcome :-)

 

No, there are no signals/slots for this.

 

If you use select on the FD, you'll be performing blocking I/O so will only perform actual processing when there's an event to read. See http://www.gnu.org/software/libc/manual/html_node/Waiting-for-I_002fO.html for some information on this.

 

Good luck!

 

Martin

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
New Developer
swaroop7
Posts: 16
Registered: ‎10-23-2013
My Device: Z10
My Carrier: vodafone

Re: Get WI-FI state events

Ok. Thanks :smileyhappy:

Please use plain text.