Skip to content

NFC Documentation #691

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

Merged
merged 19 commits into from
Sep 4, 2018
Merged

NFC Documentation #691

merged 19 commits into from
Sep 4, 2018

Conversation

donatieng
Copy link
Contributor

This is the associated docs PR for ARMmbed/mbed-os#7822

Copy link
Contributor

@AnotherButler AnotherButler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to move any architecture content to create the technology page.

};
```

#### NFC controller
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are separate APIs, they should each get their own page and description.

A detailed design document is available [within the Mbed OS source tree](https://github.com/ARMmbed/mbed-os/docs/design-documents/nfc/nfc_design.md). It details the rationale behind the API design.

[explorenfc_nucleo]: explorenfc_nucleo.jpg
[n_mark]: n_mark.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: Do we have an example created for NFC?


Mbed OS supports the card emulation mode, either through the use of a controller or NFC EEPROM.

NFC support is available for the NXP PN512 transceiver. In terms of NFC EEPROMs, a driver for the ST M24SR EEPROM series is available - we also provide a [porting guide](https://os.mbed.com/contributing/connectivity/NFCEEPROMDriver.html) to add support for other NFC EEPROMs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the first part of this, so what we support doesn't quickly become out of date.


### Getting started with NFC and example

NFC examples are available on [GitHub](https://github.com/ARMmbed/mbed-os-example-nfc) and demonstrate how to create NFC tags that you can be read from and write to using a phone.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Delete extra word.


### Design

A detailed design document is available [within the Mbed OS source tree](https://github.com/ARMmbed/mbed-os/docs/design-documents/nfc/nfc_design.md). It details the rationale behind the API design.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is broken, and I can't seem to find where to go to replace it. Could you please point me to the right one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's this one - the link above will become valid once the PR is merged in :)
https://github.com/donatieng/mbed-os/blob/nfc-spec/docs/design-documents/nfc/nfc_design.md

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is really good content here. I'd love to see this is the technology section.

@MarceloSalazar
Copy link
Contributor

The docs is looking good.
I feel some of the content in the intro belongs to the technology section?

Also, would be nice to update the photo "explorenfc_nucleo.jpg" as it looks a bit messy with many cables and can't see much details on the NFC shield.

Copy link
Contributor

@AnotherButler AnotherButler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look really good, @donatieng

I left a few comments for you to address.


An application can extend capabilities of `SimpleMessageParser` by adding new record parsers (`mbed::nfc::ndef::RecordParser`) at runtime.

[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/FIXME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Add correct link after code merges.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it makes sense to add this code at it is, or should we let users import it?
Maybe this code is already available in the mbed-os-example-nfc application?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have any parsing in our examples yet plus 60 lines of well focused code that demonstrate the API are different than an example which just solves a specific use case with the whole NFC API.

Technology examples and API demonstrations are different beasts.

}
```

[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/FIXME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Add correct link after code merges.


### NFC controller class reference

[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/FIXME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Add correct link after code merges.


### NFC EEPROM class reference

[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/FIXME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Add correct link after code merges.

@@ -0,0 +1,106 @@
### NDEF API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this file. Nice work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's Copyright @pan- :)

@@ -0,0 +1,49 @@
## NFC controller

To use an NFC controller, you must initiate the instance with a driver instance, an event queue and a scratch buffer for NDEF messages.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tells us how to use it but doesn't say what it is. Could we add a sentence saying what this is and when/why you'd want to use it?

@@ -0,0 +1,28 @@
## NFC EEPROM

To use an NFC controller, you must initiate the instance with a driver instance, an event queue and a scratch buffer for NDEF messages.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how this sentence about an NFC controller ties in to this page about NFC EEPROM. Could we say what NFC EEPROM is, what it stands for and when/why you'd want to use it?

@AnotherButler
Copy link
Contributor

Note to self: Fix Doxy links after code merges, and upload images after doc merges.

@AnotherButler
Copy link
Contributor

@donatieng Could you also resolve the merge conflicts when you're finished with your changes?

using mbed::nfc::ndef::common::SimpleMessageParser;

void parse_ndef_message(const Span<const uint8_t> &buffer) {
SimpleMessageParser parser;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of these functions?
Are they included in Mbed OS, or something that a developer will need to copy & paste in their application?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line above the code it is indicated that mbed::nfc::ndef::common::SimpleMessageParser is part of the API provided.

The code just demonstrate how to use this class to parse an NDEF message.

using mbed::nfc::ndef::common::URI;

size_t build_ndef_message(const Span<uint8_t> &buffer) {
MessageBuilder builder(buffer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question for this function.
Is this included in Mbed OS or should the developer include this code in their app?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, it is explicitly that mbed::nfc::ndef::MessageBuilder is part of the API mbed OS provide.

It just demonstrate how an application can create an NDEF message.

Amanda Butler added 2 commits August 31, 2018 10:03
Change passive to active voice.
Copy edit for active voice.
@AnotherButler
Copy link
Contributor

@donatieng Thanks for making those changes 👍

@AnotherButler
Copy link
Contributor

Note to self: Add pages to .json after merging.

@AnotherButler
Copy link
Contributor

@donatieng I can't find the APIs in the Doxygen. Could you please help me?

Amanda Butler added 3 commits September 4, 2018 07:11
Fix missing link.
Fix missing link.
Add missing links.
@AnotherButler AnotherButler merged commit 68a670a into ARMmbed:development Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants