Closed Bug 980851 Opened 6 years ago Closed 6 years ago

[NFC] Support sending and receiving NDEF messages on Emulator

Categories

(Firefox OS Graveyard :: NFC, defect)

ARM
Gonk (Firefox OS)
defect
Not set

Tracking

(tracking-b2g:backlog)

RESOLVED FIXED
2.0 S4 (20june)
tracking-b2g backlog

People

(Reporter: tzimmermann, Assigned: tzimmermann)

References

Details

(Whiteboard: [p=5])

Attachments

(3 files, 8 obsolete files)

409 bytes, text/html
dimi
: review+
Details
5.20 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
4.03 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
The NFC emulation should be able to receive and send NDEF messages. On top of this various test cases can be implemented.

For sending, a test case would send an NDEF message using the WebAPI and read the message directly from the Emulator. For receiving the test case would write a message to the Emulator and try to receive it using the WebAPI.
Depends on: 982126
Depends on: 982708
Depends on: 985415
Blocks: b2g-NFC-2.0
Blocks: 986527
No longer blocks: b2g-NFC-2.0
Attached file Latest code on github (obsolete) —
I'm going to push the latest patches into this tree on github on a regular base. The code is constantly getting rebased and refactored, so don't make your patches depend on it. ;)
Updated github tree:

  - added basic NDEF support
  - added preliminary NDEF parser and commands to console
I'm setting this to 1.4 S5 to get the receiving working. Sending and receiving might be a bit optimistic.
Target Milestone: --- → 1.4 S5 (11apr)
Comment on attachment 8396438 [details]
Latest code on github

Updated github tree:

  - reworked SNEP and NDEF support
  - implemented RE infrastructure for sending SNEP PUT commands to guest
  - implemented construction of basic NDEF messages

This is the first version of the code that injects an NDEF message into nfcd, although generating an error.
NFC isn't a 1.4 feature.
Target Milestone: 1.4 S5 (11apr) → ---
Comment on attachment 8396438 [details]
Latest code on github

Updated github tree:

  - fixed NDEF record structure
  - fixed SNEP version structure
  - fixed SNEP request construction

It should now be able to inject NDEF messages into Gecko.
Target Milestone: --- → 1.4 S5 (11apr)
Comment on attachment 8396438 [details]
Latest code on github

Updated github tree:

  - cleanups
  - LLCP 'auto-connect'

LLCP needs to establish a connection before data can be transmitted. The emulator now does this implicitly, which will simplify the implementation of test cases.
Depends on: 995202
Comment on attachment 8396438 [details]
Latest code on github

Updated github tree:

  - fixed base64 decoding
  - added SNEP PUT read mode for reading received SNEP PUTs
  - cleanups
  - moved several patches into bug 995202 for merging
blocking-b2g: --- → backlog
Whiteboard: [p=5]
Target Milestone: 1.4 S5 (11apr) → 1.4 S6 (25apr)
Comment on attachment 8396438 [details]
Latest code on github

Updated github tree:

  - added base64 encoding for outgoing strings
  - fixed JSON output of NDEF messages
  - keep track of last SAPs to simplify console interface
The test case sends and NDEF messages using NfcPeer.sendNDEF and reads back the message from the emulator. Validation is still missing.
Depends on: 945798
Depends on: 1000191, 1000063
Depends on: 1000935
This bug blocks NFC 2.0 release.
Blocks: b2g-NFC-2.0
Target Milestone: 1.4 S6 (25apr) → 2.0 S2 (23may)
Comment on attachment 8396438 [details]
Latest code on github

Landed as part of bug 1000935.
Attachment #8396438 - Attachment is obsolete: true
Comment on attachment 8408338 [details] [diff] [review]
Half-finished test case for NfcPeer.sendNDEF

Landed as part of bug 1000935.
Attachment #8408338 - Attachment is obsolete: true
I spent some time to finish this bug and add a test case. This PR has patches for qemu to make receiving in P2P mode work.
Attachment #8430102 - Flags: review?(dlee)
Mostly cleanups in preparation of the actual test case. This patch depends on bug 1016777.
Attachment #8430106 - Flags: review?(dlee)
I'm on PTO during S3, so setting milestone to S4.
Depends on: 1016777, 993836
Target Milestone: 2.0 S2 (23may) → 2.0 S4 (20june)
Attachment #8430106 - Flags: review?(dlee) → review+
Comment on attachment 8430108 [details] [diff] [review]
[02] Bug 980851: Added Marionette test case for receiving NDEF message on P2P mode

Review of attachment 8430108 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/nfc/tests/marionette/test_nfc_manager_tech_discovered_ndef.js
@@ +51,5 @@
> +SpecialPowers.pushPermissions(
> +  [{'type': 'nfc', 'allow': true,
> +                   'read': true, 'write': true, context: document},
> +   {'type': 'nfc-manager', 'allow': true, context: document},
> +   {'type': 'settings', 'allow': true, context: document}], runTests);

'setting' can be removed
Attachment #8430108 - Flags: review?(dlee) → review+
Comment on attachment 8430102 [details]
Github pull request for qemu patches

Looks good, thanks!
Attachment #8430102 - Flags: review?(dlee) → review+
Changes since v1:

  - rebased onto latest Gecko rev
Attachment #8430106 - Attachment is obsolete: true
Changes since v1:

  - rebased onto latest Gecko rev
  - don't acquire special power 'settings'
Attachment #8430108 - Attachment is obsolete: true
Attachment #8437538 - Flags: review+
Attachment #8437537 - Flags: review+
Blocks: 1023683
Depends on: 1021180
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #22)
> TBPL run:
> 
>   https://tbpl.mozilla.org/?tree=Try&rev=e784dee72656

This doesn't look good...
https://tbpl.mozilla.org/php/getParsedLog.php?id=41435201&tree=Try
Keywords: checkin-needed
Also, please try to be more conscientious which jobs you run on your Try push. "All" runs like that use a LOT of machine resources.
https://wiki.mozilla.org/Sheriffing/How:To:Recommended_Try_Practices
Changes since v2:

  - fixed syntax error in test case
Attachment #8437538 - Attachment is obsolete: true
Attachment #8439879 - Flags: review+
Changes since v3:

  - cleaned up commit message
Attachment #8439879 - Attachment is obsolete: true
Attachment #8439880 - Flags: review+
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #27)
> TBPL run:
> 
>   https://tbpl.mozilla.org/?tree=Try&rev=0f4052665e1a

Failed, but meanwhile bug 1020034 has landed. It fixes a regression that affects the NFC code. Trying again:

  https://tbpl.mozilla.org/?tree=Try&rev=ab4b97c0c6c5
Changes since v5:

  - cleaned up commit message
Attachment #8441137 - Attachment is obsolete: true
Attachment #8441294 - Flags: review+
Tests are green now.
Keywords: checkin-needed
blocking-b2g: backlog → ---
You need to log in before you can comment on or make changes to this bug.