mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-05 02:52:13 +02:00
Merge 2b7f3e67f2
into 93dabfab3f
This commit is contained in:
commit
b25b8dac5d
@ -12,7 +12,18 @@
|
||||
|
||||
#include "../services/sm.h"
|
||||
|
||||
/// nifm internet connection status.
|
||||
typedef struct NifmInternetConnectionStatus NifmInternetConnectionStatus;
|
||||
|
||||
struct NifmInternetConnectionStatus
|
||||
{
|
||||
bool wirelessCommunicationEnabled;
|
||||
bool ethernetCommunicationEnabled;
|
||||
};
|
||||
|
||||
|
||||
Result nifmInitialize(void);
|
||||
void nifmExit(void);
|
||||
|
||||
Result nifmGetCurrentIpAddress(u32* out);
|
||||
Result nifmGetInternetConnectionStatus(NifmInternetConnectionStatus* out);
|
||||
|
@ -77,6 +77,40 @@ Result nifmGetCurrentIpAddress(u32* out) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result nifmGetInternetConnectionStatus(NifmInternetConnectionStatus* out) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
} * raw;
|
||||
|
||||
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 18;
|
||||
|
||||
Result rc = serviceIpcDispatch(&g_nifmIGS);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
ipcParse(&r);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
u32 out;
|
||||
}* resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
out->wirelessCommunicationEnabled = resp->out & 1;
|
||||
out->ethernetCommunicationEnabled = (resp->out >> 1) & 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _nifmCreateGeneralService(Service* out, u64 in) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
Loading…
Reference in New Issue
Block a user