ketai.net.nfc

## Class KetaiNFC

- java.lang.Object
- - ketai.net.nfc.KetaiNFC

- All Implemented Interfaces:
    android.nfc.NfcAdapter.CreateNdefMessageCallback, android.nfc.NfcAdapter.OnNdefPushCompleteCallback

      public class KetaiNFC
      extends java.lang.Object
      implements android.nfc.NfcAdapter.CreateNdefMessageCallback, android.nfc.NfcAdapter.OnNdefPushCompleteCallback

  The KetaiNFC class provides access the Near Field Communication (NFC) capabilities on supported platforms. This includes access to android Beam (tm) services. To access data from NFC services a sketch can define the following methods:
  void onNFCEvent(String txt) - get text from text formatted NFC tags
  void onNFCEvent(byte[] data) - get raw data from NFC tag
  void onNFCEvent(URI _uri) - get URI from URI formatted tags
  void onNFCWrite(boolean success, String message) - get status from a write operation
  - message will contain the error if the operation failed

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KetaiNFC(processing.core.PApplet pParent)` Instantiates a new ketai nfc.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beam(java.lang.String textToWrite)` Beam.
    `void` | `cancelWrite()` Cancel pending write operation
    `android.nfc.NdefMessage` | `createNdefMessage(android.nfc.NfcEvent arg0)`
    `void` | `handleIntent(android.content.Intent intent)` Handle intent.(used by the android platform for management)
    `static android.nfc.NdefRecord` | `newTextRecord(java.lang.String text, java.util.Locale locale, boolean encodeInUtf8)` New text record.
    `void` | `onNdefPushComplete(android.nfc.NfcEvent arg0)`
    `void` | `pause()` Pause.
    `void` | `resume()` Resume.
    `void` | `start(android.app.PendingIntent p)` Start.
    `void` | `write(byte[] _data)` Write generic byte array
    `void` | `write(java.lang.String textToWrite)` Write text to a tag
    `void` | `write(java.net.URI _url)` Write a URL to a tag

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KetaiNFC

          public KetaiNFC(processing.core.PApplet pParent)

      Instantiates a new ketai nfc.
      Parameters:
        `pParent` - the calling sketch/Activity

  - ### Method Detail

    - #### resume

          public void resume()

      Resume.

    - #### start

          public void start(android.app.PendingIntent p)

      Start.
      Parameters:
        `p` - the pending intent (used by the android platform for management)

    - #### pause

          public void pause()

      Pause. (used by the android platform for management)

    - #### handleIntent

          public void handleIntent(android.content.Intent intent)

      Handle intent.(used by the android platform for management)
      Parameters:
        `intent` - the intent

    - #### newTextRecord

          public static android.nfc.NdefRecord newTextRecord(java.lang.String text,
                                                             java.util.Locale locale,
                                                             boolean encodeInUtf8)

      New text record.
      Parameters:
        `text` - the text
        `locale` - the locale
        `encodeInUtf8` - the encode in utf8
      Returns:
        the ndef record

    - #### write

          public void write(java.net.URI _url)

      Write a URL to a tag
      Parameters:
        `_url` - the _url

    - #### write

          public void write(java.lang.String textToWrite)

      Write text to a tag
      Parameters:
        `textToWrite` - the text to write

    - #### beam

          public void beam(java.lang.String textToWrite)

      Beam.
      Parameters:
        `textToWrite` - the text to beam to device

    - #### write

          public void write(byte[] _data)

      Write generic byte array
      Parameters:
        `_data` - the _data to write

    - #### cancelWrite

          public void cancelWrite()

      Cancel pending write operation

    - #### onNdefPushComplete

          public void onNdefPushComplete(android.nfc.NfcEvent arg0)

      Specified by:
        `onNdefPushComplete` in interface `android.nfc.NfcAdapter.OnNdefPushCompleteCallback`

    - #### createNdefMessage

          public android.nfc.NdefMessage createNdefMessage(android.nfc.NfcEvent arg0)

      Specified by:
        `createNdefMessage` in interface `android.nfc.NfcAdapter.CreateNdefMessageCallback`