mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
nim: add ListSystemUpdateTask/DestroySystemUpdateTask (#390)
This commit is contained in:
parent
5d57c70a3e
commit
75c3d2eca4
@ -82,6 +82,7 @@ extern "C" {
|
||||
#include "switch/services/vi.h"
|
||||
#include "switch/services/nv.h"
|
||||
#include "switch/services/nifm.h"
|
||||
#include "switch/services/nim.h"
|
||||
#include "switch/services/ns.h"
|
||||
#include "switch/services/ldr.h"
|
||||
#include "switch/services/ro.h"
|
||||
|
26
nx/include/switch/services/nim.h
Normal file
26
nx/include/switch/services/nim.h
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @file nim.h
|
||||
* @brief Network Install Manager (nim) service IPC wrapper.
|
||||
* @author SciresM
|
||||
* @copyright libnx Authors
|
||||
*/
|
||||
#pragma once
|
||||
#include "../types.h"
|
||||
#include "../sf/service.h"
|
||||
|
||||
/// SystemUpdateTaskId
|
||||
typedef struct {
|
||||
alignas(8) Uuid uuid; ///< UUID
|
||||
} NimSystemUpdateTaskId;
|
||||
|
||||
/// Initialize nim.
|
||||
Result nimInitialize(void);
|
||||
|
||||
/// Exit nim.
|
||||
void nimExit(void);
|
||||
|
||||
/// Gets the Service object for the actual nim service session.
|
||||
Service* nimGetServiceSession(void);
|
||||
|
||||
Result nimListSystemUpdateTask(s32 *out_count, NimSystemUpdateTaskId *out_task_ids, size_t max_task_ids);
|
||||
Result nimDestroySystemUpdateTask(const NimSystemUpdateTaskId *task_id);
|
36
nx/source/services/nim.c
Normal file
36
nx/source/services/nim.c
Normal file
@ -0,0 +1,36 @@
|
||||
#include <string.h>
|
||||
#include "service_guard.h"
|
||||
#include "services/nim.h"
|
||||
|
||||
#include "runtime/hosversion.h"
|
||||
|
||||
static Service g_nimSrv;
|
||||
|
||||
NX_GENERATE_SERVICE_GUARD(nim);
|
||||
|
||||
Result _nimInitialize(void) {
|
||||
return smGetService(&g_nimSrv, "nim");
|
||||
}
|
||||
|
||||
void _nimCleanup(void) {
|
||||
serviceClose(&g_nimSrv);
|
||||
}
|
||||
|
||||
Service* nimGetServiceSession(void) {
|
||||
return &g_nimSrv;
|
||||
}
|
||||
|
||||
Result nimDestroySystemUpdateTask(const NimSystemUpdateTaskId *task_id) {
|
||||
return serviceDispatchIn(&g_nimSrv, 1, *task_id);
|
||||
}
|
||||
|
||||
Result nimListSystemUpdateTask(s32 *out_count, NimSystemUpdateTaskId *out_task_ids, size_t max_task_ids) {
|
||||
return serviceDispatchOut(&g_nimSrv, 2, *out_count,
|
||||
.buffer_attrs = {
|
||||
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out,
|
||||
},
|
||||
.buffers = {
|
||||
{ out_task_ids, max_task_ids * sizeof(*out_task_ids) },
|
||||
},
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user