11-11-2012 10:32 PM
Hi,
trying to get wifi_set_sta_power() work on NDK 10.0.9.386.
when i try to call it, i get "Permissioned Denied" (according to errno).
is the wifi_service (wifi_service.h) working in this version of the NDK?
the code is pretty simple..
int 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");
fprintf(stdout, "%s\n", strerror(errno));
fflush(stdout);
}
return result;
}
----
output:
call to wifi_set_sta_power failed
Permission denied
thanks,
J
11-11-2012 11:13 PM
Have you tried to call wifi_get_status() ?
(And no, I have no idea if this works, I'm just suggesting another thing to try since the results might tell you something useful.)
11-12-2012 09:42 AM
hey there, yes, the wifi_get_status() works. the set power doesn't though.
11-12-2012 10:04 AM - edited 11-12-2012 12:32 PM
Seems that your app is not allowed to change wifi radio power state (on/off). Docs say this:
When the device is in an operational mode other than client STA this function fails, errno is set to EBUSY, and the wifi power remains unchanged. Additional restrictions apply to power off requests if, for example, Wi-Fi is the default route for one of the perimeters, or if an application is explicitly bound to the Wi-Fi interface. In such cases the power off request fails and errno is set to EBUSY.
11-12-2012 12:13 PM
11-12-2012 06:18 PM
11-12-2012 07:25 PM
11-12-2012 09:50 PM
yeah, it must not be fully implemented. i've tried enabling every visible permission in the bar file and still no luck.
it would be nice if the API's for controlling devices were more alike. the Bluetooth API is pretty straight forward. the wifi ones is a little more complicated. i.e.with the BT device you register a callback and watch for events of interest. with the wifi one, you just call the function and hope it works.
ah well, hopefully it gets implemented sooner or later.
12-24-2012 09:57 AM
For reference, this is logged in Issue Tracker here:
BBTEN-538 calls to wifi_set_sta_power() fail with Permission Denied