O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Beginning NFC

Book Description

Jump into the world of Near Field Communications (NFC), the fast-growing technology that lets devices in close proximity exchange data, using radio signals. With lots of examples, sample code, exercises, and step-by-step projects, this hands-on guide shows you how to build NFC applications for Android, the Arduino microcontroller, and embedded Linux devices.

Table of Contents

  1. Dedication
  2. 1. Introduction
    1. Who This Book Is For
    2. Recommended Reading
    3. What’s Covered in This Book
    4. What You’ll Need
      1. Hardware
      2. Software
      3. Other Useful NFC Apps
    5. Conventions Used in This Book
    6. Using Code Examples
    7. Safari® Books Online
    8. How to Contact Us
    9. Acknowledgments
  3. 2. NFC and RFID
    1. What’s RFID?
    2. What’s NFC?
    3. How RFID Operates
      1. RFID Standards
    4. How NFC Operates
      1. NFC Data Exchange Format (NDEF)
    5. The Architecture of NFC
      1. NFC Tag Types
      2. Where to Get Tags
    6. Device-to-Tag Type Matching
    7. What You Can Do with NFC
    8. Conclusion
  4. 3. Getting Started with PhoneGap and the PhoneGap-NFC Library
    1. Why Android?
    2. Hello, World! Your First PhoneGap App
      1. Setting Up the Development Environment
        1. Install the Android Platform Tools
        2. Install Node.js and npm
        3. Install Cordova CLI for PhoneGap
      2. Creating a PhoneGap Project
      3. The Important Files
    3. A Simple Locator App
    4. PhoneGap Meets NFC: NFC Reader
      1. Installing the NFC Plug-In
      2. Writing the NFC Reader App
      3. Troubleshooting
    5. Conclusion
  5. 4. Introducing NDEF
    1. NDEF Structure
      1. Type Name Format
      2. Payload Type
        1. URIs in NDEF Messaging
      3. Payload Identifier
      4. Payload
    2. Record Layout
      1. Record Header
      2. How Big Can an NDEF Message Be?
      3. Record Chunking
      4. Additional Info
    3. NDEF in Practice
    4. A Tag Writer Application: Foursquare Check-In
      1. Writing an NDEF Record to a Tag
      2. Writing Different Record Types
      3. PhoneGap-NFC NDEF Helper Functions, Summarized
    5. Conclusion
  6. 5. Listening for NDEF Messages
    1. PhoneGap-NFC’s Event Listeners
    2. An NDEF Reader Application
      1. Listening for Multiple Events
      2. Reading the NDEF Messages
      3. Filtering Tags Using Record Types
      4. Filtering Using MIME-Types
    3. Android’s Tag Dispatch System
      1. Types of Intents
      2. Android Application Records
    4. Conclusion
  7. 6. An NFC Application in Practice
    1. The User Interaction
    2. Getting to Know Hue, Getting to Know All About Hue
      1. The Hue Data Format
      2. The Hue’s REST API
    3. The Android Shell
    4. The PhoneGap Media API
    5. The User Interface
    6. The Application Code
      1. Housekeeping Functions
      2. Global Event Handlers
      3. Hub Communication Functions
      4. Lighting User Interface Event Handlers
      5. Music User Interface Event Handlers
      6. NFC Event Handlers
      7. Enabling Background Dispatch
    7. Conclusion
  8. 7. Introduction to Arduino and NFC
    1. Digital Meets Physical: Arduino
    2. The Hardware Heart of NFC
    3. The Arduino Development Environment
      1. Serial Communication
      2. Installing Arduino Libraries
    4. The Arduino NDEF Library
      1. Reading NDEF in Arduino
      2. Writing NDEF in Arduino
    5. A Microcontroller NFC Application: Hotel Key Cards
      1. The Interaction and Data Format
      2. The Arduino NDEF Writer Device
      3. The Arduino NDEF Reader and Door Lock Device
    6. A Browser Interface for the Arduino NDEF Writer Device
      1. Node.js Application Specification: package.json
      2. The Client-Side Code
      3. The Server-Side Code
    7. Conclusion
  9. 8. Peer-to-Peer Exchange
    1. Sending Peer-to-Peer Messages in PhoneGap
    2. Receiving Peer-to-Peer Messages in PhoneGap
    3. Handover
      1. Static Handover
    4. Sending Handover Messages in PhoneGap
    5. Peer-to-Peer Using Arduino
    6. Card Emulation
    7. Conclusion
  10. 9. NFC on Embedded Systems
    1. Introduction to Embedded Linux Devices and Package Managers
      1. Network, USB, and NFC
    2. NFC on Embedded Linux: The Overview
    3. Housekeeping Details
      1. Get Comfortable with Your Editing Workflow
      2. Know Your Package Manager
      3. Set the Date and Time
      4. Make a Downloads Directory
      5. BeagleBone Peculiarities
      6. Raspberry Pi Peculiarities
        1. Installing Node.js on the Raspberry Pi
    4. Installing the Tools for NFC
      1. Installing the Libusb Compatibility Library
      2. Installing libnfc
        1. Raspberry Pi
        2. BeagleBone Black
      3. Testing the Installation on Raspberry Pi or BeagleBone
      4. Installing libfreefare
    5. Libnfc and Libfreefare Command Line Tools
    6. NDEF Reading and Writing in Node.js
    7. Web Interface for Tag Writer
    8. Tags Controlling Physical Output
      1. BeagleBone Version
      2. Raspberry Pi Version
    9. Conclusion
  11. A. NFC Specification Codes
  12. Index
  13. Colophon
  14. Copyright