parent
e91758984c
commit
3ea2af46a5
5
common/netstatus.h
Normal file
5
common/netstatus.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
|
||||
bool netstatusGetDetails(AssetId *id);
|
||||
|
36
nx_main/nx_netstatus.c
Normal file
36
nx_main/nx_netstatus.c
Normal file
@ -0,0 +1,36 @@
|
||||
#include "../common/common.h"
|
||||
|
||||
bool netstatusGetDetails(AssetId *id) {
|
||||
Result rc=0;
|
||||
NifmInternetConnectionType contype;
|
||||
u32 wifiStrength=0;
|
||||
NifmInternetConnectionStatus connectionStatus;
|
||||
|
||||
rc = nifmGetInternetConnectionStatus(&contype, &wifiStrength, &connectionStatus);
|
||||
if (R_FAILED(rc)) {
|
||||
*id = AssetId_airplane_icon;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (contype == NifmInternetConnectionType_Ethernet) {
|
||||
if (connectionStatus != NifmInternetConnectionStatus_Connected)
|
||||
*id = AssetId_eth_none_icon;
|
||||
else
|
||||
*id = AssetId_eth_icon;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (wifiStrength==0) {
|
||||
*id = AssetId_wifi_none_icon;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (wifiStrength==3)
|
||||
*id = AssetId_wifi3_icon;
|
||||
if (wifiStrength==2)
|
||||
*id = AssetId_wifi2_icon;
|
||||
else
|
||||
*id = AssetId_wifi1_icon;
|
||||
|
||||
return true;
|
||||
}
|
6
pc_main/pc_netstatus.c
Normal file
6
pc_main/pc_netstatus.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "../common/common.h"
|
||||
|
||||
bool netstatusGetDetails(AssetId *id) {
|
||||
*id = AssetId_wifi3_icon;
|
||||
return true;
|
||||
}
|
Loading…
Reference in New Issue
Block a user