Stub INotificationService

This commit is contained in:
Billy Laws 2020-08-09 14:54:45 +01:00 committed by ◱ PixelyIon
parent 9d90cd877c
commit cf60869fac
3 changed files with 47 additions and 0 deletions

View File

@ -77,6 +77,7 @@ namespace skyline::service {
account_IProfile,
friends_IServiceCreator,
friends_IFriendService,
friends_INotificationService,
nfp_IUserManager,
nfp_IUser,
nifm_IStaticService,
@ -84,6 +85,7 @@ namespace skyline::service {
nifm_IRequest,
socket_IClient,
ssl_ISslService,
ssl_ISslContext,
prepo_IPrepoService
};
@ -164,6 +166,7 @@ namespace skyline::service {
state.logger->Warn("Cannot find function in service '{0}' (Type: {1}): 0x{2:X} ({2})", serviceName, serviceType, static_cast<u32>(request.payload->value));
return;
}
try {
function(session, request, response);
} catch (std::exception &e) {

View File

@ -0,0 +1,18 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include <kernel/types/KProcess.h>
#include "INotificationService.h"
namespace skyline::service::friends {
INotificationService::INotificationService(const DeviceState &state, ServiceManager &manager) : notificationEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, Service::friends_INotificationService, "friends:INotificationService", {
{0x0, SFUNC(INotificationService::GetEvent)},
}) {}
void INotificationService::GetEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
KHandle handle = state.process->InsertItem(notificationEvent);
state.logger->Debug("Friend Notification Event Handle: 0x{:X}", handle);
response.copyHandles.push_back(handle);
}
}

View File

@ -0,0 +1,26 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include <kernel/types/KEvent.h>
#include <services/base_service.h>
#include <services/serviceman.h>
namespace skyline::service::friends {
/**
* @brief INotificationService is used by applications to receive notifications (https://switchbrew.org/wiki/Friend_services#INotificationService)
*/
class INotificationService : public BaseService {
private:
std::shared_ptr<kernel::type::KEvent> notificationEvent; //!< This KEvent is triggered on new notifications
public:
INotificationService(const DeviceState &state, ServiceManager &manager);
/**
* @brief This returns a handle to the notification event
*/
void GetEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
};
}