diff options
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/nfc.h')
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/nfc.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/input_common/helpers/joycon_protocol/nfc.h b/src/input_common/helpers/joycon_protocol/nfc.h index c9e9af03f..eb58c427d 100644 --- a/src/input_common/helpers/joycon_protocol/nfc.h +++ b/src/input_common/helpers/joycon_protocol/nfc.h | |||
| @@ -27,6 +27,8 @@ public: | |||
| 27 | 27 | ||
| 28 | DriverResult ScanAmiibo(std::vector<u8>& data); | 28 | DriverResult ScanAmiibo(std::vector<u8>& data); |
| 29 | 29 | ||
| 30 | DriverResult WriteAmiibo(std::span<const u8> data); | ||
| 31 | |||
| 30 | bool HasAmiibo(); | 32 | bool HasAmiibo(); |
| 31 | 33 | ||
| 32 | bool IsEnabled() const; | 34 | bool IsEnabled() const; |
| @@ -37,18 +39,20 @@ private: | |||
| 37 | 39 | ||
| 38 | struct TagFoundData { | 40 | struct TagFoundData { |
| 39 | u8 type; | 41 | u8 type; |
| 40 | std::vector<u8> uuid; | 42 | u8 uuid_size; |
| 43 | TagUUID uuid; | ||
| 41 | }; | 44 | }; |
| 42 | 45 | ||
| 43 | DriverResult WaitUntilNfcIsReady(); | 46 | DriverResult WaitUntilNfcIs(NFCStatus status); |
| 44 | |||
| 45 | DriverResult WaitUntilNfcIsPolling(); | ||
| 46 | 47 | ||
| 47 | DriverResult IsTagInRange(TagFoundData& data, std::size_t timeout_limit = 1); | 48 | DriverResult IsTagInRange(TagFoundData& data, std::size_t timeout_limit = 1); |
| 48 | 49 | ||
| 49 | DriverResult GetAmiiboData(std::vector<u8>& data); | 50 | DriverResult GetAmiiboData(std::vector<u8>& data); |
| 50 | 51 | ||
| 51 | DriverResult SendStartPollingRequest(MCUCommandResponse& output); | 52 | DriverResult WriteAmiiboData(const TagUUID& tag_uuid, std::span<const u8> data); |
| 53 | |||
| 54 | DriverResult SendStartPollingRequest(MCUCommandResponse& output, | ||
| 55 | bool is_second_attempt = false); | ||
| 52 | 56 | ||
| 53 | DriverResult SendStopPollingRequest(MCUCommandResponse& output); | 57 | DriverResult SendStopPollingRequest(MCUCommandResponse& output); |
| 54 | 58 | ||
| @@ -56,8 +60,21 @@ private: | |||
| 56 | 60 | ||
| 57 | DriverResult SendReadAmiiboRequest(MCUCommandResponse& output, NFCPages ntag_pages); | 61 | DriverResult SendReadAmiiboRequest(MCUCommandResponse& output, NFCPages ntag_pages); |
| 58 | 62 | ||
| 63 | DriverResult SendWriteAmiiboRequest(MCUCommandResponse& output, const TagUUID& tag_uuid); | ||
| 64 | |||
| 65 | DriverResult SendWriteDataAmiiboRequest(MCUCommandResponse& output, u8 block_id, | ||
| 66 | bool is_last_packet, std::span<const u8> data); | ||
| 67 | |||
| 68 | std::vector<u8> SerializeWritePackage(const NFCWritePackage& package) const; | ||
| 69 | |||
| 70 | NFCWritePackage MakeAmiiboWritePackage(const TagUUID& tag_uuid, std::span<const u8> data) const; | ||
| 71 | |||
| 72 | NFCDataChunk MakeAmiiboChunk(u8 page, u8 size, std::span<const u8> data) const; | ||
| 73 | |||
| 59 | NFCReadBlockCommand GetReadBlockCommand(NFCPages pages) const; | 74 | NFCReadBlockCommand GetReadBlockCommand(NFCPages pages) const; |
| 60 | 75 | ||
| 76 | TagUUID GetTagUUID(std::span<const u8> data) const; | ||
| 77 | |||
| 61 | bool is_enabled{}; | 78 | bool is_enabled{}; |
| 62 | std::size_t update_counter{}; | 79 | std::size_t update_counter{}; |
| 63 | }; | 80 | }; |