cnet's Application Programming Interface
- NAME
- CNET_get_wlanstate, CNET_get_wlanstate - get or set a WLAN link's state
- SYNOPSIS
#include <cnet.h>
int CNET_get_wlanstate(int link, WLANSTATE *state);
int CNET_set_wlanstate(int link, WLANSTATE newstate);
- DESCRIPTION
-
A WLAN link may be in one of four states.
In sleep state, a link cannot transmit nor receive signals,
and consumes very little energy.
From idle state, the link may be asked to temporarily
enter transmit state to transmit a signal,
and will temporarily enter receive state to receive each signal
within range.
Idle, transmit, and receive states all consume considerably more energy
than idle state.
The battery energy consumed by these four states depends on how long the link
is in each state.
CNET_get_wlanstate determines the current state of a WLAN link.
The variable of type WLANSTATE pointed to by state
will be set to the current state of the link.
CNET_set_wlanstate sets a WLAN link into either sleep or idle state.
Passing WLAN_SLEEP as the second parameter will set the link into
sleep state;
passing WLAN_IDLE will set the link into idle state.
It is not possible to set a WLAN link's state to either WLAN_TX or
WLAN_RX.
Transitions to these states occur automatically,
from the WLAN_IDLE state,
whenever a link is asked to transmit a signal,
or when a signal arrives.
- RETURN VALUE
-
The value 0 is returned on success.
On failure, the value -1 is returned,
and the global variable cnet_errno is set to one of the
following values to describe the error:
- ER_BADARG
- The value of newstate is neither WLAN_SLEEP or
WLAN_IDLE.
- ER_BADLINK
- The value of link is not a valid link number.
- ER_NOTSUPPORTED
- The indicated link is not of type LT_WLAN.
- SEE ALSO
-
CNET_get_wlaninfo and
CNET_set_wlaninfo.
|
cnet v3.3.4, written by Chris.McDonald@uwa.edu.au
Last modified: Tue Mar 1 7:43AM 2016