summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nfc/mifare_interface.h
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2023-04-15 01:55:13 +0200
committergerman77 <juangerman-13@hotmail.com>2023-04-24 07:28:09 +0200
commit00d76fc5f5276b74f4c14edda579981831808d35 (patch)
tree601c74976ca479af844e33c58cbb2be376c0830d /src/core/hle/service/nfc/mifare_interface.h
parentservice: nfc: Create interface (diff)
downloadyuzu-00d76fc5f5276b74f4c14edda579981831808d35.tar
yuzu-00d76fc5f5276b74f4c14edda579981831808d35.tar.gz
yuzu-00d76fc5f5276b74f4c14edda579981831808d35.tar.bz2
yuzu-00d76fc5f5276b74f4c14edda579981831808d35.tar.lz
yuzu-00d76fc5f5276b74f4c14edda579981831808d35.tar.xz
yuzu-00d76fc5f5276b74f4c14edda579981831808d35.tar.zst
yuzu-00d76fc5f5276b74f4c14edda579981831808d35.zip
Diffstat (limited to 'src/core/hle/service/nfc/mifare_interface.h')
-rw-r--r--src/core/hle/service/nfc/mifare_interface.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/core/hle/service/nfc/mifare_interface.h b/src/core/hle/service/nfc/mifare_interface.h
new file mode 100644
index 000000000..698c8a6b6
--- /dev/null
+++ b/src/core/hle/service/nfc/mifare_interface.h
@@ -0,0 +1,52 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <array>
+#include <memory>
+#include <optional>
+
+#include "core/hle/service/kernel_helpers.h"
+#include "core/hle/service/service.h"
+
+namespace Service::NFC {
+class NfcDevice;
+
+class MFInterface : public ServiceFramework<MFInterface> {
+public:
+ explicit MFInterface(Core::System& system_, const char* name);
+ ~MFInterface();
+
+ void Initialize(HLERequestContext& ctx);
+ void Finalize(HLERequestContext& ctx);
+ void ListDevices(HLERequestContext& ctx);
+ void StartDetection(HLERequestContext& ctx);
+ void StopDetection(HLERequestContext& ctx);
+ void Read(HLERequestContext& ctx);
+ void Write(HLERequestContext& ctx);
+ void GetTagInfo(HLERequestContext& ctx);
+ void GetActivateEventHandle(HLERequestContext& ctx);
+ void GetDeactivateEventHandle(HLERequestContext& ctx);
+ void GetState(HLERequestContext& ctx);
+ void GetDeviceState(HLERequestContext& ctx);
+ void GetNpadId(HLERequestContext& ctx);
+ void GetAvailabilityChangeEventHandle(HLERequestContext& ctx);
+
+private:
+ enum class State : u32 {
+ NonInitialized,
+ Initialized,
+ };
+
+ std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle);
+
+ KernelHelpers::ServiceContext service_context;
+
+ std::array<std::shared_ptr<NfcDevice>, 10> devices{};
+
+ State state{State::NonInitialized};
+ Kernel::KEvent* availability_change_event;
+};
+
+} // namespace Service::NFC