1 // Copyright 2014 Citra Emulator Project 2 // Licensed under GPLv2 or any later version 3 // Refer to the license.txt file included. 4 5 #pragma once 6 7 #include <memory> 8 #include <unordered_map> 9 #include <boost/serialization/export.hpp> 10 #include "core/hle/service/service.h" 11 12 namespace Core { 13 class System; 14 } 15 16 namespace Kernel { 17 class HLERequestContext; 18 class Semaphore; 19 } // namespace Kernel 20 21 namespace Service::SM { 22 23 /// Interface to "srv:" service 24 class SRV final : public ServiceFramework<SRV> { 25 public: 26 explicit SRV(Core::System& system); 27 ~SRV(); 28 29 class ThreadCallback; 30 31 private: 32 void RegisterClient(Kernel::HLERequestContext& ctx); 33 void EnableNotification(Kernel::HLERequestContext& ctx); 34 void GetServiceHandle(Kernel::HLERequestContext& ctx); 35 void Subscribe(Kernel::HLERequestContext& ctx); 36 void Unsubscribe(Kernel::HLERequestContext& ctx); 37 void PublishToSubscriber(Kernel::HLERequestContext& ctx); 38 void RegisterService(Kernel::HLERequestContext& ctx); 39 40 Core::System& system; 41 std::shared_ptr<Kernel::Semaphore> notification_semaphore; 42 std::unordered_map<std::string, std::shared_ptr<Kernel::Event>> get_service_handle_delayed_map; 43 44 template <class Archive> 45 void serialize(Archive& ar, const unsigned int); 46 friend class boost::serialization::access; 47 }; 48 49 } // namespace Service::SM 50 51 SERVICE_CONSTRUCT(Service::SM::SRV) 52 BOOST_CLASS_EXPORT_KEY(Service::SM::SRV) 53 BOOST_CLASS_EXPORT_KEY(Service::SM::SRV::ThreadCallback) 54