Using NFC Field to Initialize atmega328p

Hello everyone,

Im planning to initialize or restart the atmega328p when my mobile phone ( or any nfc reader ) exists in the field of NFC. Of course, im planning to do it only for once, once the system is initialized, the data will be read from the NFC, no more initialization issues.

Which method can i use ?

I have functions like :

message.addTextRecord(string);
m24sr.writeNdefMessage(&message);

Is it possible to use these functions in if statement ?. I mean, If there is something added to record, restart the system ?

Also, i have a function to get system properties.

m24sr.displaySystemFile();

It writes UID and memory infos on the serial monitor. However, i want to add the UID info to the record. How can i extract the UID info as string from the function ?

Thank you so much.

Is it possible to use these functions in if statement ?

In the body of an if statement, or in the condition part of the if statement?

I mean, If there is something added to record, restart the system ?

Your random sentence generator needs some work.

How can i extract the UID info as string from the function ?

Its your function. You tell us. Or show us the damned thing...

In the body of an if statement, or in the condition part of the if statement?

I mean in the condition part like:

if(message.addTextRecord(string) == DONE)
{
initialize
}

Forgive me, since im new in such things, i might forget something. Im using the library that pylon shared in this link: [SOLVED] I2C communication with an M24SR64-Y NFC tag - Networking, Protocols, and Devices - Arduino Forum

I mean in the condition part like

Does message.addTextRecord() return a value that makes sense to use in an if conditional?

I don't know what message is an instance of, but the NdefMessage class has such a method, that that method's return type is void, so you can't compare the return value to DONE (however DONE is defined).