WebAPI/WebNFC: Difference between revisions
< WebAPI
Jump to navigation
Jump to search
Allstars.chh (talk | contribs) |
|||
(26 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
= Introduction = | = Introduction = | ||
== Current Status (As to Firefox OS | == Current Status (As to Firefox OS v2.2) == | ||
* Gecko meta bug, {{bug|860906}} | * Gecko b2g-nfc meta bug, {{bug|860906}} | ||
* Gecko b2g-secure-element meta bug {{bug|1044428}} | |||
* Gaia meta bug, {{bug|933640}} | * Gaia meta bug, {{bug|933640}} | ||
* nfcd meta bug, {{bug|1044425}} | |||
* Gonk | * Gonk | ||
** Use a native daemon nfcd which links to native NFC library. [https://github.com/mozilla-b2g/platform_system_nfcd nfcd github] | ** Use a native daemon nfcd which links to native NFC library. [https://github.com/mozilla-b2g/platform_system_nfcd nfcd github] | ||
* Hardware | * Hardware | ||
** Using Nexus-4, which uses Broadcom NFC chipset with libnfc-nci library. | ** Using Nexus-4/Nexus-5, which uses Broadcom NFC chipset with libnfc-nci library. | ||
** Flame, NXP chipsets with libnfc-nci library. | |||
== Security Review (By Paul Theriault) == | == Security Review (By Paul Theriault and Stephanie Ouillon) == | ||
* https://wiki.mozilla.org/Security/Reviews/B2G/WebNFC | * https://wiki.mozilla.org/Security/Reviews/B2G/WebNFC | ||
* {{bug|948280}} | * Security Review for WebNFC: {{bug|749325}} | ||
* {{bug| | * Security Review for NFC Payment: {{bug|948280}} | ||
* Security Review for NFC privilege API: {{bug|1095417}} | |||
== Contributors == | == Contributors == | ||
Line 39: | Line 43: | ||
== Second iteration: Handover and other bug fixes (Firefox OS v1.4) == | == Second iteration: Handover and other bug fixes (Firefox OS v1.4) == | ||
* meta bug : {{Bug|949293}} - (b2g-NFC-1.4) [meta] FxOS v1.4 NFC feature | * meta bug : {{Bug|949293}} - (b2g-NFC-1.4) [meta] FxOS v1.4 NFC feature | ||
* Capabilities: | * Capabilities: | ||
** {{bug|933093}} NFC handover. | ** {{bug|933093}} NFC handover. | ||
Line 48: | Line 50: | ||
*** {{Bug|959437}} - Refactor NfcManager APIs and implementation details to support sendFile , notifyUserAcceptedP2P and other privileged Nfc operations | *** {{Bug|959437}} - Refactor NfcManager APIs and implementation details to support sendFile , notifyUserAcceptedP2P and other privileged Nfc operations | ||
== Third iteration: Secure Element (Firefox OS | == Third iteration: NFC Sharing feature, P2P, emulator support, test cases (Firefox OS v2.0) == | ||
* meta bug : {{Bug|949293}} - (b2g-NFC-2.0) [meta] FxOS v2.0 NFC feature | |||
* NFC emulator: {{Bug|973133}} | |||
* More Gaia unit tests for NFC in apps/system/test/unit/ | |||
== Fourth iteration: HCI transaction event (Firefox OS v2.1) == | |||
* {{bug|979767}} | |||
== Fifth iteration: Secure Element and NFC Privileged API (Firefox OS v2.2) == | |||
* {{bug|1044428}} b2g-secure-element | |||
** {{Bug|879861}} - NFC Secure Element Support | ** {{Bug|879861}} - NFC Secure Element Support | ||
* {{Bug|1042851}} - (b2g-nfc-privilege) (meta) [NFC] Make NFC APIs available to privileged webapps | |||
** Slide: http://bit.ly/1x7nWp5 | |||
= Current API = | = Current API = | ||
Check DXR for latest NFC IDL | |||
* [https://dxr.mozilla.org/mozilla-central/source/dom/webidl/MozNDEFRecord.webidl MozNDEFRecord.webidl] | |||
* [https://dxr.mozilla.org/mozilla-central/source/dom/webidl/MozNFC.webidl MozNFC.webidl] | |||
* [https://dxr.mozilla.org/mozilla-central/source/dom/webidl/MozNFCPeer.webidl MozNFCPeer.webidl] | |||
* [https://dxr.mozilla.org/mozilla-central/source/dom/webidl/MozNFCPeerEvent.webidl MozNFCPeerEvent.webidl] | |||
* [https://dxr.mozilla.org/mozilla-central/source/dom/webidl/MozNFCTag.webidl MozNFCTag.webidl] | |||
* [https://dxr.mozilla.org/mozilla-central/source/dom/webidl/MozNFCTagEvent.webidl MozNFCTagEvent.webidl] | |||
[https:// | |||
= Usage of APIs = | = Usage of APIs = | ||
https://developer.mozilla.org/en-US/docs/Web/API/NFC_API | |||
= Application Permissions = | = Application Permissions = | ||
NFC API | NFC API has three permissions. | ||
* '''nfc''', which will be used by privileged applications. | |||
* '''nfc-share''', which will be used by ceritified(internal) applications. | |||
* '''nfc-manager', which will be used by System app. | |||
'''nfc''' permission could be used for general tag reading/writing, or sending NDEF to NFC Peer. | |||
'''nfc-share''' could be used to send large file (Blob) to another NFC peer. | |||
'''nfc-manager''' is used to control the RF state of NFC hardware. | |||
'' | |||
= Application Dispatch Order = | = Application Dispatch Order = | ||
1) Foreground App, if the callback ontagfound/onpeerfound is set. | |||
2) If the foreground app doesn't register NFC callbacks or cannot process the event, the event will be redirected to System app, and System app will fire a nfc-ndef-discovered MozActivity. | |||
= NFC on B2G emulator = | |||
* See Kami's notes : https://bitbucket.org/kamituel/b2g-notepad/wiki/Using%20emulator | |||
= NFC Resources = | = NFC Resources = | ||
Line 379: | Line 101: | ||
* NDEF specification: NFCForum-TS-NDEF_1.0.pdf | * NDEF specification: NFCForum-TS-NDEF_1.0.pdf | ||
* Understand NDEF messages : http://developer.nokia.com/Community/Wiki/Inside_NFC:_Understanding_NDEF_message | * Understand NDEF messages : http://developer.nokia.com/Community/Wiki/Inside_NFC:_Understanding_NDEF_message | ||
* NFC forum | * NFC forum specifications: http://members.nfc-forum.org/specs/ | ||
* Handover specification: NFCForum-TS-ConnectionHandover_1_2.pdf | * Handover specification: NFCForum-TS-ConnectionHandover_1_2.pdf | ||
Line 386: | Line 108: | ||
* Tizen NFC API: https://developer.tizen.org/dev-guide/2.2.0/org.tizen.web.device.apireference/tizen/nfc.html | * Tizen NFC API: https://developer.tizen.org/dev-guide/2.2.0/org.tizen.web.device.apireference/tizen/nfc.html | ||
* Android NFC API: http://developer.android.com/reference/android/nfc/package-summary.html | * Android NFC API: http://developer.android.com/reference/android/nfc/package-summary.html | ||
[[Category:Web APIs]] |
Latest revision as of 05:16, 16 March 2015
Introduction
Current Status (As to Firefox OS v2.2)
- Gecko b2g-nfc meta bug, bug 860906
- Gecko b2g-secure-element meta bug bug 1044428
- Gaia meta bug, bug 933640
- nfcd meta bug, bug 1044425
- Gonk
- Use a native daemon nfcd which links to native NFC library. nfcd github
- Hardware
- Using Nexus-4/Nexus-5, which uses Broadcom NFC chipset with libnfc-nci library.
- Flame, NXP chipsets with libnfc-nci library.
Security Review (By Paul Theriault and Stephanie Ouillon)
- https://wiki.mozilla.org/Security/Reviews/B2G/WebNFC
- Security Review for WebNFC: bug 749325
- Security Review for NFC Payment: bug 948280
- Security Review for NFC privilege API: bug 1095417
Contributors
- Gecko Engineers: Arno Puder, Garner Lee, Siddartha Pothapragada, Yoshi Huang, Dimi Lee
- Early Contributors: Markus Neubrand, Philipp von Weitershausen
Roadmap
First iteration: NDEF (Firefox OS v1.3)
- meta bug, bug 959692 - (b2g-NFC-1.3) [meta] FxOS v1.3 NFC feature
- Technologies:
- Focus on NDEF standard only for now
- Others (e.g. proprietary MIFARE) to be investigated later.
- Capabilities:
- Read/write NDEF records on tags
- bug 933136 - [Gecko] NFC onpeerready, onpeerlost callbacks
- Implementation:
- See bug 674741
- NDEF-only API is available on MozNFCTag object.
- Discovered NDEF tags are automatically parsed and dispatched to content in the "nfc-manager-tech-discovered" system message.
- navigator.mozNfc only available to a specific privileged content page (cf. WebTelephony, WebSMS).
- For now, content is expected to do filtering and dispatching to handlers e.g. via WebActivity.
- Gonk
- bug 906579 - B2G NFC: NFC Daemon for supporting libnfc-nci
- Hardware
- Using Nexus-4, which uses Broadcom NFC chipset with libnfc-nci library.
Second iteration: Handover and other bug fixes (Firefox OS v1.4)
- meta bug : bug 949293 - (b2g-NFC-1.4) [meta] FxOS v1.4 NFC feature
- Capabilities:
- bug 933093 NFC handover.
- bug 916863 - [NFC] NFC support in emulator
- NFC Manager API
- bug 952217 - [B2G][NFC] Have a separate NFC application API and NFC Manager API
- bug 959437 - Refactor NfcManager APIs and implementation details to support sendFile , notifyUserAcceptedP2P and other privileged Nfc operations
Third iteration: NFC Sharing feature, P2P, emulator support, test cases (Firefox OS v2.0)
- meta bug : bug 949293 - (b2g-NFC-2.0) [meta] FxOS v2.0 NFC feature
- NFC emulator: bug 973133
- More Gaia unit tests for NFC in apps/system/test/unit/
Fourth iteration: HCI transaction event (Firefox OS v2.1)
Fifth iteration: Secure Element and NFC Privileged API (Firefox OS v2.2)
- bug 1044428 b2g-secure-element
- bug 879861 - NFC Secure Element Support
- bug 1042851 - (b2g-nfc-privilege) (meta) [NFC] Make NFC APIs available to privileged webapps
- Slide: http://bit.ly/1x7nWp5
Current API
Check DXR for latest NFC IDL
- MozNDEFRecord.webidl
- MozNFC.webidl
- MozNFCPeer.webidl
- MozNFCPeerEvent.webidl
- MozNFCTag.webidl
- MozNFCTagEvent.webidl
Usage of APIs
https://developer.mozilla.org/en-US/docs/Web/API/NFC_API
Application Permissions
NFC API has three permissions.
- nfc, which will be used by privileged applications.
- nfc-share, which will be used by ceritified(internal) applications.
- nfc-manager', which will be used by System app.
nfc permission could be used for general tag reading/writing, or sending NDEF to NFC Peer. nfc-share could be used to send large file (Blob) to another NFC peer. nfc-manager is used to control the RF state of NFC hardware.
Application Dispatch Order
1) Foreground App, if the callback ontagfound/onpeerfound is set. 2) If the foreground app doesn't register NFC callbacks or cannot process the event, the event will be redirected to System app, and System app will fire a nfc-ndef-discovered MozActivity.
NFC on B2G emulator
- See Kami's notes : https://bitbucket.org/kamituel/b2g-notepad/wiki/Using%20emulator
NFC Resources
Reference
- Introduction to NFC: http://www.adafruit.com/datasheets/Introduction_to_NFC_v1_0_en.pdf
- NDEF specification: NFCForum-TS-NDEF_1.0.pdf
- Understand NDEF messages : http://developer.nokia.com/Community/Wiki/Inside_NFC:_Understanding_NDEF_message
- NFC forum specifications: http://members.nfc-forum.org/specs/
- Handover specification: NFCForum-TS-ConnectionHandover_1_2.pdf