diff options
Diffstat (limited to 'src/core/hle/service/btm/btm.cpp')
-rw-r--r-- | src/core/hle/service/btm/btm.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index d1ebc2388..403296650 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp @@ -18,7 +18,10 @@ namespace Service::BTM { class IBtmUserCore final : public ServiceFramework<IBtmUserCore> { public: - explicit IBtmUserCore(Core::System& system_) : ServiceFramework{system_, "IBtmUserCore"} { + explicit IBtmUserCore(Core::System& system_) + : ServiceFramework{system_, "IBtmUserCore"}, scan_event{system.Kernel()}, + connection_event{system.Kernel()}, service_discovery{system.Kernel()}, + config_event{system.Kernel()} { // clang-format off static const FunctionInfo functions[] = { {0, &IBtmUserCore::AcquireBleScanEvent, "AcquireBleScanEvent"}, @@ -57,15 +60,10 @@ public: // clang-format on RegisterHandlers(functions); - auto& kernel = system.Kernel(); - scan_event = Kernel::KEvent::Create(kernel, "IBtmUserCore:ScanEvent"); - scan_event->Initialize(); - connection_event = Kernel::KEvent::Create(kernel, "IBtmUserCore:ConnectionEvent"); - connection_event->Initialize(); - service_discovery = Kernel::KEvent::Create(kernel, "IBtmUserCore:Discovery"); - service_discovery->Initialize(); - config_event = Kernel::KEvent::Create(kernel, "IBtmUserCore:ConfigEvent"); - config_event->Initialize(); + scan_event.Initialize("IBtmUserCore:ScanEvent"); + connection_event.Initialize("IBtmUserCore:ConnectionEvent"); + service_discovery.Initialize("IBtmUserCore:Discovery"); + config_event.Initialize("IBtmUserCore:ConfigEvent"); } private: @@ -74,7 +72,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(scan_event->GetReadableEvent()); + rb.PushCopyObjects(scan_event.GetReadableEvent()); } void AcquireBleConnectionEvent(Kernel::HLERequestContext& ctx) { @@ -82,7 +80,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(connection_event->GetReadableEvent()); + rb.PushCopyObjects(connection_event.GetReadableEvent()); } void AcquireBleServiceDiscoveryEvent(Kernel::HLERequestContext& ctx) { @@ -90,7 +88,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(service_discovery->GetReadableEvent()); + rb.PushCopyObjects(service_discovery.GetReadableEvent()); } void AcquireBleMtuConfigEvent(Kernel::HLERequestContext& ctx) { @@ -98,13 +96,13 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(config_event->GetReadableEvent()); + rb.PushCopyObjects(config_event.GetReadableEvent()); } - std::shared_ptr<Kernel::KEvent> scan_event; - std::shared_ptr<Kernel::KEvent> connection_event; - std::shared_ptr<Kernel::KEvent> service_discovery; - std::shared_ptr<Kernel::KEvent> config_event; + Kernel::KEvent scan_event; + Kernel::KEvent connection_event; + Kernel::KEvent service_discovery; + Kernel::KEvent config_event; }; class BTM_USR final : public ServiceFramework<BTM_USR> { |