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

Move serialNumber from NDEFMessage to NFCReadingEvent, fixes #224 #227

Merged
merged 1 commit into from
Jun 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1146,21 +1146,10 @@
</p>
<pre class="idl">
dictionary NDEFMessage {
DOMString? serialNumber;
sequence&lt;NDEFRecord&gt; records;
USVString url;
sequence&lt;NDEFRecord&gt; records;
};
</pre>
<p>
The <dfn>NDEFMessage.serialNumber</dfn>
property represents a serial number used for
anti-collision and identification, or <code>null</code> in case none is available.
</p>
<p class="note">
Though most tags will have a stable unique identifier (UID), not all
have one and some tags even create a random number on each read.
The serial number usually consists of 4 or 7 numbers, separated by <code>:</code>.
</p>
<p>
The <dfn>NDEFMessage.url</dfn>
property represents the <a>Web NFC Id</a> of a received
Expand Down Expand Up @@ -1418,10 +1407,12 @@ <h2>The <dfn>NDEFRecordType</dfn> enum</h2>

[Constructor(DOMString type, NFCReadingEventInit readingEventInitDict), SecureContext, Exposed=Window]
interface NFCReadingEvent : Event {
readonly attribute DOMString serialNumber;
readonly attribute NDEFMessage message;
};

dictionary NFCReadingEventInit : EventInit {
DOMString? serialNumber = "";
required NDEFMessage message;
};

Expand All @@ -1440,11 +1431,19 @@ <h2>The <dfn>NDEFRecordType</dfn> enum</h2>
accepted by the <a href="#dom-nfcwriter-push"><code>push()</code></a> method.
</p>
<p>
The <dfn>NFCReadingEvent</dfn> is the event being dispatched on new NFC readings,
with the <a>NDEFMessage</a> object as the <dfn>NFCReadingEvent.message</dfn>
attribute. <dfn>NFCReadingEventInit</dfn> is used in order to initialize a new
event with a the <a>NDEFMessage</a> data via the <dfn>NFCReadingEventInit.message</dfn>
member.
The <dfn>NFCReadingEvent</dfn> is the event being dispatched on new NFC readings.
The <dfn>NFCReadingEvent.serialNumber</dfn> property represents the serial number of
the device used for anti-collision and identification, or empty string in case none
is available. The <dfn>NFCReadingEvent.message</dfn> is a <a>NDEFMessage</a> object.
<dfn>NFCReadingEventInit</dfn> is used to initialize a new event with a serial number
and the <a>NDEFMessage</a> data via the <dfn>NFCReadingEventInit.message</dfn> member.
If <dfn>NFCReadingEventInit.serialNumber</dfn> is <a>not present</a> or is <dfn>null</dfn>,
empty string will be used to init the event.
</p>
<p class="note">
Though most tags will have a stable unique identifier (UID), not all
have one and some tags even create a random number on each read.
The serial number usually consists of 4 or 7 numbers, separated by <code>:</code>.
</p>
<p>
The <dfn>NFCErrorEvent</dfn> is the event being dispatched on errors,
Expand Down Expand Up @@ -2920,8 +2919,8 @@ <h3>Receiving and parsing content</h3>
numbers, or <code>null</code> if unavailable.
</li>
<li>
Set <var>message</var>'s serialNumber to the <a>string</a> of
U+003A (:) concatenating each number represented as
If <var>serialNumber</var> is not <code>null</code>, set it to the
<a>string</a> of U+003A (:) concatenating each number represented as
<a>ASCII hex digit</a>, in the same order.
</li>
<li>
Expand Down Expand Up @@ -3141,8 +3140,8 @@ <h3>Receiving and parsing content</h3>
<li>
If <a href="#nfc-is-suspended">NFC is not suspended</a> and
<var>message</var>'s records <a>is not empty</a>, run the
<a>dispatch NFC content</a> steps given <var>message</var>
and <var>compatibility</var>.
<a>dispatch NFC content</a> steps with given <var>serialNumber</var>,
<var>message</var> and <var>compatibility</var>.
</li>
</ol>
</section>
Expand Down Expand Up @@ -3184,7 +3183,8 @@ <h3>Receiving and parsing content</h3>
</li>
<li>
<a>Fire an event</a> named <code>"reading"</code> at <var>reader_instance</var>
using <a>NFCReadingEvent</a> with its <code>message</code> attribute
using <a>NFCReadingEvent</a> with its <code>serialNumber</code> attribute
initialized to <var>serialNumber</var> and <code>message</code> attribute
initialized to <var>message</var>.
</li>
</ol>
Expand Down