Auto Connection (AC) Library

AC

AC (Auto Connection) is the library used to handle the network connection state. According to a particular setting stored on NVRAM, it connects upon request from the application. After connection establishes, AC monitors the connection state; if disconnected, it automatically reconnects.

Out of 6 network profiles, only 1 selected by the user is used. Other profiles will not be used to connect.

You cannot create network settings or modify parameters via AC. You can create/save by tools and menu, such as the System Config Tool. However, only for development usage, is it possible to create network settings via NC debugging APIs.


AC Operations

Initialize/Finalize


To use the AC library APIs, nn::ac::Initialize must be called beforehand. nn::ac::Initialize needs to be called once, but calling it multiple times does not cause an issue. To use the AC library again after nn::ac::Finalize, call nn::ac::Initialize again.

To end processing by the AC library, call nn::ac::Finalize.



Connection

Use nn::ac::Connect or nn::ac::ConnectAsync to connect to the network. After connection establishes, AC polls the connection state periodically; if disconnection is detected, it tries to reconnect automatically.
If connection has been already established for background communication, connection will immediately succeed.

Of connection APIs, nn::ac::Connect is synchronous, and nn::ac::ConnectAsync is asynchronous. nn::ac::Connect does not return until it succeeds or fails to connect. nn::ac::ConnectAsync sends a connection request to AC and then immediately returns .

In case of the asynchronous API, the progress of the connection process can be obtained by nn::ac::GetStatus. This API returns whether the asynchronous API is either being processed, successful, or failed.

If the asynchronous connection process fails, use nn::ac::GetConnectResult to get the processing result; nn::ac::GetLastErrorCode to get the error code. Even in the event of a connection failure, if the result indicates nn::ac::ResultAlreadyExists or nn::ac::ResultInClosing, it should indicate that AC was busy and could not register the task; it does not indicate that the connection process itself has failed. If you insert a wait and then try connecting again, you may succeed.



Settings used for connection


The connection setting used for Connect and ConnectAsync and when reconnecting automatically is called the "default network profile".

Wii U can store 6 sets of connection settings on NVRAM; of which, only 1 selected by the user is used for connection. The selected set is referred to as the 'default network profile'; AC will never reference other profiles for the connection process.



Disconnection


Use nn::ac::Close to disconnect the connection established by nn::ac::Connect or nn::ac::ConnectAsync.

However, if there is another process that has established a connection for background communication, only the state that indicates application connection within AC changes to disconnected; actual disconnection process will not take place.

Existing sockets in the system are aborted when Wii U loses link level connection (e.g. Ethernet cable is unplugged, AP is turned off, etc). An application is required to recreate sockets to reconnect.

During nn::ac::Finalize, change the application connection status to Disconnected.


Address Acquisition


After connection establishes, the following information can be obtained:

nn::ac::GetAssignedAddress( nn::ac::IpAddress *pAddress );
Get the assigned IP address.
nn::ac::GetAssignedPreferedDns( nn::ac::IpAddress *pAddress );
Get the primary DNS address.
nn::ac::GetAssignedAlternativeDns( nn::ac::IpAddress *pAddress );
Get the secondary DNS address.
nn::ac::GetAssignedGateway( nn::ac::IpAddress *pAddress );
Get the gateway address.
nn::ac::GetAssignedSubnet( nn::ac::IpAddress *pAddress );
Get the subnet address.

Revision History

2015/02/24 Added Code tags.
2013/12/04 Removed unused anchors.
2013/11/27 Worked anchors.
2013/05/08 Automated cleanup pass.
2013/01/23 Updates for System Config Tool
2012/09/24 Modified description in Disconnection section and added reference for further information.
2012/08/27 Added about disconnecting a link from AP.
2012/06/06 Initial version.


CONFIDENTIAL