DSWifi
|
Macros | |
#define | INIT_ONLY (0 << 0) |
Init library only, don't try to connect to AP. Used by Wifi_InitDefault(). | |
#define | WFC_CONNECT (1 << 0) |
Init library and try to connect to firmware AP. Used by Wifi_InitDefault(). | |
#define | WIFI_DISABLE_LED (1 << 1) |
Don't let the library control the LED blinking. | |
#define | WIFI_ENABLE_LED (0 << 1) |
Allow the library to control how the LED blinks (DS and DS Lite only). | |
#define | WIFI_INTERNET_AND_LOCAL (0 << 2) |
Initialize both internet and local multiplayer modes. | |
#define | WIFI_LOCAL_ONLY (1 << 2) |
Only initialize local multiplayer mode. | |
Enumerations | |
enum | WIFIGETDATA { WIFIGETDATA_MACADDRESS , WIFIGETDATA_NUMWFCAPS , WIFIGETDATA_RSSI , MAX_WIFIGETDATA } |
User code uses members of the WIFIGETDATA structure in calling Wifi_GetData() to retreive miscellaneous odd information. More... | |
Functions | |
int | Wifi_CheckInit (void) |
Used to determine if the library has been initialized. | |
bool | Wifi_Deinit (void) |
Stops the WiFi library. | |
void | Wifi_DisableWifi (void) |
Instructs the ARM7 to disengage wireless and stop receiving or transmitting. | |
void | Wifi_EnableWifi (void) |
Instructs the ARM7 to go into a basic "active" mode. | |
int | Wifi_GetData (int datatype, int bufferlen, unsigned char *buffer) |
Retrieve an arbitrary or misc. piece of data from the WiFi hardware. | |
u32 | Wifi_GetStats (int statnum) |
Retreive an element of the WiFi statistics gathered. | |
void | Wifi_IdleMode (void) |
Sets the WiFI hardware in "active" mode. | |
bool | Wifi_InitDefault (unsigned int flags) |
Initializes WiFi library. | |
bool | Wifi_LibraryModeReady (void) |
Checks whether a library mode change has finished or not. | |
void | Wifi_SetChannel (int channel) |
If the WiFi system is not connected or connecting to an access point, instruct the chipset to change channel. | |
void | Wifi_SetPromiscuousMode (int enable) |
Allows the DS to enter or leave a "promsicuous" mode. | |
void | Wifi_Timer (int num_ms) |
This function should be called in a periodic interrupt. | |
#define WIFI_INTERNET_AND_LOCAL (0 << 2) |
Initialize both internet and local multiplayer modes.
Both internet and local multiplayer modes become available.
#define WIFI_LOCAL_ONLY (1 << 2) |
Only initialize local multiplayer mode.
DSWiFi is initialized, but Internet mode becomes unavailable. DSWiFi won't need to allocate any memory on the heap for the IP stack (sgIP).
If your game only uses local multiplayer mode, you can use this option to save RAM.
enum WIFIGETDATA |
User code uses members of the WIFIGETDATA structure in calling Wifi_GetData() to retreive miscellaneous odd information.
int Wifi_CheckInit | ( | void | ) |
Used to determine if the library has been initialized.
bool Wifi_Deinit | ( | void | ) |
Stops the WiFi library.
It will free all RAM and resources used by the library.
It must be called after calling Wifi_DisableWifi() and waiting for a frame or two.
void Wifi_DisableWifi | ( | void | ) |
Instructs the ARM7 to disengage wireless and stop receiving or transmitting.
It keeps the library active. If you want to free all resources used by the library, call Wifi_Deinit().
void Wifi_EnableWifi | ( | void | ) |
Instructs the ARM7 to go into a basic "active" mode.
The hardware is powered on, but not associated or doing anything useful. It can still receive and transmit packets.
int Wifi_GetData | ( | int | datatype, |
int | bufferlen, | ||
unsigned char * | buffer | ||
) |
Retrieve an arbitrary or misc. piece of data from the WiFi hardware.
See the WIFIGETDATA enum.
datatype | Element from the WIFIGETDATA enum specifing what kind of data to get. |
bufferlen | Length of the buffer to copy data to (not always used) |
buffer | Buffer to copy element data to (not always used) |
u32 Wifi_GetStats | ( | int | statnum | ) |
Retreive an element of the WiFi statistics gathered.
statnum | Element from the WIFI_STATS enum, indicating what statistic to return. |
void Wifi_IdleMode | ( | void | ) |
Sets the WiFI hardware in "active" mode.
The hardware is powered on, but not associated or doing anything useful. It can still receive and transmit packets.
bool Wifi_InitDefault | ( | unsigned int | flags | ) |
Initializes WiFi library.
It initializes the WiFi hardware, sets up a FIFO handler to communicate with the ARM7 side of the library, and it sets up timer 3 to be used by DSWiFi.
You can pass a few options depending on your needs:
If INIT_ONLY is passed, the library will be initialized but it won't try to connect to any AP yet. When using local multiplayer you should start with this flag.
If WFC_CONNECT is used, this function will initialize the hardware and try to connect to the Access Points stored in the firmware. Wifi_InitDefault() will refuse to initiailize the library if you use this flag at the same time as WIFI_LOCAL_ONLY.
By default, DSWiFi is initialized in a way that both Internet and local multiplayer mode are available. You can decide if Internet mode is available or not by using the defines WIFI_INTERNET_AND_LOCAL and WIFI_LOCAL_ONLY.
The function starts the library in Internet mode if it's available. If it is initialized with WIFI_LOCAL_ONLY it starts in multiplayer client mode. The developer needs to be switch to other modes if required. Remember that there are two local multiplayer modes: client and host.
Check the examples of DSWiFi to see how to connect to an AP in a more manual way that allows your application to do other things while waiting for the function to return.
flags | This is a combination of OR'ed flags. |
bool Wifi_LibraryModeReady | ( | void | ) |
Checks whether a library mode change has finished or not.
Use this function after calling Wifi_MultiplayerHostMode(), Wifi_MultiplayerClientMode() or Wifi_InternetMode() to verify that the library is ready.
void Wifi_SetChannel | ( | int | channel | ) |
If the WiFi system is not connected or connecting to an access point, instruct the chipset to change channel.
The WiFi system must be in "active" mode for this to work as expected. If it is in scanning mode, it will change channel automatically every second or so.
channel | The channel to change to, in the range of 1-13. |
void Wifi_SetPromiscuousMode | ( | int | enable | ) |
Allows the DS to enter or leave a "promsicuous" mode.
In this mode all data that can be received is forwarded to the ARM9 for user processing. Best used with Wifi_RawSetPacketHandler, to allow user code to use the data (well, the lib won't use 'em, so they're just wasting CPU otherwise.)
enable | 0 to disable promiscuous mode, nonzero to engage. |
void Wifi_Timer | ( | int | num_ms | ) |
This function should be called in a periodic interrupt.
It serves as the basis for all updating in the sgIP library, all retransmits, timeouts, and etc are based on this function being called. It's not timing critical but it is rather essential.
num_ms | The number of milliseconds since the last time this function was called. |