libwutsocket: Change ACConnect() to ACConnectAsync(), Add ACClose()

This commit is contained in:
Maschell 2021-04-27 13:16:31 +02:00 committed by fincs
parent f78363be81
commit 912a373b12
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
3 changed files with 55 additions and 2 deletions

View File

@ -44,7 +44,8 @@ void
ACFinalize(); ACFinalize();
/** /**
* Connects to a network, using the default configuration * Connects synchronically to a network, using the default configuration
* May be blocking until the console successfully connects or has an timeout.
* *
* \return * \return
* A \link nn_result Result\endlink - see \link NNResult_IsSuccess \endlink * A \link nn_result Result\endlink - see \link NNResult_IsSuccess \endlink
@ -53,6 +54,29 @@ ACFinalize();
NNResult NNResult
ACConnect(); ACConnect();
/**
* Connects asynchronically to a network, using the default configuration
*
* \return
* A \link nn_result Result\endlink - see \link NNResult_IsSuccess \endlink
* and \link NNResult_IsFailure \endlink.
*/
NNResult
ACConnectAsync();
/**
* Closes connections made with ACConnect. Use GetCloseStatus to get the status.
*
* \return
* A \link nn_result Result\endlink - see \link NNResult_IsSuccess \endlink
* and \link NNResult_IsFailure \endlink.
*/
NNResult
ACClose();
NNResult
ACGetCloseStatus();
/** /**
* Checks whether the console is currently connected to a network. * Checks whether the console is currently connected to a network.
* *

View File

@ -38,6 +38,10 @@ extern "C"
nn::Result Initialize__Q2_2nn2acFv(); nn::Result Initialize__Q2_2nn2acFv();
void Finalize__Q2_2nn2acFv(); void Finalize__Q2_2nn2acFv();
nn::Result Connect__Q2_2nn2acFv();
nn::Result ConnectAsync__Q2_2nn2acFv();
nn::Result Close__Q2_2nn2acFv();
nn::Result GetCloseStatus__Q2_2nn2acFPQ3_2nn2ac6Status();
nn::Result GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum(ConfigIdNum *id); nn::Result GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum(ConfigIdNum *id);
nn::Result Connect__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum(ConfigIdNum id); nn::Result Connect__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum(ConfigIdNum id);
nn::Result GetAssignedAddress__Q2_2nn2acFPUl(uint32_t *ip); nn::Result GetAssignedAddress__Q2_2nn2acFPUl(uint32_t *ip);
@ -94,6 +98,30 @@ GetStartupId(ConfigIdNum *id)
return detail::GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum(id); return detail::GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum(id);
} }
static inline nn::Result
Connect()
{
return detail::Connect__Q2_2nn2acFv();
}
static inline nn::Result
ConnectAsync()
{
return detail::ConnectAsync__Q2_2nn2acFv();
}
static inline nn::Result
Close()
{
return detail::Close__Q2_2nn2acFv();
}
static inline nn::Result
GetCloseStatus()
{
return detail::GetCloseStatus__Q2_2nn2acFPQ3_2nn2ac6Status();
}
/** /**
* Connects to a network, using the configuration represented by the given * Connects to a network, using the configuration represented by the given
* \link ConfigIdNum \endlink. * \link ConfigIdNum \endlink.

View File

@ -104,12 +104,13 @@ __init_wut_socket()
{ {
socket_lib_init(); socket_lib_init();
ACInitialize(); ACInitialize();
ACConnect(); ACConnectAsync();
} }
void __attribute__((weak)) void __attribute__((weak))
__fini_wut_socket() __fini_wut_socket()
{ {
ACClose();
ACFinalize(); ACFinalize();
socket_lib_finish(); socket_lib_finish();
} }