Closed kmoe closed 8 years ago
Took me a longer than hoped this evening as I was having some USB UART cable issues, but I was finally able to take a look at this, and after some digging, it appears the structure I used to send to ndef.decodeMessage(...)
, buffer.toJSON()
is no longer correct, and was silently raising an error within ndef.decodeMessage
. This might be from a breaking change from Node v4 as I don't think I've tested this since I went from 0.12 to 4.0 to remove the need to transpile the source.
I've updated the README and read_data.js
example, but you should just need to simply change data.toJSON()
to Array.from(data)
if you are running the example. Let me know how it goes.
Hey @techniq, thanks so much for the quick response. By using Array.from(data)
I've managed to read data from a tag I'd written from an Android app, but I'm getting errors reading from a tag I wrote to using your 'write' example. Would you mind double checking that one as well to make sure it's still working for you?
I wrote my tag using am Android app as well. Getting ready to call it a night, but I'll try to take a look tomorrow night if I get some time.
On Mon, May 23, 2016, 11:35 PM Katy Moe notifications@github.com wrote:
Hey @techniq https://github.com/techniq, thanks so much for the quick response. By using Array.from(data) I've managed to read data from a tag I'd written from an Android app, but I'm getting errors reading from a tag I wrote to using your 'write' example. Would you mind double checking that one as well to make sure it's still working for you?
— You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub https://github.com/techniq/node-pn532/issues/11#issuecomment-221158046
No problem. Thanks for your help. I've just discovered that for some reason, writing only one NDEF record causes the problem, but if I have two NDEF records it's fine. I'm happy with that workaround.
It looks like encodeMessage
requires an array to be past. When writing 1 record, were you still wrapping it in an array?
Yes, I was still passing an array.
If you could send me the logs with PN532_LOGGING=debug ...
turned on and write ndef.encodeMessage([ndef.textRecord('test')])
I can try to dig into the issue. I have a spreadsheet I wrote a while back that might help re-jog my memory on this stuff :)
Using the read_data.js example, I can't get it to show the parsed NDEF records. It correctly displays the buffer data, but the next line seems to fail silently.
I've tried with NTAG216 and various Mifare cards.
Here's the log:
Would you mind double checking this still works for you? The ndef dependency may have changed. I appreciate that this is a side project, and I'm willing to help patch things up if you need me to.