Closed
Bug 1086179
Opened 10 years ago
Closed 10 years ago
Add a format API to MozNFCTag
Categories
(Firefox OS Graveyard :: NFC, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: allstars.chh, Assigned: jhao)
References
Details
Attachments
(2 files, 3 obsolete files)
97.40 KB,
application/x-sharedlib
|
Details | |
12.47 KB,
patch
|
Details | Diff | Splinter Review |
In bug 1074611 we can know if the tag is formatable or not.
We should add a API for 'formatting NDEF' on the tag, and if the tag is not formatable this method should throw.
Reporter | ||
Updated•10 years ago
|
Assignee: nobody → allstars.chh
Reporter | ||
Updated•10 years ago
|
Assignee: allstars.chh → nobody
Reporter | ||
Updated•10 years ago
|
No longer blocks: b2g-nfc-privilege
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → jhao
Assignee | ||
Comment 1•10 years ago
|
||
I have imitated the api "makeReadOnly" and fill corresponding code for format(). As I am not familiar with both WebIDL and NFC, I need Dimi to help me check if I'm on the right track.
Flags: needinfo?(dlee)
Comment 2•10 years ago
|
||
Comment on attachment 8522861 [details] [diff] [review]
Working-in-progress patch
Review of attachment 8522861 [details] [diff] [review]:
-----------------------------------------------------------------
Hi Jonathan,
Looks good, thanks! I will provide nfcd for you to test later.
Once the test is complete, please find yoshi to review this patch.
::: dom/nfc/gonk/NfcGonkMessage.h
@@ +23,5 @@
> enum NfcResponse {
> GeneralRsp = 1000,
> PowerRsp,
> ReadNDEFRsp,
> };
In this file, there is a define named NFCD_MINOR_VERSION, when the binary protocol is changed between
b2g process and nfcd, we will update it. You could increase it to 16 in this patch.
::: dom/nfc/nsINfcContentHelper.idl
@@ +77,5 @@
>
> nsIDOMDOMRequest readNDEF(in DOMString sessionToken);
> nsIDOMDOMRequest writeNDEF(in nsIVariant records, in DOMString sessionToken);
> nsIDOMDOMRequest makeReadOnly(in DOMString sessionToken);
> + nsIDOMDOMRequest format(in DOMString sessionToken);
please also update the uuid
Attachment #8522861 -
Flags: feedback+
Updated•10 years ago
|
Flags: needinfo?(dlee)
Comment 3•10 years ago
|
||
Assignee | ||
Comment 4•10 years ago
|
||
I have tested with the following code in gaia/apps/system/js/nfc_handler.js
> NfcHandler.prototype = {
> start: function nh_start() {
> if (window.navigator.mozNfc) {
> window.navigator.mozNfc.onpeerready = this.handleEvent.bind(this);
> window.navigator.mozNfc.ontagfound = function (evt) {
> dump('ontagfound');
> var req = evt.tag.format();
> req.onsuccess = function () { dump('format successfully'); };
> req.onerror = function () { dump('format error'); };
> };
> }
> },
and in the log we can see the format is successful.
> I/GeckoDump(27614): format successfully
Attachment #8522861 -
Attachment is obsolete: true
Attachment #8523797 -
Flags: review?(allstars.chh)
Reporter | ||
Comment 5•10 years ago
|
||
Comment on attachment 8523797 [details] [diff] [review]
Add format API
Review of attachment 8523797 [details] [diff] [review]:
-----------------------------------------------------------------
Please update the patch subject.
Forward r? to smaug for WebIDL change in MozNFCTag.webidl.
Attachment #8523797 -
Flags: review?(bugs)
Attachment #8523797 -
Flags: review?(allstars.chh)
Attachment #8523797 -
Flags: review+
Comment 6•10 years ago
|
||
Comment on attachment 8523797 [details] [diff] [review]
Add format API
Would it be useful to have a boolean attribute which tells whether the Tag is formattable?
Attachment #8523797 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 7•10 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #6)
> Comment on attachment 8523797 [details] [diff] [review]
> Add format API
>
> Would it be useful to have a boolean attribute which tells whether the Tag
> is formattable?
Hi Olli, I think what you proposed is already in MozNFCTag.webidl.
http://dxr.mozilla.org/mozilla-central/source/dom/webidl/MozNFCTag.webidl?from=moznfctag.webidl#62
Assignee | ||
Comment 8•10 years ago
|
||
Add patch subject.
Attachment #8523797 -
Attachment is obsolete: true
Assignee | ||
Comment 9•10 years ago
|
||
Add "return true;" in the end of NfcMessageHandler::FormatRequest()
Attachment #8524211 -
Attachment is obsolete: true
Comment 10•10 years ago
|
||
(In reply to Jonathan Hao [:jhao] from comment #7)
>
> Hi Olli, I think what you proposed is already in MozNFCTag.webidl.
> http://dxr.mozilla.org/mozilla-central/source/dom/webidl/MozNFCTag.
> webidl?from=moznfctag.webidl#62
So it is!
Assignee | ||
Comment 11•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Reporter | ||
Comment 12•10 years ago
|
||
Keywords: checkin-needed
Comment 13•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Reporter | ||
Updated•10 years ago
|
Blocks: b2g-nfc-privilege
You need to log in
before you can comment on or make changes to this bug.
Description
•