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

Support writing #23

Open
ulihecht opened this issue May 11, 2016 · 1 comment
Open

Support writing #23

ulihecht opened this issue May 11, 2016 · 1 comment

Comments

@ulihecht
Copy link

I was really happy when I found your node module for NFC. Unfortunately I need to write to NFC tags in my application, so I'm asking for write support.

As far as I know, there isn't much difference between reading and writing. Therefore I wonder if implementing write support would be much effort.

I can try implementing it on my own if you don't want to add it. In this case I'd have to use libnfc anyway. Maybe you can give me a few hints where to start.

@jeroenvollenbrock
Copy link
Collaborator

Hi there,
Currently, write support is on the roadmap, but i don't think i'll have time to implement this very soon. You could try to implement this on your own, by extending the wrapped c++ object with some write functions.

You could start by looking up some basic libnfc information, and Native abstraction for NodeJS (NaN) documentation. It might be easier to convert the NFCCard class to an objectwrapped class allowing you to keep a reference to the card pointer of libnfc, and causing the garbage collector to retain the class while its in use by the javascript environment, instead of creating a plain javascript object and copying the properties there. However, i'm not completely sure about the lifecycle flow when we do that, as i think the card is instantiated in a non-javascript thread. You could also try to create a separate write function on the NFC device instance, but i'm not sure if you have all data available in JS space to invoke this method properly.

If you have any other questions, i'm happy to answer them!

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

No branches or pull requests

2 participants