diff options
| author | 2018-11-26 18:34:07 -0500 | |
|---|---|---|
| committer | 2018-11-29 08:45:41 -0500 | |
| commit | ff610103b58b3e0dd39fafb539a1cc0bc0fae577 (patch) | |
| tree | cbd54b09f9270f6f1d92a2f45a5ccdb307569093 /src/core/hle/service/btm | |
| parent | hle_ipc: Use event pair for SleepClientThread (diff) | |
| download | yuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.tar.gz yuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.tar.xz yuzu-ff610103b58b3e0dd39fafb539a1cc0bc0fae577.zip | |
core: Port all current usages of Event to Readable/WritableEvent
Diffstat (limited to 'src/core/hle/service/btm')
| -rw-r--r-- | src/core/hle/service/btm/btm.cpp | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index 463a79351..3ee298161 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp | |||
| @@ -6,8 +6,10 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/hle/ipc_helpers.h" | 8 | #include "core/hle/ipc_helpers.h" |
| 9 | #include "core/hle/kernel/event.h" | ||
| 10 | #include "core/hle/kernel/hle_ipc.h" | 9 | #include "core/hle/kernel/hle_ipc.h" |
| 10 | #include "core/hle/kernel/kernel.h" | ||
| 11 | #include "core/hle/kernel/readable_event.h" | ||
| 12 | #include "core/hle/kernel/writable_event.h" | ||
| 11 | #include "core/hle/service/btm/btm.h" | 13 | #include "core/hle/service/btm/btm.h" |
| 12 | #include "core/hle/service/service.h" | 14 | #include "core/hle/service/service.h" |
| 13 | 15 | ||
| @@ -53,53 +55,64 @@ public: | |||
| 53 | }; | 55 | }; |
| 54 | // clang-format on | 56 | // clang-format on |
| 55 | RegisterHandlers(functions); | 57 | RegisterHandlers(functions); |
| 58 | |||
| 59 | auto& kernel = Core::System::GetInstance().Kernel(); | ||
| 60 | scan_event = Kernel::WritableEvent::CreateRegisteredEventPair( | ||
| 61 | kernel, Kernel::ResetType::OneShot, "IBtmUserCore:ScanEvent"); | ||
| 62 | connection_event = Kernel::WritableEvent::CreateRegisteredEventPair( | ||
| 63 | kernel, Kernel::ResetType::OneShot, "IBtmUserCore:ConnectionEvent"); | ||
| 64 | service_discovery = Kernel::WritableEvent::CreateRegisteredEventPair( | ||
| 65 | kernel, Kernel::ResetType::OneShot, "IBtmUserCore:Discovery"); | ||
| 66 | config_event = Kernel::WritableEvent::CreateRegisteredEventPair( | ||
| 67 | kernel, Kernel::ResetType::OneShot, "IBtmUserCore:ConfigEvent"); | ||
| 56 | } | 68 | } |
| 57 | 69 | ||
| 58 | private: | 70 | private: |
| 59 | void GetScanEvent(Kernel::HLERequestContext& ctx) { | 71 | void GetScanEvent(Kernel::HLERequestContext& ctx) { |
| 60 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | 72 | LOG_WARNING(Service_BTM, "(STUBBED) called"); |
| 61 | 73 | ||
| 62 | auto& kernel = Core::System::GetInstance().Kernel(); | ||
| 63 | scan_event = | ||
| 64 | Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, "IBtmUserCore:ScanEvent"); | ||
| 65 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 74 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 66 | rb.Push(RESULT_SUCCESS); | 75 | rb.Push(RESULT_SUCCESS); |
| 67 | rb.PushCopyObjects(scan_event); | 76 | |
| 77 | const auto& event{ | ||
| 78 | Core::System::GetInstance().Kernel().FindNamedEvent("IBtmUserCore:ScanEvent")}; | ||
| 79 | rb.PushCopyObjects(event->second); | ||
| 68 | } | 80 | } |
| 69 | void GetConnectionEvent(Kernel::HLERequestContext& ctx) { | 81 | void GetConnectionEvent(Kernel::HLERequestContext& ctx) { |
| 70 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | 82 | LOG_WARNING(Service_BTM, "(STUBBED) called"); |
| 71 | 83 | ||
| 72 | auto& kernel = Core::System::GetInstance().Kernel(); | ||
| 73 | connection_event = Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, | ||
| 74 | "IBtmUserCore:ConnectionEvent"); | ||
| 75 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 84 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 76 | rb.Push(RESULT_SUCCESS); | 85 | rb.Push(RESULT_SUCCESS); |
| 77 | rb.PushCopyObjects(connection_event); | 86 | |
| 87 | const auto& event{ | ||
| 88 | Core::System::GetInstance().Kernel().FindNamedEvent("IBtmUserCore:ConnectionEvent")}; | ||
| 89 | rb.PushCopyObjects(event->second); | ||
| 78 | } | 90 | } |
| 79 | void GetDiscoveryEvent(Kernel::HLERequestContext& ctx) { | 91 | void GetDiscoveryEvent(Kernel::HLERequestContext& ctx) { |
| 80 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | 92 | LOG_WARNING(Service_BTM, "(STUBBED) called"); |
| 81 | 93 | ||
| 82 | auto& kernel = Core::System::GetInstance().Kernel(); | ||
| 83 | service_discovery = | ||
| 84 | Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, "IBtmUserCore:Discovery"); | ||
| 85 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 94 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 86 | rb.Push(RESULT_SUCCESS); | 95 | rb.Push(RESULT_SUCCESS); |
| 87 | rb.PushCopyObjects(service_discovery); | 96 | |
| 97 | const auto& event{ | ||
| 98 | Core::System::GetInstance().Kernel().FindNamedEvent("IBtmUserCore:Discovery")}; | ||
| 99 | rb.PushCopyObjects(event->second); | ||
| 88 | } | 100 | } |
| 89 | void GetConfigEvent(Kernel::HLERequestContext& ctx) { | 101 | void GetConfigEvent(Kernel::HLERequestContext& ctx) { |
| 90 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | 102 | LOG_WARNING(Service_BTM, "(STUBBED) called"); |
| 91 | 103 | ||
| 92 | auto& kernel = Core::System::GetInstance().Kernel(); | ||
| 93 | config_event = | ||
| 94 | Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, "IBtmUserCore:ConfigEvent"); | ||
| 95 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 104 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 96 | rb.Push(RESULT_SUCCESS); | 105 | rb.Push(RESULT_SUCCESS); |
| 97 | rb.PushCopyObjects(config_event); | 106 | |
| 107 | const auto& event{ | ||
| 108 | Core::System::GetInstance().Kernel().FindNamedEvent("IBtmUserCore:ConfigEvent")}; | ||
| 109 | rb.PushCopyObjects(event->second); | ||
| 98 | } | 110 | } |
| 99 | Kernel::SharedPtr<Kernel::Event> scan_event; | 111 | |
| 100 | Kernel::SharedPtr<Kernel::Event> connection_event; | 112 | Kernel::SharedPtr<Kernel::WritableEvent> scan_event; |
| 101 | Kernel::SharedPtr<Kernel::Event> service_discovery; | 113 | Kernel::SharedPtr<Kernel::WritableEvent> connection_event; |
| 102 | Kernel::SharedPtr<Kernel::Event> config_event; | 114 | Kernel::SharedPtr<Kernel::WritableEvent> service_discovery; |
| 115 | Kernel::SharedPtr<Kernel::WritableEvent> config_event; | ||
| 103 | }; | 116 | }; |
| 104 | 117 | ||
| 105 | class BTM_USR final : public ServiceFramework<BTM_USR> { | 118 | class BTM_USR final : public ServiceFramework<BTM_USR> { |