diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2023-04-20 03:01:23 +0200 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2023-05-06 06:02:59 +0200 |
commit | 94151097b9abadf35c55ea06a31925c9848f4c62 (patch) | |
tree | 28a00c878f90492ffd2bb95521c2cc3990cc4323 /src/core/hle/service/nfc/nfc_interface.h | |
parent | core: service: Add FunctionInfoTyped to allow expanding existing interfaces (diff) | |
download | yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.gz yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.bz2 yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.lz yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.xz yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.tar.zst yuzu-94151097b9abadf35c55ea06a31925c9848f4c62.zip |
Diffstat (limited to 'src/core/hle/service/nfc/nfc_interface.h')
-rw-r--r-- | src/core/hle/service/nfc/nfc_interface.h | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/core/hle/service/nfc/nfc_interface.h b/src/core/hle/service/nfc/nfc_interface.h index 8c1bf5a59..08be174d8 100644 --- a/src/core/hle/service/nfc/nfc_interface.h +++ b/src/core/hle/service/nfc/nfc_interface.h @@ -3,20 +3,17 @@ #pragma once -#include <array> -#include <memory> -#include <optional> - #include "core/hle/service/kernel_helpers.h" +#include "core/hle/service/nfc/nfc_types.h" #include "core/hle/service/service.h" namespace Service::NFC { -class NfcDevice; +class DeviceManager; -class Interface : public ServiceFramework<Interface> { +class NfcInterface : public ServiceFramework<NfcInterface> { public: - explicit Interface(Core::System& system_, const char* name); - ~Interface(); + explicit NfcInterface(Core::System& system_, const char* name, BackendType service_backend); + ~NfcInterface(); void Initialize(HLERequestContext& ctx); void Finalize(HLERequestContext& ctx); @@ -31,22 +28,22 @@ public: void GetTagInfo(HLERequestContext& ctx); void AttachActivateEvent(HLERequestContext& ctx); void AttachDeactivateEvent(HLERequestContext& ctx); + void ReadMifare(HLERequestContext& ctx); + void WriteMifare(HLERequestContext& ctx); void SendCommandByPassThrough(HLERequestContext& ctx); -private: - enum class State : u32 { - NonInitialized, - Initialized, - }; - - std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle); +protected: + std::shared_ptr<DeviceManager> GetManager(); + BackendType GetBackendType() const; + Result TranslateResultToServiceError(Result result) const; + Result TranslateResultToNfp(Result result) const; + Result TranslateResultToMifare(Result result) const; KernelHelpers::ServiceContext service_context; - std::array<std::shared_ptr<NfcDevice>, 10> devices{}; - + BackendType backend_type; State state{State::NonInitialized}; - Kernel::KEvent* availability_change_event; + std::shared_ptr<DeviceManager> device_manager = nullptr; }; } // namespace Service::NFC |