mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 07:05:40 +12:00
[NFC] Add more functions
This commit is contained in:
parent
902b2032e2
commit
00e553a120
2 changed files with 24 additions and 0 deletions
|
@ -44,7 +44,9 @@ class NFCService {
|
|||
void getTagInRangeEvent(u32 messagePointer);
|
||||
void getTagOutOfRangeEvent(u32 messagePointer);
|
||||
void getTagState(u32 messagePointer);
|
||||
void shutdown(u32 messagePointer);
|
||||
void startCommunication(u32 messagePointer);
|
||||
void startTagScanning(u32 messagePointer);
|
||||
void stopCommunication(u32 messagePointer);
|
||||
|
||||
public:
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
namespace NFCCommands {
|
||||
enum : u32 {
|
||||
Initialize = 0x00010040,
|
||||
Shutdown = 0x00020040,
|
||||
StartCommunication = 0x00030000,
|
||||
StopCommunication = 0x00040000,
|
||||
StartTagScanning = 0x00050040,
|
||||
GetTagInRangeEvent = 0x000B0000,
|
||||
GetTagOutOfRangeEvent = 0x000C0000,
|
||||
GetTagState = 0x000D0000,
|
||||
|
@ -32,7 +34,9 @@ void NFCService::handleSyncRequest(u32 messagePointer) {
|
|||
case NFCCommands::GetTagInRangeEvent: getTagInRangeEvent(messagePointer); break;
|
||||
case NFCCommands::GetTagOutOfRangeEvent: getTagOutOfRangeEvent(messagePointer); break;
|
||||
case NFCCommands::GetTagState: getTagState(messagePointer); break;
|
||||
case NFCCommands::Shutdown: shutdown(messagePointer); break;
|
||||
case NFCCommands::StartCommunication: startCommunication(messagePointer); break;
|
||||
case NFCCommands::StartTagScanning: startTagScanning(messagePointer); break;
|
||||
case NFCCommands::StopCommunication: stopCommunication(messagePointer); break;
|
||||
default: Helpers::panic("NFC service requested. Command: %08X\n", command);
|
||||
}
|
||||
|
@ -50,6 +54,16 @@ void NFCService::initialize(u32 messagePointer) {
|
|||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
||||
|
||||
void NFCService::shutdown(u32 messagePointer) {
|
||||
log("MFC::Shutdown");
|
||||
const u8 mode = mem.read8(messagePointer + 4);
|
||||
|
||||
Helpers::warn("NFC::Shutdown: Unimplemented mode: %d", mode);
|
||||
|
||||
mem.write32(messagePointer, IPC::responseHeader(0x2, 1, 0));
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
||||
|
||||
/*
|
||||
The NFC service provides userland with 2 events. One that is signaled when an NFC tag gets in range,
|
||||
And one that is signaled when it gets out of range. Userland can have a thread sleep on this so it will be alerted
|
||||
|
@ -114,6 +128,14 @@ void NFCService::startCommunication(u32 messagePointer) {
|
|||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
||||
|
||||
void NFCService::startTagScanning(u32 messagePointer) {
|
||||
log("NFC::StartTagScanning\n");
|
||||
tagStatus = TagStatus::Scanning;
|
||||
|
||||
mem.write32(messagePointer, IPC::responseHeader(0x5, 1, 0));
|
||||
mem.write32(messagePointer + 4, Result::Success);
|
||||
}
|
||||
|
||||
void NFCService::stopCommunication(u32 messagePointer) {
|
||||
log("NFC::StopCommunication\n");
|
||||
adapterStatus = Old3DSAdapterStatus::InitializationComplete;
|
||||
|
|
Loading…
Add table
Reference in a new issue