Add ACU_Proxy* functions as welll as error code functions
This commit is contained in:
parent
a087e33414
commit
8840ebf813
@ -4,6 +4,18 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/// Wifi security modes.
|
||||
typedef enum {
|
||||
AC_OPEN = 0, ///< Open authentication.
|
||||
AC_WEP_40BIT = 1, ///< WEP 40-bit authentication.
|
||||
AC_WEP_104BIT = 2, ///< WEP 104-bit authentication.
|
||||
AC_WEP_128BIT = 3, ///< WEP 128-bit authentication.
|
||||
AC_WPA_TKIP = 4, ///< WPA TKIP authentication.
|
||||
AC_WPA2_TKIP = 5, ///< WPA2 TKIP authentication.
|
||||
AC_WPA_AES = 6, ///< WPA AES authentication.
|
||||
AC_WPA2_AES = 7, ///< WPA2 AES authentication.
|
||||
} acSecurityMode;
|
||||
|
||||
/// Initializes AC.
|
||||
Result acInit(void);
|
||||
|
||||
@ -14,25 +26,67 @@ void acExit(void);
|
||||
Result acWaitInternetConnection(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current Wifi status.
|
||||
* @param out Pointer to output the current Wifi status to. (0 = not connected, 1 = O3DS Internet, 2 = N3DS Internet)
|
||||
* @brief Gets the connected Wifi status.
|
||||
* @param out Pointer to output the connected Wifi status to. (0 = not connected, 1 = O3DS Internet, 2 = N3DS Internet)
|
||||
*/
|
||||
Result ACU_GetWifiStatus(u32 *out);
|
||||
|
||||
/**
|
||||
* @brief Gets the current Wifi status.
|
||||
* @param out Pointer to output the current Wifi status to. (1 = not connected, 3 = connected)
|
||||
* @brief Gets the connected Wifi status.
|
||||
* @param out Pointer to output the connected Wifi status to. (1 = not connected, 3 = connected)
|
||||
*/
|
||||
Result ACU_GetStatus(u32 *out);
|
||||
|
||||
/**
|
||||
* @brief Gets the current Wifi security mode.
|
||||
* @param out Pointer to output the current Wifi security mode to. (0 = Open Authentication, 1 = WEP 40-bit, 2 = WEP 104-bit, 3 = WEP 128-bit, 4 = WPA TKIP, 5 = WPA2 TKIP, 6 = WPA AES, 7 = WPA2 AES)
|
||||
* @brief Gets the connected Wifi security mode.
|
||||
* @param mode Pointer to output the connected Wifi security mode to. (0 = Open Authentication, 1 = WEP 40-bit, 2 = WEP 104-bit, 3 = WEP 128-bit, 4 = WPA TKIP, 5 = WPA2 TKIP, 6 = WPA AES, 7 = WPA2 AES)
|
||||
*/
|
||||
Result ACU_GetSecurityMode(u32 *out);
|
||||
Result ACU_GetSecurityMode(acSecurityMode *mode);
|
||||
|
||||
/**
|
||||
* @brief Gets the current Wifi SSID length.
|
||||
* @param out Pointer to output the current Wifi SSID length to.
|
||||
* @brief Gets the connected Wifi SSID.
|
||||
* @param SSID Pointer to output the connected Wifi SSID to.
|
||||
*/
|
||||
Result ACU_GetSSID(char *SSID);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected Wifi SSID length.
|
||||
* @param out Pointer to output the connected Wifi SSID length to.
|
||||
*/
|
||||
Result ACU_GetSSIDLength(u32 *out);
|
||||
|
||||
/**
|
||||
* @brief Determines whether proxy is enabled for the connected network.
|
||||
* @param enable Pointer to output the proxy status to.
|
||||
*/
|
||||
Result ACU_GetProxyEnable(bool *enable);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected network's proxy port.
|
||||
* @param out Pointer to output the proxy port to.
|
||||
*/
|
||||
Result ACU_GetProxyPort(u32 *out);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected network's proxy username.
|
||||
* @param username Pointer to output the proxy username to. (The size must be at least 0x20-bytes)
|
||||
*/
|
||||
Result ACU_GetProxyUserName(char *username);
|
||||
|
||||
/**
|
||||
* @brief Gets the connected network's proxy password.
|
||||
* @param password Pointer to output the proxy password to. (The size must be at least 0x20-bytes)
|
||||
*/
|
||||
Result ACU_GetProxyPassword(char *password);
|
||||
|
||||
/**
|
||||
* @brief Gets the last error to occur during a connection.
|
||||
* @param errorCode Pointer to output the error code to.
|
||||
*/
|
||||
Result ACU_GetLastErrorCode(u32* errorCode);
|
||||
|
||||
/**
|
||||
* @brief Gets the last detailed error to occur during a connection.
|
||||
* @param errorCode Pointer to output the error code to.
|
||||
*/
|
||||
Result ACU_GetLastDetailErrorCode(u32* errorCode);
|
||||
|
@ -42,7 +42,7 @@ Result ACU_GetWifiStatus(u32 *out)
|
||||
Result ret=0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0xD,0,0); // 0x000D0000
|
||||
cmdbuf[0] = IPC_MakeHeader(0xD,0,0); // 0xD0000
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
@ -56,7 +56,7 @@ Result ACU_GetStatus(u32 *out)
|
||||
Result ret=0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0xC,0,0); // 0x000C0000
|
||||
cmdbuf[0] = IPC_MakeHeader(0xC,0,0); // 0xC0000
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
@ -65,16 +65,32 @@ Result ACU_GetStatus(u32 *out)
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result ACU_GetSecurityMode(u32 *out)
|
||||
Result ACU_GetSecurityMode(acSecurityMode *mode)
|
||||
{
|
||||
Result ret=0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0x33,0,0); // 0x00330000
|
||||
cmdbuf[0] = IPC_MakeHeader(0x33,0,0); // 0x330000
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
*out = cmdbuf[2];
|
||||
*mode = cmdbuf[2];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result ACU_GetSSID(char *SSID)
|
||||
{
|
||||
Result ret=0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
u32 *staticbufs = getThreadStaticBuffers();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0x34,0,0); // 0x340000
|
||||
|
||||
staticbufs[0] = IPC_Desc_StaticBuffer(0x20, 0);
|
||||
staticbufs[1] = (u32)SSID;
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
@ -84,7 +100,7 @@ Result ACU_GetSSIDLength(u32 *out)
|
||||
Result ret=0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0x35,0,0); // 0x00350000
|
||||
cmdbuf[0] = IPC_MakeHeader(0x35,0,0); // 0x350000
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
@ -92,3 +108,91 @@ Result ACU_GetSSIDLength(u32 *out)
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result ACU_GetProxyEnable(bool *enable)
|
||||
{
|
||||
Result ret=0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0x36,0,0); // 0x360000
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
*enable = cmdbuf[2] & 0xFF;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result ACU_GetProxyPort(u32 *out)
|
||||
{
|
||||
Result ret=0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0x38,0,0); // 0x380000
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
*out = cmdbuf[2];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result ACU_GetProxyUserName(char *username)
|
||||
{
|
||||
Result ret=0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
u32 *staticbufs = getThreadStaticBuffers();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0x3A,0,0); // 0x3A0000
|
||||
|
||||
staticbufs[0] = IPC_Desc_StaticBuffer(0x20, 0);
|
||||
staticbufs[1] = (u32)username;
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result ACU_GetProxyPassword(char *password)
|
||||
{
|
||||
Result ret=0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
u32 *staticbufs = getThreadStaticBuffers();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0x3B,0,0); // 0x3B0000
|
||||
|
||||
staticbufs[0] = IPC_Desc_StaticBuffer(0x20, 0);
|
||||
staticbufs[1] = (u32)password;
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result ACU_GetLastErrorCode(u32* errorCode)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0xA,0,0); // 0xA0000
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
if(errorCode) *errorCode = cmdbuf[2];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result ACU_GetLastDetailErrorCode(u32* errorCode)
|
||||
{
|
||||
Result ret = 0;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0xB,0,0); // 0xB0000
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(acHandle)))return ret;
|
||||
|
||||
if(errorCode) *errorCode = cmdbuf[2];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user