NDEF record received has bug :
My Tag has write data(1234567890)
The example code is always read data as below:
---------------------------------------------------------------------------
Running the NXP-NCI2.0 example.
WAITING FOR DEVICE DISCOVERY
- POLL MODE: Remote T2T activated
SENS_RES = 0x44 0x0
NFCID = 04 70 1d a2 a5 70 80
SEL_RES = 0x0
--- NDEF record received:
Text record: 1234567
CARD REMOVED
WAITING FOR DEVICE DISCOVERY
---------------------------------------------------------------------------
The wrong code on here :
nfc_example_RWandCE.c
void NdefPull_Cb(unsigned char *pNdefMessage, unsigned short ReceivedSize, unsigned int NdefMessageSize)
{
...
case WELL_KNOWN_SIMPLE_TEXT:
{
save = NdefRecord.recordPayload[NdefRecord.recordPayloadSize];
NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = '\0';
PRINTF(" Text record: %s\n", &NdefRecord.recordPayload[NdefRecord.recordPayload[0]+1]);
NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = save;
}
break;
...
}
When I print the data before and after, the '\0' is put wrong place. (38 ---> 00)
NdefRecord.recordPayload : 02 65 6e 31 32 33 34 35 36 37 38 39 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...
Text record: 1234567
NdefRecord.recordPayload : 02 65 6e 31 32 33 34 35 36 37 00 39 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...
My modify code as below :
int eol = NdefRecord.recordPayload[0]+1+NdefRecord.recordPayloadSize;
save = NdefRecord.recordPayload[eol];
NdefRecord.recordPayload[eol] = '\0';
PRINTF(" Text record: %s\n", &NdefRecord.recordPayload[NdefRecord.recordPayload[0]+1]);
NdefRecord.recordPayload[eol] = save;
The test result as below :
---------------------------------------------------------------------------
Running the NXP-NCI2.0 example.
WAITING FOR DEVICE DISCOVERY
- POLL MODE: Remote T2T activated
SENS_RES = 0x44 0x0
NFCID = 04 70 1d a2 a5 70 80
SEL_RES = 0x0
--- NDEF record received:
Text record: 1234567890
CARD REMOVED
WAITING FOR DEVICE DISCOVERY
---------------------------------------------------------------------------