mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
nifm: Added NifmClientId and nifmGetClientId/nifmIsAnyInternetRequestAccepted.
This commit is contained in:
parent
c4ebdb4cd8
commit
9bf745524d
@ -28,6 +28,11 @@ typedef enum {
|
|||||||
NifmInternetConnectionStatus_Connected = 4, ///< Internet is connected.
|
NifmInternetConnectionStatus_Connected = 4, ///< Internet is connected.
|
||||||
} NifmInternetConnectionStatus;
|
} NifmInternetConnectionStatus;
|
||||||
|
|
||||||
|
/// ClientId
|
||||||
|
typedef struct {
|
||||||
|
u32 id; ///< ClientId
|
||||||
|
} NifmClientId;
|
||||||
|
|
||||||
/// Initialize nifm. This is used automatically by gethostid().
|
/// Initialize nifm. This is used automatically by gethostid().
|
||||||
Result nifmInitialize(NifmServiceType service_type);
|
Result nifmInitialize(NifmServiceType service_type);
|
||||||
|
|
||||||
@ -40,6 +45,11 @@ Service* nifmGetServiceSession_StaticService(void);
|
|||||||
/// Gets the Service object for IGeneralService.
|
/// Gets the Service object for IGeneralService.
|
||||||
Service* nifmGetServiceSession_GeneralService(void);
|
Service* nifmGetServiceSession_GeneralService(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GetClientId
|
||||||
|
*/
|
||||||
|
NifmClientId nifmGetClientId(void);
|
||||||
|
|
||||||
Result nifmGetCurrentIpAddress(u32* out);
|
Result nifmGetCurrentIpAddress(u32* out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,6 +66,13 @@ Result nifmIsWirelessCommunicationEnabled(bool* out);
|
|||||||
Result nifmGetInternetConnectionStatus(NifmInternetConnectionType* connectionType, u32* wifiStrength, NifmInternetConnectionStatus* connectionStatus);
|
Result nifmGetInternetConnectionStatus(NifmInternetConnectionType* connectionType, u32* wifiStrength, NifmInternetConnectionStatus* connectionStatus);
|
||||||
|
|
||||||
Result nifmIsEthernetCommunicationEnabled(bool* out);
|
Result nifmIsEthernetCommunicationEnabled(bool* out);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief IsAnyInternetRequestAccepted
|
||||||
|
* @param[in] id \ref NifmClientId
|
||||||
|
*/
|
||||||
|
bool nifmIsAnyInternetRequestAccepted(NifmClientId id);
|
||||||
|
|
||||||
Result nifmIsAnyForegroundRequestAccepted(bool* out);
|
Result nifmIsAnyForegroundRequestAccepted(bool* out);
|
||||||
Result nifmPutToSleep(void);
|
Result nifmPutToSleep(void);
|
||||||
Result nifmWakeUp(void);
|
Result nifmWakeUp(void);
|
||||||
|
@ -105,6 +105,16 @@ static Result _nifmCreateGeneralService(Service* srv_out) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NifmClientId nifmGetClientId(void) {
|
||||||
|
NifmClientId id={0};
|
||||||
|
Result rc = serviceDispatch(&g_nifmIGS, 1,
|
||||||
|
.buffer_attrs = { SfBufferAttr_FixedSize | SfBufferAttr_HipcPointer | SfBufferAttr_Out },
|
||||||
|
.buffers = { { &id, sizeof(id) } },
|
||||||
|
);
|
||||||
|
if (R_FAILED(rc)) id.id = 0;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
Result nifmGetCurrentIpAddress(u32* out) {
|
Result nifmGetCurrentIpAddress(u32* out) {
|
||||||
return _nifmCmdNoInOutU32(&g_nifmIGS, out, 12);
|
return _nifmCmdNoInOutU32(&g_nifmIGS, out, 12);
|
||||||
}
|
}
|
||||||
@ -141,6 +151,15 @@ Result nifmIsEthernetCommunicationEnabled(bool* out) {
|
|||||||
return _nifmCmdNoInOutBool(&g_nifmIGS, out, 20);
|
return _nifmCmdNoInOutBool(&g_nifmIGS, out, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool nifmIsAnyInternetRequestAccepted(NifmClientId id) {
|
||||||
|
u8 tmp=0;
|
||||||
|
Result rc = serviceDispatchOut(&g_nifmIGS, 21, tmp,
|
||||||
|
.buffer_attrs = { SfBufferAttr_FixedSize | SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
|
.buffers = { { &id, sizeof(id) } },
|
||||||
|
);
|
||||||
|
return R_SUCCEEDED(rc) ? tmp & 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
Result nifmIsAnyForegroundRequestAccepted(bool* out) {
|
Result nifmIsAnyForegroundRequestAccepted(bool* out) {
|
||||||
return _nifmCmdNoInOutBool(&g_nifmIGS, out, 22);
|
return _nifmCmdNoInOutBool(&g_nifmIGS, out, 22);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user