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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 27
Registered: ‎08-14-2012
My Device: bold9780
My Carrier: T-MOBILE

Problems in using function "wifi_set_sta_power" which is from wifi_service.h

Hi,

    I am learning about how to turn on/off wifi in my app. I have found the API about wifi_service.h and use the function from it like this:

 

// Default empty project template
#include "Tttt.hpp"

#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <wifi/wifi_service.h>
#include <stdbool.h>

using namespace bb::cascades;

Tttt::Tttt(bb::cascades::Application *app)
: QObject(app)
{
    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole application lifetime
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    app->setScene(root);
}

int Tttt::setWifiStatus(bool status) {
	int result;
	result = wifi_set_sta_power(status);
	if (result != WIFI_SUCCESS) {
		// function call to wifi_set_sta_power failed
		fprintf(stdout, "%s\n", "call to wifi_set_sta_power failed");

        }
        return result;
}

  But it have some problems in error:

src/Tttt.cpp:30: undefined reference to `wifi_set_sta_power'

  Could you tell me how to deal with it?

 

cheers,

 

Developer
Developer
Posts: 132
Registered: ‎08-24-2011
My Device: Z10 LE + Playbook
My Carrier: MTS Ukraine

Re: Problems in using function "wifi_set_sta_power" which is from wifi_service.h

Hello,

 

Did you find a solution? If so please provide it. 

Thank you!
----------------------------
My Apps: Alchemy Game | Image Resizer | Jam! | Traffic Signs: USA | Radio Record
My Blog: http://bb10pro.com
Developer
Developer
Posts: 132
Registered: ‎08-24-2011
My Device: Z10 LE + Playbook
My Carrier: MTS Ukraine

Re: Problems in using function "wifi_set_sta_power" which is from wifi_service.h

Found a ticket in Jira. This functionality is not available yet. 

Thank you!
----------------------------
My Apps: Alchemy Game | Image Resizer | Jam! | Traffic Signs: USA | Radio Record
My Blog: http://bb10pro.com
Developer
Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Problems in using function "wifi_set_sta_power" which is from wifi_service.h

if you check the capabilities
http://developer.blackberry.com/cascades/reference/qnetworkconfigurationmanager.html#capabilities
CanStartAndStopInterfaces is not set.

i would also love to have an application like autowifi on my old BB that enables/disables wifi based on your location and save battery.
would write it myself, but alas the functionality is not there.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
Developer
Posts: 36
Registered: ‎06-28-2012
My Device: BB10
My Carrier: RIM

Re: Problems in using function "wifi_set_sta_power" which is from wifi_service.h

Hi,

 

I am also getting same kind of error.

Did anyone find solution? If so, provide it.

 

Because in this post they successfully compiled the code.

 

What should be the problem... Does it related to the sdk version?? I am using 10.0.10.261 version...

 

Thanks

 

 

Developer
Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Problems in using function "wifi_set_sta_power" which is from wifi_service.h

maybe you should re-read the thread you have linked...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 36
Registered: ‎06-28-2012
My Device: BB10
My Carrier: RIM

Re: Problems in using function "wifi_set_sta_power" which is from wifi_service.h

Hi,

 

I am not getting.

 

Can you please provide some sample code so that i can successfully compile it and make it work..

 

Thanks

Developer
Posts: 116
Registered: ‎03-15-2011
My Device: Blackberry 9800
My Carrier: developer

Re: Problems in using function "wifi_set_sta_power" which is from wifi_service.h

Hi wzl0515,

 

please let me know if you have resolved the issue. i have requirement to on/off wi-fi programmatically so using the api wifi_set_sta_power but getting error on console: undefined reference to `wifi_set_sta_power' at compilation time.