skyline/app/src/main/cpp/skyline/kernel/services/serviceman.h
◱ PixelyIon ec71735ece Fixes and Additions for HID support
The following things were fixed:
* KSharedMemory
* KSyncObject (and how waiting on them works)
* Inclusion of Headers
What was added:
* Transfer Memory
* svcSleepThread
2019-10-13 13:34:47 +05:30

63 lines
2.1 KiB
C++

#pragma once
#include <nce.h>
#include <kernel/types/KSession.h>
#include "base_service.h"
namespace skyline::kernel::service {
/**
* @brief The ServiceManager class manages passing IPC requests to the right Service and running event loops of Services
*/
class ServiceManager {
private:
const DeviceState &state; //!< The state of the device
std::unordered_map<Service, std::shared_ptr<BaseService>> serviceMap; //!< A map from it's type to a BaseService object
std::shared_ptr<BaseService> GetService(const Service serviceType);
public:
/**
* @param state The state of the device
*/
ServiceManager(const DeviceState &state);
/**
* @brief Creates a new service and returns it's handle
* @param serviceType The type of the service
* @return Handle to KService object of the service
*/
handle_t NewSession(const Service serviceType);
/**
* @brief Creates a new service and writes it's handle or virtual handle (If it's a domain request) to IpcResponse
* @param serviceType The type of the service
* @param session The session object of the command
* @param response The response object to write the handle or virtual handle to
*/
std::shared_ptr<BaseService> NewService(const Service serviceType, type::KSession &session, ipc::IpcResponse &response);
/**
* @brief Closes an existing session to a service
* @param service The handle of the KService object
*/
void CloseSession(const handle_t handle);
/**
* @brief This is a function where the Services get to run their core event loops
*/
void Loop();
/**
* @brief Handles a Synchronous IPC Request
* @param handle The handle of the object
*/
void SyncRequestHandler(const handle_t handle);
/**
* @brief Duplicates a session
* @param handle The handle of the object
*/
void CloneSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
};
}