W3C home > Mailing lists > Public > public-nfc@w3.org > October 2014

Writing to NFC Tags

From: Don Coleman <dcoleman@chariotsolutions.com>
Date: Mon, 27 Oct 2014 20:31:42 -0700
Message-ID: <CAK5tL-jEvSEdcH-qP70LwMzWRT1=RekkutDY4q_B9DAqUpX5cQ@mail.gmail.com>
To: "public-nfc@w3.org" <public-nfc@w3.org>
The NfcManager should handle the write methods, rather than relying on a
NfcTag object. The NfcTag object should only contain information about a
NfcTag that was read. Some platforms (Windows Phone 8, BlackBerry 10
WebWorks) only provide NDEF information and don't provide tag details.

write should take an array of NdefRecords

A tag must be in range when a when write is called, so this should be
called inside the nfc.onmessage function.

nfc.onmessage = function(nfcEvent) {

var ndefMessage = [
new NDEFRecordText("hello world", "en-US", "UTF-8");
]
 // success is called when the message is written
// error is called if something fails
promise = nfc.write(ndefMessage);
}

NfcManager needs additional methods like nfc.makeTagReadOnly();
Received on Tuesday, 28 October 2014 03:32:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:43:37 UTC