w3c / web-nfc

Web NFC
https://w3c.github.io/web-nfc/
Other
313 stars 69 forks source link

Should we ignore NDEFMessage.serialNumber for NFCWriter::push()? #224

Closed DonnaWuDongxia closed 5 years ago

DonnaWuDongxia commented 5 years ago

An attribute |serialNumber| has been added to NDEFMessage dictionary, and it seems only meaningful to NFCReadingEvent. According to the the push method in Spec, |serialNumber| in NDEFMessage passed to NFCWriter::push() will be ignored. Should we make a clear statement about this?

kenchris commented 5 years ago

Yes, you cannot write the serialnumber.

kenchris commented 5 years ago
dictionary NDEFMessage {
  DOMString? serialNumber;
  sequence<NDEFRecord> records;
  USVString url;
};

NDEFMessage should be renamed NFCMessage. Maybe it is possible to do

dictionary NDEFMessage {
  sequence<NDEFRecord> records;
  USVString url;
};

dictionary NFCMessage : NDEFMessage {
  DOMString? serialNumber;
}
DonnaWuDongxia commented 5 years ago

Two types of message may make it confusing for developers. As the |serialNumber| is only meaningful to NFCReadingEvent, how about move the this attribute to this event, making the NDEFMessage more clean. interface NFCReadingEvent : Event { DOMString serialNumber; readonly attribute NDEFMessage message; };

dictionary NDEFMessage { sequence records; USVString url; };

I think |serialNumber| maybe don't need to be nullable because string can be empty. Is it definite to rename NDEFMessage to NFCMessage?

zolkis commented 5 years ago

The UID is not part of NDEF messages, so I would support moving out the tag specific (low-level) information from NDEF message structure. We could indeed put it to the read event - however, I wonder whether should we generalize this and define a separate structure/interface for low level tag/adapter info, UID (serial number) being one property in that.

Anyway, at the moment the above proposal looks good to me.