Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to choose which sector to write to ? And store nice data to a variable ? #55

Open
wanegain3 opened this issue Dec 12, 2019 · 0 comments

Comments

@wanegain3
Copy link

Hi there !

Congrats for this nice library. I have 2 questions. Sorry for that but I couldn't find an online reference/doc somewhere beyound github.

QUESTION 1 : about writing

I am triying to write stuff to a MIFARE CLASSIC card.

I tried to use either :
ndefMessage.addTextRecord("hello, world");
or
ndefMessage.addUriRecord("http://arduino.cc");

However I need to write new stuff to prewritten tags. I would like to do it on sector 3 for example, because sector 1 already contains data. Is there any (easy) way to do this ? So far it seems to be written on sector 1 ?

QUESTION 2 : about storing data

Also when I get the records, the data begins by either a . or a .en (or a square !)
I saw the example on github to print the data to serial and it looks fine, however I need to store it into a variable. I kinda manage to do it but it looks pretty ugly. Is there a nicer way to do it ?

for(int i=0;i<message.getRecordCount();i++)
{
NdefRecord record = message.getRecord(i);
int payloadLength = record.getPayloadLength();
byte payload[payloadLength];
record.getPayload(payload);
String data = (char *)payload;
data = data.substring(3,data.length()-2);
show(data); //my own method to print to serial. Could be serial here.
}

Thanks a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant