ac: add SSID-related ac:i functions
ACI_LoadNetworkSetting and ACI_GetNetworkWirelessEssidSecuritySsid, plus acGetSessionHandle.
This commit is contained in:
parent
0f098853f2
commit
5b2a9f6136
@ -27,6 +27,9 @@ Result acInit(void);
|
|||||||
/// Exits AC.
|
/// Exits AC.
|
||||||
void acExit(void);
|
void acExit(void);
|
||||||
|
|
||||||
|
/// Gets the current AC session handle.
|
||||||
|
Handle *acGetSessionHandle(void);
|
||||||
|
|
||||||
/// Waits for the system to connect to the internet.
|
/// Waits for the system to connect to the internet.
|
||||||
Result acWaitInternetConnection(void);
|
Result acWaitInternetConnection(void);
|
||||||
|
|
||||||
@ -128,3 +131,15 @@ Result ACU_SetRequestEulaVersion(acuConfig* config);
|
|||||||
* @param connectionHandle Handle created with svcCreateEvent to wait on until the connection succeeds or fails.
|
* @param connectionHandle Handle created with svcCreateEvent to wait on until the connection succeeds or fails.
|
||||||
*/
|
*/
|
||||||
Result ACU_ConnectAsync(const acuConfig* config, Handle connectionHandle);
|
Result ACU_ConnectAsync(const acuConfig* config, Handle connectionHandle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Selects the WiFi configuration slot for further ac:i operations.
|
||||||
|
* @param slot WiFi slot (0, 1 or 2).
|
||||||
|
*/
|
||||||
|
Result ACI_LoadNetworkSetting(u32 slot);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fetches the SSID of the previously selected WiFi configuration slot.
|
||||||
|
* @param[out] ssid Pointer to the output buffer of size 32B the SSID will be stored in.
|
||||||
|
*/
|
||||||
|
Result ACI_GetNetworkWirelessEssidSecuritySsid(void *ssid);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <3ds/synchronization.h>
|
#include <3ds/synchronization.h>
|
||||||
#include <3ds/services/ac.h>
|
#include <3ds/services/ac.h>
|
||||||
#include <3ds/ipc.h>
|
#include <3ds/ipc.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static Handle acHandle;
|
static Handle acHandle;
|
||||||
static int acRefCount;
|
static int acRefCount;
|
||||||
@ -30,6 +31,11 @@ void acExit(void)
|
|||||||
svcCloseHandle(acHandle);
|
svcCloseHandle(acHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handle *acGetSessionHandle(void)
|
||||||
|
{
|
||||||
|
return &acHandle;
|
||||||
|
}
|
||||||
|
|
||||||
Result acWaitInternetConnection(void)
|
Result acWaitInternetConnection(void)
|
||||||
{
|
{
|
||||||
Result ret = 0;
|
Result ret = 0;
|
||||||
@ -284,3 +290,36 @@ Result ACU_GetProxyUserName(char *username)
|
|||||||
|
|
||||||
return (Result)cmdbuf[1];
|
return (Result)cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result ACI_LoadNetworkSetting(u32 slot)
|
||||||
|
{
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x401,1,0); // 0x04010040
|
||||||
|
cmdbuf[1] = slot;
|
||||||
|
|
||||||
|
Result ret = 0;
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(acHandle))) return ret;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ACI_GetNetworkWirelessEssidSecuritySsid(void *ssid)
|
||||||
|
{
|
||||||
|
u32* cmdbuf = getThreadCommandBuffer();
|
||||||
|
u32* staticbufs = getThreadStaticBuffers();
|
||||||
|
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x40F,0,0); // 0x040F0000
|
||||||
|
|
||||||
|
u32 staticbufBackup[2];
|
||||||
|
memcpy(staticbufBackup, staticbufs, 8);
|
||||||
|
|
||||||
|
staticbufs[0] = IPC_Desc_StaticBuffer(0x20, 0); // at most 32 bytes
|
||||||
|
staticbufs[1] = (u32)ssid;
|
||||||
|
|
||||||
|
Result ret = svcSendSyncRequest(acHandle);
|
||||||
|
|
||||||
|
memcpy(staticbufs, staticbufBackup, 8);
|
||||||
|
|
||||||
|
return R_SUCCEEDED(ret) ? (Result)cmdbuf[1] : ret;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user