diff options
| author | 2024-02-19 14:49:42 -0500 | |
|---|---|---|
| committer | 2024-02-19 14:49:42 -0500 | |
| commit | 8d5473e67c202768673d4d9f3e59df50501f30e4 (patch) | |
| tree | 2c6ba25f4778db3ff9e60f5c84abcb98a15b751b /src | |
| parent | android: Fix overlay visibility reset (#13083) (diff) | |
| parent | service: btm: Implement function needed by QLaunch (diff) | |
| download | yuzu-8d5473e67c202768673d4d9f3e59df50501f30e4.tar.gz yuzu-8d5473e67c202768673d4d9f3e59df50501f30e4.tar.xz yuzu-8d5473e67c202768673d4d9f3e59df50501f30e4.zip | |
Merge pull request #13031 from german77/btm-interfcae
service: btm: Migrate service to new IPC
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm.cpp | 272 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_debug.cpp | 33 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_debug.h | 21 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_system.cpp | 31 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_system.h | 25 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_system_core.cpp | 127 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_system_core.h | 60 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_user.cpp | 30 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_user.h | 25 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_user_core.cpp | 103 | ||||
| -rw-r--r-- | src/core/hle/service/btm/btm_user_core.h | 47 |
13 files changed, 521 insertions, 267 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 23f717472..f67a12f8f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -543,6 +543,16 @@ add_library(core STATIC | |||
| 543 | hle/service/btdrv/btdrv.h | 543 | hle/service/btdrv/btdrv.h |
| 544 | hle/service/btm/btm.cpp | 544 | hle/service/btm/btm.cpp |
| 545 | hle/service/btm/btm.h | 545 | hle/service/btm/btm.h |
| 546 | hle/service/btm/btm_debug.cpp | ||
| 547 | hle/service/btm/btm_debug.h | ||
| 548 | hle/service/btm/btm_system.cpp | ||
| 549 | hle/service/btm/btm_system.h | ||
| 550 | hle/service/btm/btm_system_core.cpp | ||
| 551 | hle/service/btm/btm_system_core.h | ||
| 552 | hle/service/btm/btm_user.cpp | ||
| 553 | hle/service/btm/btm_user.h | ||
| 554 | hle/service/btm/btm_user_core.cpp | ||
| 555 | hle/service/btm/btm_user_core.h | ||
| 546 | hle/service/caps/caps.cpp | 556 | hle/service/caps/caps.cpp |
| 547 | hle/service/caps/caps.h | 557 | hle/service/caps/caps.h |
| 548 | hle/service/caps/caps_a.cpp | 558 | hle/service/caps/caps_a.cpp |
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index 2dc23e674..d120dade8 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp | |||
| @@ -3,141 +3,18 @@ | |||
| 3 | 3 | ||
| 4 | #include <memory> | 4 | #include <memory> |
| 5 | 5 | ||
| 6 | #include "common/logging/log.h" | ||
| 7 | #include "core/core.h" | ||
| 8 | #include "core/hle/kernel/k_event.h" | ||
| 9 | #include "core/hle/service/btm/btm.h" | 6 | #include "core/hle/service/btm/btm.h" |
| 10 | #include "core/hle/service/ipc_helpers.h" | 7 | #include "core/hle/service/btm/btm_debug.h" |
| 11 | #include "core/hle/service/kernel_helpers.h" | 8 | #include "core/hle/service/btm/btm_system.h" |
| 9 | #include "core/hle/service/btm/btm_user.h" | ||
| 12 | #include "core/hle/service/server_manager.h" | 10 | #include "core/hle/service/server_manager.h" |
| 13 | #include "core/hle/service/service.h" | 11 | #include "core/hle/service/service.h" |
| 14 | 12 | ||
| 15 | namespace Service::BTM { | 13 | namespace Service::BTM { |
| 16 | 14 | ||
| 17 | class IBtmUserCore final : public ServiceFramework<IBtmUserCore> { | 15 | class IBtm final : public ServiceFramework<IBtm> { |
| 18 | public: | 16 | public: |
| 19 | explicit IBtmUserCore(Core::System& system_) | 17 | explicit IBtm(Core::System& system_) : ServiceFramework{system_, "btm"} { |
| 20 | : ServiceFramework{system_, "IBtmUserCore"}, service_context{system_, "IBtmUserCore"} { | ||
| 21 | // clang-format off | ||
| 22 | static const FunctionInfo functions[] = { | ||
| 23 | {0, &IBtmUserCore::AcquireBleScanEvent, "AcquireBleScanEvent"}, | ||
| 24 | {1, nullptr, "GetBleScanFilterParameter"}, | ||
| 25 | {2, nullptr, "GetBleScanFilterParameter2"}, | ||
| 26 | {3, nullptr, "StartBleScanForGeneral"}, | ||
| 27 | {4, nullptr, "StopBleScanForGeneral"}, | ||
| 28 | {5, nullptr, "GetBleScanResultsForGeneral"}, | ||
| 29 | {6, nullptr, "StartBleScanForPaired"}, | ||
| 30 | {7, nullptr, "StopBleScanForPaired"}, | ||
| 31 | {8, nullptr, "StartBleScanForSmartDevice"}, | ||
| 32 | {9, nullptr, "StopBleScanForSmartDevice"}, | ||
| 33 | {10, nullptr, "GetBleScanResultsForSmartDevice"}, | ||
| 34 | {17, &IBtmUserCore::AcquireBleConnectionEvent, "AcquireBleConnectionEvent"}, | ||
| 35 | {18, nullptr, "BleConnect"}, | ||
| 36 | {19, nullptr, "BleDisconnect"}, | ||
| 37 | {20, nullptr, "BleGetConnectionState"}, | ||
| 38 | {21, nullptr, "AcquireBlePairingEvent"}, | ||
| 39 | {22, nullptr, "BlePairDevice"}, | ||
| 40 | {23, nullptr, "BleUnPairDevice"}, | ||
| 41 | {24, nullptr, "BleUnPairDevice2"}, | ||
| 42 | {25, nullptr, "BleGetPairedDevices"}, | ||
| 43 | {26, &IBtmUserCore::AcquireBleServiceDiscoveryEvent, "AcquireBleServiceDiscoveryEvent"}, | ||
| 44 | {27, nullptr, "GetGattServices"}, | ||
| 45 | {28, nullptr, "GetGattService"}, | ||
| 46 | {29, nullptr, "GetGattIncludedServices"}, | ||
| 47 | {30, nullptr, "GetBelongingGattService"}, | ||
| 48 | {31, nullptr, "GetGattCharacteristics"}, | ||
| 49 | {32, nullptr, "GetGattDescriptors"}, | ||
| 50 | {33, &IBtmUserCore::AcquireBleMtuConfigEvent, "AcquireBleMtuConfigEvent"}, | ||
| 51 | {34, nullptr, "ConfigureBleMtu"}, | ||
| 52 | {35, nullptr, "GetBleMtu"}, | ||
| 53 | {36, nullptr, "RegisterBleGattDataPath"}, | ||
| 54 | {37, nullptr, "UnregisterBleGattDataPath"}, | ||
| 55 | }; | ||
| 56 | // clang-format on | ||
| 57 | RegisterHandlers(functions); | ||
| 58 | |||
| 59 | scan_event = service_context.CreateEvent("IBtmUserCore:ScanEvent"); | ||
| 60 | connection_event = service_context.CreateEvent("IBtmUserCore:ConnectionEvent"); | ||
| 61 | service_discovery_event = service_context.CreateEvent("IBtmUserCore:DiscoveryEvent"); | ||
| 62 | config_event = service_context.CreateEvent("IBtmUserCore:ConfigEvent"); | ||
| 63 | } | ||
| 64 | |||
| 65 | ~IBtmUserCore() override { | ||
| 66 | service_context.CloseEvent(scan_event); | ||
| 67 | service_context.CloseEvent(connection_event); | ||
| 68 | service_context.CloseEvent(service_discovery_event); | ||
| 69 | service_context.CloseEvent(config_event); | ||
| 70 | } | ||
| 71 | |||
| 72 | private: | ||
| 73 | void AcquireBleScanEvent(HLERequestContext& ctx) { | ||
| 74 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 75 | |||
| 76 | IPC::ResponseBuilder rb{ctx, 3, 1}; | ||
| 77 | rb.Push(ResultSuccess); | ||
| 78 | rb.Push(true); | ||
| 79 | rb.PushCopyObjects(scan_event->GetReadableEvent()); | ||
| 80 | } | ||
| 81 | |||
| 82 | void AcquireBleConnectionEvent(HLERequestContext& ctx) { | ||
| 83 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 84 | |||
| 85 | IPC::ResponseBuilder rb{ctx, 3, 1}; | ||
| 86 | rb.Push(ResultSuccess); | ||
| 87 | rb.Push(true); | ||
| 88 | rb.PushCopyObjects(connection_event->GetReadableEvent()); | ||
| 89 | } | ||
| 90 | |||
| 91 | void AcquireBleServiceDiscoveryEvent(HLERequestContext& ctx) { | ||
| 92 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 93 | |||
| 94 | IPC::ResponseBuilder rb{ctx, 3, 1}; | ||
| 95 | rb.Push(ResultSuccess); | ||
| 96 | rb.Push(true); | ||
| 97 | rb.PushCopyObjects(service_discovery_event->GetReadableEvent()); | ||
| 98 | } | ||
| 99 | |||
| 100 | void AcquireBleMtuConfigEvent(HLERequestContext& ctx) { | ||
| 101 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 102 | |||
| 103 | IPC::ResponseBuilder rb{ctx, 3, 1}; | ||
| 104 | rb.Push(ResultSuccess); | ||
| 105 | rb.Push(true); | ||
| 106 | rb.PushCopyObjects(config_event->GetReadableEvent()); | ||
| 107 | } | ||
| 108 | |||
| 109 | KernelHelpers::ServiceContext service_context; | ||
| 110 | |||
| 111 | Kernel::KEvent* scan_event; | ||
| 112 | Kernel::KEvent* connection_event; | ||
| 113 | Kernel::KEvent* service_discovery_event; | ||
| 114 | Kernel::KEvent* config_event; | ||
| 115 | }; | ||
| 116 | |||
| 117 | class BTM_USR final : public ServiceFramework<BTM_USR> { | ||
| 118 | public: | ||
| 119 | explicit BTM_USR(Core::System& system_) : ServiceFramework{system_, "btm:u"} { | ||
| 120 | // clang-format off | ||
| 121 | static const FunctionInfo functions[] = { | ||
| 122 | {0, &BTM_USR::GetCore, "GetCore"}, | ||
| 123 | }; | ||
| 124 | // clang-format on | ||
| 125 | RegisterHandlers(functions); | ||
| 126 | } | ||
| 127 | |||
| 128 | private: | ||
| 129 | void GetCore(HLERequestContext& ctx) { | ||
| 130 | LOG_WARNING(Service_BTM, "called"); | ||
| 131 | |||
| 132 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 133 | rb.Push(ResultSuccess); | ||
| 134 | rb.PushIpcInterface<IBtmUserCore>(system); | ||
| 135 | } | ||
| 136 | }; | ||
| 137 | |||
| 138 | class BTM final : public ServiceFramework<BTM> { | ||
| 139 | public: | ||
| 140 | explicit BTM(Core::System& system_) : ServiceFramework{system_, "btm"} { | ||
| 141 | // clang-format off | 18 | // clang-format off |
| 142 | static const FunctionInfo functions[] = { | 19 | static const FunctionInfo functions[] = { |
| 143 | {0, nullptr, "GetState"}, | 20 | {0, nullptr, "GetState"}, |
| @@ -232,144 +109,13 @@ public: | |||
| 232 | } | 109 | } |
| 233 | }; | 110 | }; |
| 234 | 111 | ||
| 235 | class BTM_DBG final : public ServiceFramework<BTM_DBG> { | ||
| 236 | public: | ||
| 237 | explicit BTM_DBG(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} { | ||
| 238 | // clang-format off | ||
| 239 | static const FunctionInfo functions[] = { | ||
| 240 | {0, nullptr, "AcquireDiscoveryEvent"}, | ||
| 241 | {1, nullptr, "StartDiscovery"}, | ||
| 242 | {2, nullptr, "CancelDiscovery"}, | ||
| 243 | {3, nullptr, "GetDeviceProperty"}, | ||
| 244 | {4, nullptr, "CreateBond"}, | ||
| 245 | {5, nullptr, "CancelBond"}, | ||
| 246 | {6, nullptr, "SetTsiMode"}, | ||
| 247 | {7, nullptr, "GeneralTest"}, | ||
| 248 | {8, nullptr, "HidConnect"}, | ||
| 249 | {9, nullptr, "GeneralGet"}, | ||
| 250 | {10, nullptr, "GetGattClientDisconnectionReason"}, | ||
| 251 | {11, nullptr, "GetBleConnectionParameter"}, | ||
| 252 | {12, nullptr, "GetBleConnectionParameterRequest"}, | ||
| 253 | {13, nullptr, "Unknown13"}, | ||
| 254 | }; | ||
| 255 | // clang-format on | ||
| 256 | |||
| 257 | RegisterHandlers(functions); | ||
| 258 | } | ||
| 259 | }; | ||
| 260 | |||
| 261 | class IBtmSystemCore final : public ServiceFramework<IBtmSystemCore> { | ||
| 262 | public: | ||
| 263 | explicit IBtmSystemCore(Core::System& system_) : ServiceFramework{system_, "IBtmSystemCore"} { | ||
| 264 | // clang-format off | ||
| 265 | static const FunctionInfo functions[] = { | ||
| 266 | {0, &IBtmSystemCore::StartGamepadPairing, "StartGamepadPairing"}, | ||
| 267 | {1, &IBtmSystemCore::CancelGamepadPairing, "CancelGamepadPairing"}, | ||
| 268 | {2, nullptr, "ClearGamepadPairingDatabase"}, | ||
| 269 | {3, nullptr, "GetPairedGamepadCount"}, | ||
| 270 | {4, nullptr, "EnableRadio"}, | ||
| 271 | {5, nullptr, "DisableRadio"}, | ||
| 272 | {6, &IBtmSystemCore::IsRadioEnabled, "IsRadioEnabled"}, | ||
| 273 | {7, nullptr, "AcquireRadioEvent"}, | ||
| 274 | {8, nullptr, "AcquireGamepadPairingEvent"}, | ||
| 275 | {9, nullptr, "IsGamepadPairingStarted"}, | ||
| 276 | {10, nullptr, "StartAudioDeviceDiscovery"}, | ||
| 277 | {11, nullptr, "StopAudioDeviceDiscovery"}, | ||
| 278 | {12, nullptr, "IsDiscoveryingAudioDevice"}, | ||
| 279 | {13, nullptr, "GetDiscoveredAudioDevice"}, | ||
| 280 | {14, nullptr, "AcquireAudioDeviceConnectionEvent"}, | ||
| 281 | {15, nullptr, "ConnectAudioDevice"}, | ||
| 282 | {16, nullptr, "IsConnectingAudioDevice"}, | ||
| 283 | {17, &IBtmSystemCore::GetConnectedAudioDevices, "GetConnectedAudioDevices"}, | ||
| 284 | {18, nullptr, "DisconnectAudioDevice"}, | ||
| 285 | {19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"}, | ||
| 286 | {20, &IBtmSystemCore::GetPairedAudioDevices, "GetPairedAudioDevices"}, | ||
| 287 | {21, nullptr, "RemoveAudioDevicePairing"}, | ||
| 288 | {22, &IBtmSystemCore::RequestAudioDeviceConnectionRejection, "RequestAudioDeviceConnectionRejection"}, | ||
| 289 | {23, &IBtmSystemCore::CancelAudioDeviceConnectionRejection, "CancelAudioDeviceConnectionRejection"} | ||
| 290 | }; | ||
| 291 | // clang-format on | ||
| 292 | |||
| 293 | RegisterHandlers(functions); | ||
| 294 | } | ||
| 295 | |||
| 296 | private: | ||
| 297 | void IsRadioEnabled(HLERequestContext& ctx) { | ||
| 298 | LOG_DEBUG(Service_BTM, "(STUBBED) called"); // Spams a lot when controller applet is running | ||
| 299 | |||
| 300 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 301 | rb.Push(ResultSuccess); | ||
| 302 | rb.Push(true); | ||
| 303 | } | ||
| 304 | |||
| 305 | void StartGamepadPairing(HLERequestContext& ctx) { | ||
| 306 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 307 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 308 | rb.Push(ResultSuccess); | ||
| 309 | } | ||
| 310 | |||
| 311 | void CancelGamepadPairing(HLERequestContext& ctx) { | ||
| 312 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 313 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 314 | rb.Push(ResultSuccess); | ||
| 315 | } | ||
| 316 | |||
| 317 | void CancelAudioDeviceConnectionRejection(HLERequestContext& ctx) { | ||
| 318 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 319 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 320 | rb.Push(ResultSuccess); | ||
| 321 | } | ||
| 322 | |||
| 323 | void GetConnectedAudioDevices(HLERequestContext& ctx) { | ||
| 324 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 325 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 326 | rb.Push(ResultSuccess); | ||
| 327 | rb.Push<u32>(0); | ||
| 328 | } | ||
| 329 | |||
| 330 | void GetPairedAudioDevices(HLERequestContext& ctx) { | ||
| 331 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 332 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 333 | rb.Push(ResultSuccess); | ||
| 334 | rb.Push<u32>(0); | ||
| 335 | } | ||
| 336 | |||
| 337 | void RequestAudioDeviceConnectionRejection(HLERequestContext& ctx) { | ||
| 338 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 339 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 340 | rb.Push(ResultSuccess); | ||
| 341 | } | ||
| 342 | }; | ||
| 343 | |||
| 344 | class BTM_SYS final : public ServiceFramework<BTM_SYS> { | ||
| 345 | public: | ||
| 346 | explicit BTM_SYS(Core::System& system_) : ServiceFramework{system_, "btm:sys"} { | ||
| 347 | // clang-format off | ||
| 348 | static const FunctionInfo functions[] = { | ||
| 349 | {0, &BTM_SYS::GetCore, "GetCore"}, | ||
| 350 | }; | ||
| 351 | // clang-format on | ||
| 352 | |||
| 353 | RegisterHandlers(functions); | ||
| 354 | } | ||
| 355 | |||
| 356 | private: | ||
| 357 | void GetCore(HLERequestContext& ctx) { | ||
| 358 | LOG_WARNING(Service_BTM, "called"); | ||
| 359 | |||
| 360 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 361 | rb.Push(ResultSuccess); | ||
| 362 | rb.PushIpcInterface<IBtmSystemCore>(system); | ||
| 363 | } | ||
| 364 | }; | ||
| 365 | |||
| 366 | void LoopProcess(Core::System& system) { | 112 | void LoopProcess(Core::System& system) { |
| 367 | auto server_manager = std::make_unique<ServerManager>(system); | 113 | auto server_manager = std::make_unique<ServerManager>(system); |
| 368 | 114 | ||
| 369 | server_manager->RegisterNamedService("btm", std::make_shared<BTM>(system)); | 115 | server_manager->RegisterNamedService("btm", std::make_shared<IBtm>(system)); |
| 370 | server_manager->RegisterNamedService("btm:dbg", std::make_shared<BTM_DBG>(system)); | 116 | server_manager->RegisterNamedService("btm:dbg", std::make_shared<IBtmDebug>(system)); |
| 371 | server_manager->RegisterNamedService("btm:sys", std::make_shared<BTM_SYS>(system)); | 117 | server_manager->RegisterNamedService("btm:sys", std::make_shared<IBtmSystem>(system)); |
| 372 | server_manager->RegisterNamedService("btm:u", std::make_shared<BTM_USR>(system)); | 118 | server_manager->RegisterNamedService("btm:u", std::make_shared<IBtmUser>(system)); |
| 373 | ServerManager::RunServer(std::move(server_manager)); | 119 | ServerManager::RunServer(std::move(server_manager)); |
| 374 | } | 120 | } |
| 375 | 121 | ||
diff --git a/src/core/hle/service/btm/btm.h b/src/core/hle/service/btm/btm.h index a99b34364..0bf77d053 100644 --- a/src/core/hle/service/btm/btm.h +++ b/src/core/hle/service/btm/btm.h | |||
| @@ -3,10 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | namespace Service::SM { | ||
| 7 | class ServiceManager; | ||
| 8 | } | ||
| 9 | |||
| 10 | namespace Core { | 6 | namespace Core { |
| 11 | class System; | 7 | class System; |
| 12 | }; | 8 | }; |
diff --git a/src/core/hle/service/btm/btm_debug.cpp b/src/core/hle/service/btm/btm_debug.cpp new file mode 100644 index 000000000..4d61d2641 --- /dev/null +++ b/src/core/hle/service/btm/btm_debug.cpp | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #include "core/hle/service/btm/btm_debug.h" | ||
| 5 | |||
| 6 | namespace Service::BTM { | ||
| 7 | |||
| 8 | IBtmDebug::IBtmDebug(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} { | ||
| 9 | // clang-format off | ||
| 10 | static const FunctionInfo functions[] = { | ||
| 11 | {0, nullptr, "AcquireDiscoveryEvent"}, | ||
| 12 | {1, nullptr, "StartDiscovery"}, | ||
| 13 | {2, nullptr, "CancelDiscovery"}, | ||
| 14 | {3, nullptr, "GetDeviceProperty"}, | ||
| 15 | {4, nullptr, "CreateBond"}, | ||
| 16 | {5, nullptr, "CancelBond"}, | ||
| 17 | {6, nullptr, "SetTsiMode"}, | ||
| 18 | {7, nullptr, "GeneralTest"}, | ||
| 19 | {8, nullptr, "HidConnect"}, | ||
| 20 | {9, nullptr, "GeneralGet"}, | ||
| 21 | {10, nullptr, "GetGattClientDisconnectionReason"}, | ||
| 22 | {11, nullptr, "GetBleConnectionParameter"}, | ||
| 23 | {12, nullptr, "GetBleConnectionParameterRequest"}, | ||
| 24 | {13, nullptr, "Unknown13"}, | ||
| 25 | }; | ||
| 26 | // clang-format on | ||
| 27 | |||
| 28 | RegisterHandlers(functions); | ||
| 29 | } | ||
| 30 | |||
| 31 | IBtmDebug::~IBtmDebug() = default; | ||
| 32 | |||
| 33 | } // namespace Service::BTM | ||
diff --git a/src/core/hle/service/btm/btm_debug.h b/src/core/hle/service/btm/btm_debug.h new file mode 100644 index 000000000..bf4f7e14f --- /dev/null +++ b/src/core/hle/service/btm/btm_debug.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 13 | namespace Service::BTM { | ||
| 14 | |||
| 15 | class IBtmDebug final : public ServiceFramework<IBtmDebug> { | ||
| 16 | public: | ||
| 17 | explicit IBtmDebug(Core::System& system_); | ||
| 18 | ~IBtmDebug() override; | ||
| 19 | }; | ||
| 20 | |||
| 21 | } // namespace Service::BTM | ||
diff --git a/src/core/hle/service/btm/btm_system.cpp b/src/core/hle/service/btm/btm_system.cpp new file mode 100644 index 000000000..99718a7b0 --- /dev/null +++ b/src/core/hle/service/btm/btm_system.cpp | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #include "common/logging/log.h" | ||
| 5 | #include "core/hle/service/btm/btm_system.h" | ||
| 6 | #include "core/hle/service/btm/btm_system_core.h" | ||
| 7 | #include "core/hle/service/cmif_serialization.h" | ||
| 8 | #include "core/hle/service/service.h" | ||
| 9 | |||
| 10 | namespace Service::BTM { | ||
| 11 | |||
| 12 | IBtmSystem::IBtmSystem(Core::System& system_) : ServiceFramework{system_, "btm:sys"} { | ||
| 13 | // clang-format off | ||
| 14 | static const FunctionInfo functions[] = { | ||
| 15 | {0, C<&IBtmSystem::GetCore>, "GetCore"}, | ||
| 16 | }; | ||
| 17 | // clang-format on | ||
| 18 | |||
| 19 | RegisterHandlers(functions); | ||
| 20 | } | ||
| 21 | |||
| 22 | IBtmSystem::~IBtmSystem() = default; | ||
| 23 | |||
| 24 | Result IBtmSystem::GetCore(OutInterface<IBtmSystemCore> out_interface) { | ||
| 25 | LOG_WARNING(Service_BTM, "called"); | ||
| 26 | |||
| 27 | *out_interface = std::make_shared<IBtmSystemCore>(system); | ||
| 28 | R_SUCCEED(); | ||
| 29 | } | ||
| 30 | |||
| 31 | } // namespace Service::BTM | ||
diff --git a/src/core/hle/service/btm/btm_system.h b/src/core/hle/service/btm/btm_system.h new file mode 100644 index 000000000..fe1c6dbd7 --- /dev/null +++ b/src/core/hle/service/btm/btm_system.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 13 | namespace Service::BTM { | ||
| 14 | class IBtmSystemCore; | ||
| 15 | |||
| 16 | class IBtmSystem final : public ServiceFramework<IBtmSystem> { | ||
| 17 | public: | ||
| 18 | explicit IBtmSystem(Core::System& system_); | ||
| 19 | ~IBtmSystem() override; | ||
| 20 | |||
| 21 | private: | ||
| 22 | Result GetCore(OutInterface<IBtmSystemCore> out_interface); | ||
| 23 | }; | ||
| 24 | |||
| 25 | } // namespace Service::BTM | ||
diff --git a/src/core/hle/service/btm/btm_system_core.cpp b/src/core/hle/service/btm/btm_system_core.cpp new file mode 100644 index 000000000..4bc8a9e8b --- /dev/null +++ b/src/core/hle/service/btm/btm_system_core.cpp | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #include "common/logging/log.h" | ||
| 5 | #include "core/hle/service/btm/btm_system_core.h" | ||
| 6 | #include "core/hle/service/cmif_serialization.h" | ||
| 7 | #include "core/hle/service/set/system_settings_server.h" | ||
| 8 | #include "core/hle/service/sm/sm.h" | ||
| 9 | |||
| 10 | namespace Service::BTM { | ||
| 11 | |||
| 12 | IBtmSystemCore::IBtmSystemCore(Core::System& system_) | ||
| 13 | : ServiceFramework{system_, "IBtmSystemCore"}, service_context{system_, "IBtmSystemCore"} { | ||
| 14 | // clang-format off | ||
| 15 | static const FunctionInfo functions[] = { | ||
| 16 | {0, C<&IBtmSystemCore::StartGamepadPairing>, "StartGamepadPairing"}, | ||
| 17 | {1, C<&IBtmSystemCore::CancelGamepadPairing>, "CancelGamepadPairing"}, | ||
| 18 | {2, nullptr, "ClearGamepadPairingDatabase"}, | ||
| 19 | {3, nullptr, "GetPairedGamepadCount"}, | ||
| 20 | {4, C<&IBtmSystemCore::EnableRadio>, "EnableRadio"}, | ||
| 21 | {5, C<&IBtmSystemCore::DisableRadio>, "DisableRadio"}, | ||
| 22 | {6, C<&IBtmSystemCore::IsRadioEnabled>, "IsRadioEnabled"}, | ||
| 23 | {7, C<&IBtmSystemCore::AcquireRadioEvent>, "AcquireRadioEvent"}, | ||
| 24 | {8, nullptr, "AcquireGamepadPairingEvent"}, | ||
| 25 | {9, nullptr, "IsGamepadPairingStarted"}, | ||
| 26 | {10, nullptr, "StartAudioDeviceDiscovery"}, | ||
| 27 | {11, nullptr, "StopAudioDeviceDiscovery"}, | ||
| 28 | {12, nullptr, "IsDiscoveryingAudioDevice"}, | ||
| 29 | {13, nullptr, "GetDiscoveredAudioDevice"}, | ||
| 30 | {14, C<&IBtmSystemCore::AcquireAudioDeviceConnectionEvent>, "AcquireAudioDeviceConnectionEvent"}, | ||
| 31 | {15, nullptr, "ConnectAudioDevice"}, | ||
| 32 | {16, nullptr, "IsConnectingAudioDevice"}, | ||
| 33 | {17, C<&IBtmSystemCore::GetConnectedAudioDevices>, "GetConnectedAudioDevices"}, | ||
| 34 | {18, nullptr, "DisconnectAudioDevice"}, | ||
| 35 | {19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"}, | ||
| 36 | {20, C<&IBtmSystemCore::GetPairedAudioDevices>, "GetPairedAudioDevices"}, | ||
| 37 | {21, nullptr, "RemoveAudioDevicePairing"}, | ||
| 38 | {22, C<&IBtmSystemCore::RequestAudioDeviceConnectionRejection>, "RequestAudioDeviceConnectionRejection"}, | ||
| 39 | {23, C<&IBtmSystemCore::CancelAudioDeviceConnectionRejection>, "CancelAudioDeviceConnectionRejection"} | ||
| 40 | }; | ||
| 41 | // clang-format on | ||
| 42 | |||
| 43 | RegisterHandlers(functions); | ||
| 44 | radio_event = service_context.CreateEvent("IBtmSystemCore::RadioEvent"); | ||
| 45 | audio_device_connection_event = | ||
| 46 | service_context.CreateEvent("IBtmSystemCore::AudioDeviceConnectionEvent"); | ||
| 47 | |||
| 48 | m_set_sys = | ||
| 49 | system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true); | ||
| 50 | } | ||
| 51 | |||
| 52 | IBtmSystemCore::~IBtmSystemCore() { | ||
| 53 | service_context.CloseEvent(radio_event); | ||
| 54 | service_context.CloseEvent(audio_device_connection_event); | ||
| 55 | } | ||
| 56 | |||
| 57 | Result IBtmSystemCore::StartGamepadPairing() { | ||
| 58 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 59 | R_SUCCEED(); | ||
| 60 | } | ||
| 61 | |||
| 62 | Result IBtmSystemCore::CancelGamepadPairing() { | ||
| 63 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 64 | R_SUCCEED(); | ||
| 65 | } | ||
| 66 | |||
| 67 | Result IBtmSystemCore::EnableRadio() { | ||
| 68 | LOG_DEBUG(Service_BTM, "called"); | ||
| 69 | |||
| 70 | R_RETURN(m_set_sys->SetBluetoothEnableFlag(true)); | ||
| 71 | } | ||
| 72 | Result IBtmSystemCore::DisableRadio() { | ||
| 73 | LOG_DEBUG(Service_BTM, "called"); | ||
| 74 | |||
| 75 | R_RETURN(m_set_sys->SetBluetoothEnableFlag(false)); | ||
| 76 | } | ||
| 77 | |||
| 78 | Result IBtmSystemCore::IsRadioEnabled(Out<bool> out_is_enabled) { | ||
| 79 | LOG_DEBUG(Service_BTM, "called"); | ||
| 80 | |||
| 81 | R_RETURN(m_set_sys->GetBluetoothEnableFlag(out_is_enabled)); | ||
| 82 | } | ||
| 83 | |||
| 84 | Result IBtmSystemCore::AcquireRadioEvent(Out<bool> out_is_valid, | ||
| 85 | OutCopyHandle<Kernel::KReadableEvent> out_event) { | ||
| 86 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 87 | |||
| 88 | *out_is_valid = true; | ||
| 89 | *out_event = &radio_event->GetReadableEvent(); | ||
| 90 | R_SUCCEED(); | ||
| 91 | } | ||
| 92 | |||
| 93 | Result IBtmSystemCore::AcquireAudioDeviceConnectionEvent( | ||
| 94 | OutCopyHandle<Kernel::KReadableEvent> out_event) { | ||
| 95 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 96 | |||
| 97 | *out_event = &audio_device_connection_event->GetReadableEvent(); | ||
| 98 | R_SUCCEED(); | ||
| 99 | } | ||
| 100 | |||
| 101 | Result IBtmSystemCore::GetConnectedAudioDevices( | ||
| 102 | Out<s32> out_count, OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices) { | ||
| 103 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 104 | |||
| 105 | *out_count = 0; | ||
| 106 | R_SUCCEED(); | ||
| 107 | } | ||
| 108 | |||
| 109 | Result IBtmSystemCore::GetPairedAudioDevices( | ||
| 110 | Out<s32> out_count, OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices) { | ||
| 111 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 112 | |||
| 113 | *out_count = 0; | ||
| 114 | R_SUCCEED(); | ||
| 115 | } | ||
| 116 | |||
| 117 | Result IBtmSystemCore::RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { | ||
| 118 | LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); | ||
| 119 | R_SUCCEED(); | ||
| 120 | } | ||
| 121 | |||
| 122 | Result IBtmSystemCore::CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) { | ||
| 123 | LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); | ||
| 124 | R_SUCCEED(); | ||
| 125 | } | ||
| 126 | |||
| 127 | } // namespace Service::BTM | ||
diff --git a/src/core/hle/service/btm/btm_system_core.h b/src/core/hle/service/btm/btm_system_core.h new file mode 100644 index 000000000..06498b21e --- /dev/null +++ b/src/core/hle/service/btm/btm_system_core.h | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 7 | #include "core/hle/service/kernel_helpers.h" | ||
| 8 | #include "core/hle/service/service.h" | ||
| 9 | |||
| 10 | namespace Kernel { | ||
| 11 | class KEvent; | ||
| 12 | class KReadableEvent; | ||
| 13 | } // namespace Kernel | ||
| 14 | |||
| 15 | namespace Core { | ||
| 16 | class System; | ||
| 17 | } | ||
| 18 | |||
| 19 | namespace Service::Set { | ||
| 20 | class ISystemSettingsServer; | ||
| 21 | } | ||
| 22 | |||
| 23 | namespace Service::BTM { | ||
| 24 | |||
| 25 | class IBtmSystemCore final : public ServiceFramework<IBtmSystemCore> { | ||
| 26 | public: | ||
| 27 | explicit IBtmSystemCore(Core::System& system_); | ||
| 28 | ~IBtmSystemCore() override; | ||
| 29 | |||
| 30 | private: | ||
| 31 | Result StartGamepadPairing(); | ||
| 32 | Result CancelGamepadPairing(); | ||
| 33 | Result EnableRadio(); | ||
| 34 | Result DisableRadio(); | ||
| 35 | Result IsRadioEnabled(Out<bool> out_is_enabled); | ||
| 36 | |||
| 37 | Result AcquireRadioEvent(Out<bool> out_is_valid, | ||
| 38 | OutCopyHandle<Kernel::KReadableEvent> out_event); | ||
| 39 | |||
| 40 | Result AcquireAudioDeviceConnectionEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); | ||
| 41 | |||
| 42 | Result GetConnectedAudioDevices( | ||
| 43 | Out<s32> out_count, | ||
| 44 | OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices); | ||
| 45 | |||
| 46 | Result GetPairedAudioDevices( | ||
| 47 | Out<s32> out_count, | ||
| 48 | OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices); | ||
| 49 | |||
| 50 | Result RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid); | ||
| 51 | Result CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid); | ||
| 52 | |||
| 53 | KernelHelpers::ServiceContext service_context; | ||
| 54 | |||
| 55 | Kernel::KEvent* radio_event; | ||
| 56 | Kernel::KEvent* audio_device_connection_event; | ||
| 57 | std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys; | ||
| 58 | }; | ||
| 59 | |||
| 60 | } // namespace Service::BTM | ||
diff --git a/src/core/hle/service/btm/btm_user.cpp b/src/core/hle/service/btm/btm_user.cpp new file mode 100644 index 000000000..d2e228f8d --- /dev/null +++ b/src/core/hle/service/btm/btm_user.cpp | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #include "common/logging/log.h" | ||
| 5 | #include "core/hle/service/btm/btm_user.h" | ||
| 6 | #include "core/hle/service/btm/btm_user_core.h" | ||
| 7 | #include "core/hle/service/cmif_serialization.h" | ||
| 8 | |||
| 9 | namespace Service::BTM { | ||
| 10 | |||
| 11 | IBtmUser::IBtmUser(Core::System& system_) : ServiceFramework{system_, "btm:u"} { | ||
| 12 | // clang-format off | ||
| 13 | static const FunctionInfo functions[] = { | ||
| 14 | {0, C<&IBtmUser::GetCore>, "GetCore"}, | ||
| 15 | }; | ||
| 16 | // clang-format on | ||
| 17 | |||
| 18 | RegisterHandlers(functions); | ||
| 19 | } | ||
| 20 | |||
| 21 | IBtmUser::~IBtmUser() = default; | ||
| 22 | |||
| 23 | Result IBtmUser::GetCore(OutInterface<IBtmUserCore> out_interface) { | ||
| 24 | LOG_WARNING(Service_BTM, "called"); | ||
| 25 | |||
| 26 | *out_interface = std::make_shared<IBtmUserCore>(system); | ||
| 27 | R_SUCCEED(); | ||
| 28 | } | ||
| 29 | |||
| 30 | } // namespace Service::BTM | ||
diff --git a/src/core/hle/service/btm/btm_user.h b/src/core/hle/service/btm/btm_user.h new file mode 100644 index 000000000..d9ee5db45 --- /dev/null +++ b/src/core/hle/service/btm/btm_user.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 13 | namespace Service::BTM { | ||
| 14 | class IBtmUserCore; | ||
| 15 | |||
| 16 | class IBtmUser final : public ServiceFramework<IBtmUser> { | ||
| 17 | public: | ||
| 18 | explicit IBtmUser(Core::System& system_); | ||
| 19 | ~IBtmUser() override; | ||
| 20 | |||
| 21 | private: | ||
| 22 | Result GetCore(OutInterface<IBtmUserCore> out_interface); | ||
| 23 | }; | ||
| 24 | |||
| 25 | } // namespace Service::BTM | ||
diff --git a/src/core/hle/service/btm/btm_user_core.cpp b/src/core/hle/service/btm/btm_user_core.cpp new file mode 100644 index 000000000..6f9fa589b --- /dev/null +++ b/src/core/hle/service/btm/btm_user_core.cpp | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #include <memory> | ||
| 5 | |||
| 6 | #include "common/logging/log.h" | ||
| 7 | #include "core/core.h" | ||
| 8 | #include "core/hle/kernel/k_event.h" | ||
| 9 | #include "core/hle/service/btm/btm_user_core.h" | ||
| 10 | #include "core/hle/service/cmif_serialization.h" | ||
| 11 | |||
| 12 | namespace Service::BTM { | ||
| 13 | |||
| 14 | IBtmUserCore::IBtmUserCore(Core::System& system_) | ||
| 15 | : ServiceFramework{system_, "IBtmUserCore"}, service_context{system_, "IBtmUserCore"} { | ||
| 16 | // clang-format off | ||
| 17 | static const FunctionInfo functions[] = { | ||
| 18 | {0, C<&IBtmUserCore::AcquireBleScanEvent>, "AcquireBleScanEvent"}, | ||
| 19 | {1, nullptr, "GetBleScanFilterParameter"}, | ||
| 20 | {2, nullptr, "GetBleScanFilterParameter2"}, | ||
| 21 | {3, nullptr, "StartBleScanForGeneral"}, | ||
| 22 | {4, nullptr, "StopBleScanForGeneral"}, | ||
| 23 | {5, nullptr, "GetBleScanResultsForGeneral"}, | ||
| 24 | {6, nullptr, "StartBleScanForPaired"}, | ||
| 25 | {7, nullptr, "StopBleScanForPaired"}, | ||
| 26 | {8, nullptr, "StartBleScanForSmartDevice"}, | ||
| 27 | {9, nullptr, "StopBleScanForSmartDevice"}, | ||
| 28 | {10, nullptr, "GetBleScanResultsForSmartDevice"}, | ||
| 29 | {17, C<&IBtmUserCore::AcquireBleConnectionEvent>, "AcquireBleConnectionEvent"}, | ||
| 30 | {18, nullptr, "BleConnect"}, | ||
| 31 | {19, nullptr, "BleDisconnect"}, | ||
| 32 | {20, nullptr, "BleGetConnectionState"}, | ||
| 33 | {21, nullptr, "AcquireBlePairingEvent"}, | ||
| 34 | {22, nullptr, "BlePairDevice"}, | ||
| 35 | {23, nullptr, "BleUnPairDevice"}, | ||
| 36 | {24, nullptr, "BleUnPairDevice2"}, | ||
| 37 | {25, nullptr, "BleGetPairedDevices"}, | ||
| 38 | {26, C<&IBtmUserCore::AcquireBleServiceDiscoveryEvent>, "AcquireBleServiceDiscoveryEvent"}, | ||
| 39 | {27, nullptr, "GetGattServices"}, | ||
| 40 | {28, nullptr, "GetGattService"}, | ||
| 41 | {29, nullptr, "GetGattIncludedServices"}, | ||
| 42 | {30, nullptr, "GetBelongingGattService"}, | ||
| 43 | {31, nullptr, "GetGattCharacteristics"}, | ||
| 44 | {32, nullptr, "GetGattDescriptors"}, | ||
| 45 | {33, C<&IBtmUserCore::AcquireBleMtuConfigEvent>, "AcquireBleMtuConfigEvent"}, | ||
| 46 | {34, nullptr, "ConfigureBleMtu"}, | ||
| 47 | {35, nullptr, "GetBleMtu"}, | ||
| 48 | {36, nullptr, "RegisterBleGattDataPath"}, | ||
| 49 | {37, nullptr, "UnregisterBleGattDataPath"}, | ||
| 50 | }; | ||
| 51 | // clang-format on | ||
| 52 | RegisterHandlers(functions); | ||
| 53 | |||
| 54 | scan_event = service_context.CreateEvent("IBtmUserCore:ScanEvent"); | ||
| 55 | connection_event = service_context.CreateEvent("IBtmUserCore:ConnectionEvent"); | ||
| 56 | service_discovery_event = service_context.CreateEvent("IBtmUserCore:DiscoveryEvent"); | ||
| 57 | config_event = service_context.CreateEvent("IBtmUserCore:ConfigEvent"); | ||
| 58 | } | ||
| 59 | |||
| 60 | IBtmUserCore::~IBtmUserCore() { | ||
| 61 | service_context.CloseEvent(scan_event); | ||
| 62 | service_context.CloseEvent(connection_event); | ||
| 63 | service_context.CloseEvent(service_discovery_event); | ||
| 64 | service_context.CloseEvent(config_event); | ||
| 65 | } | ||
| 66 | |||
| 67 | Result IBtmUserCore::AcquireBleScanEvent(Out<bool> out_is_valid, | ||
| 68 | OutCopyHandle<Kernel::KReadableEvent> out_event) { | ||
| 69 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 70 | |||
| 71 | *out_is_valid = true; | ||
| 72 | *out_event = &scan_event->GetReadableEvent(); | ||
| 73 | R_SUCCEED(); | ||
| 74 | } | ||
| 75 | |||
| 76 | Result IBtmUserCore::AcquireBleConnectionEvent(Out<bool> out_is_valid, | ||
| 77 | OutCopyHandle<Kernel::KReadableEvent> out_event) { | ||
| 78 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 79 | |||
| 80 | *out_is_valid = true; | ||
| 81 | *out_event = &connection_event->GetReadableEvent(); | ||
| 82 | R_SUCCEED(); | ||
| 83 | } | ||
| 84 | |||
| 85 | Result IBtmUserCore::AcquireBleServiceDiscoveryEvent( | ||
| 86 | Out<bool> out_is_valid, OutCopyHandle<Kernel::KReadableEvent> out_event) { | ||
| 87 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 88 | |||
| 89 | *out_is_valid = true; | ||
| 90 | *out_event = &service_discovery_event->GetReadableEvent(); | ||
| 91 | R_SUCCEED(); | ||
| 92 | } | ||
| 93 | |||
| 94 | Result IBtmUserCore::AcquireBleMtuConfigEvent(Out<bool> out_is_valid, | ||
| 95 | OutCopyHandle<Kernel::KReadableEvent> out_event) { | ||
| 96 | LOG_WARNING(Service_BTM, "(STUBBED) called"); | ||
| 97 | |||
| 98 | *out_is_valid = true; | ||
| 99 | *out_event = &config_event->GetReadableEvent(); | ||
| 100 | R_SUCCEED(); | ||
| 101 | } | ||
| 102 | |||
| 103 | } // namespace Service::BTM | ||
diff --git a/src/core/hle/service/btm/btm_user_core.h b/src/core/hle/service/btm/btm_user_core.h new file mode 100644 index 000000000..dc0a22e81 --- /dev/null +++ b/src/core/hle/service/btm/btm_user_core.h | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 7 | #include "core/hle/service/kernel_helpers.h" | ||
| 8 | #include "core/hle/service/service.h" | ||
| 9 | |||
| 10 | namespace Kernel { | ||
| 11 | class KEvent; | ||
| 12 | class KReadableEvent; | ||
| 13 | } // namespace Kernel | ||
| 14 | |||
| 15 | namespace Core { | ||
| 16 | class System; | ||
| 17 | } | ||
| 18 | |||
| 19 | namespace Service::BTM { | ||
| 20 | |||
| 21 | class IBtmUserCore final : public ServiceFramework<IBtmUserCore> { | ||
| 22 | public: | ||
| 23 | explicit IBtmUserCore(Core::System& system_); | ||
| 24 | ~IBtmUserCore() override; | ||
| 25 | |||
| 26 | private: | ||
| 27 | Result AcquireBleScanEvent(Out<bool> out_is_valid, | ||
| 28 | OutCopyHandle<Kernel::KReadableEvent> out_event); | ||
| 29 | |||
| 30 | Result AcquireBleConnectionEvent(Out<bool> out_is_valid, | ||
| 31 | OutCopyHandle<Kernel::KReadableEvent> out_event); | ||
| 32 | |||
| 33 | Result AcquireBleServiceDiscoveryEvent(Out<bool> out_is_valid, | ||
| 34 | OutCopyHandle<Kernel::KReadableEvent> out_event); | ||
| 35 | |||
| 36 | Result AcquireBleMtuConfigEvent(Out<bool> out_is_valid, | ||
| 37 | OutCopyHandle<Kernel::KReadableEvent> out_event); | ||
| 38 | |||
| 39 | KernelHelpers::ServiceContext service_context; | ||
| 40 | |||
| 41 | Kernel::KEvent* scan_event; | ||
| 42 | Kernel::KEvent* connection_event; | ||
| 43 | Kernel::KEvent* service_discovery_event; | ||
| 44 | Kernel::KEvent* config_event; | ||
| 45 | }; | ||
| 46 | |||
| 47 | } // namespace Service::BTM | ||