I want to communicate with android by pn532.
I'm sure I've successfully sent NDEF messages using SNEP protocol, because my mobile phone has sensed response. And when I send a URL, my phone can open the web page。
But I don't know how to send NDEF message to PN532, and how to read all kind of NDEF messages using Android
and I can't communicate with nfc taginfo this app, It will have problems with LLCP protocol, although it seems support NDEF.
Are there any apps to show and send NDEF message in Android?
can you help me i face same problem?
Hello @socialismbuilder ,
For Android NFC application, there is a UM on this topic, please kindly refer to https://www.nxp.com/docs/en/user-guide/UM10989.pdf for details.
Hope that helps,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
here is a small part of programs of my project, to show my train of thought.
char b[] = "http://www.googlle.com";
NM_addUriRecord(ndef,(u8*)b,sizeof(b));
uint16_t messageSize = NM_getEncodedSize(ndef);
NM_encode(ndef,ndefBuf);
for(;;)
{
u8 a = snep.write(ndefBuf,messageSize,60000);
delay_ms(2000);
}
int16_t SNEP_write(const uint8_t *buf, uint8_t len, uint16_t timeout)
{
debug("\r\nSNEP active");
if (0 >= snep.llcp->activate(timeout)) {
debug("\r\nSnep failed to activate PN532 as a target\r\n");
return -1;
}
debug("\r\nSnep successed to activate PN532 as a target\r\n");
if (0 >= snep.llcp->connect(timeout)) {
debug("\r\nSnep failed to set up a connection\r\n");
return -2;
}
debug("\r\nSNEP successed to set up a connection\r\n");
// response a success SNEP message
snep.headerBuf[0] = SNEP_DEFAULT_VERSION;
snep.headerBuf[1] = SNEP_REQUEST_PUT;
snep.headerBuf[2] = 0;
snep.headerBuf[3] = 0;
snep.headerBuf[4] = 0;
snep.headerBuf[5] = len;
if (0 >= snep.llcp->write(snep.headerBuf, 6, buf, len)) {
debug("\r\nsnep write failed\r\n");
return -3;
}
debug("\r\nsnep write successed\r\n");
uint8_t rbuf[16];
if (6 > snep.llcp->read(rbuf, sizeof(rbuf))) {
debug("\r\nsnep read failed\r\n");
return -4;
}
// check SNEP version
if (SNEP_DEFAULT_VERSION != rbuf[0]) {
debug("\r\nThe received SNEP message's major version is different\r\n");
return -4;
}
// expect a put request
if (SNEP_RESPONSE_SUCCESS != rbuf[1]) {
debug("\r\nSNEP Expect a success response\r\n");
return -4;
}
debug("\r\nsnep read successed\r\n");
if(snep.llcp->disconnect(timeout))
{
debug("\r\nsnep disconect successful\r\n");
}
else
{
debug("\r\nsnep disconect fail\r\n");
}
return 1;
}