com.datecs.rfid

## Class FeliCaCard

- java.lang.Object
- - com.datecs.rfid.ContactlessCard
  - - com.datecs.rfid.FeliCaCard

-     public class FeliCaCard
      extends ContactlessCard

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `FELICA_SMARTTAG_BATTERY_LOW1` Low, consider replacing.
    `static int` | `FELICA_SMARTTAG_BATTERY_LOW2` Very Low, replace it.
    `static int` | `FELICA_SMARTTAG_BATTERY_NORMAL1` Normal, card can be used.
    `static int` | `FELICA_SMARTTAG_BATTERY_NORMAL2` Normal, card can be used.
    `static int` | `FELICA_SMARTTAG_DRAW_BLACK_BACKGROUND` The area outside of the image will be shown black.
    `static int` | `FELICA_SMARTTAG_DRAW_KEEP_BACKGROUND` The area outside of the image will be kept to its current state.
    `static int` | `FELICA_SMARTTAG_DRAW_USE_LAYOUT` The area outside of the image will be drawn using one of the previously stored layouts.
    `static int` | `FELICA_SMARTTAG_DRAW_WHITE_BACKGROUND` The area outside of the image will be emptied.

    - ### Fields inherited from class com.datecs.rfid.ContactlessCard

      `afi, atqa, blockSize, capacity, CARD_EPASSPORT, CARD_FELICA, CARD_ISO14443A, CARD_ISO14443B, CARD_ISO15693, CARD_MIFARE_CLASSIC_1K, CARD_MIFARE_CLASSIC_4K, CARD_MIFARE_DESFIRE, CARD_MIFARE_MINI, CARD_MIFARE_PLUS, CARD_MIFARE_ULTRALIGHT, CARD_MIFARE_ULTRALIGHT_C, CARD_PAYMENT, CARD_PICOPASS_14443B, CARD_PICOPASS_15693, CARD_ST_SRI, CARD_UNKNOWN, channel, dsfid, hyatt64Card, maxBlocks, mModule, sak, type, uid`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FeliCaCard(RC663 module)` Constructs a new instance of this class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `deinitialise()` Deinitialise card.
    `boolean` | `initialize()` Initialize card.
    `byte[]` | `read(int serviceCode, int startBlock, int blocks)` Reads one more more blocks of data from FeliCa card.
    `void` | `smartTagClearScreen()` Clears the screen of FeliCa SmartTag.
    `void` | `smartTagDisplayLayout(int layout)` Displays previously stored layout.
    `void` | `smartTagDrawImage(int x, int y, int width, int height, int drawMode, int layout, byte[] data)` Draws image on FeliCa SmartTag's screen.
    `int` | `smartTagGetBatteryStatus()` Returns FeliCa SmartTag battery status.
    `byte[]` | `smartTagRead(int address, int length)` Writes data in FeliCa SmartTag.
    `void` | `smartTagSaveLayout(int layout)` Saves the current display as layout number.
    `void` | `smartTagWrite(int address, byte[] data)` Writes data in FeliCa SmartTag.
    `void` | `write(int serviceCode, int startBlock, byte[] data)` Writes one more more blocks of data to FeliCa card.

    - ### Methods inherited from class com.datecs.rfid.ContactlessCard

      `getModule, getTypeName, waitRemove`

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

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

- - ### Field Detail

    - #### FELICA_SMARTTAG_BATTERY_NORMAL1

          public static final int FELICA_SMARTTAG_BATTERY_NORMAL1

      Normal, card can be used.
      See Also:
        Constant Field Values

    - #### FELICA_SMARTTAG_BATTERY_NORMAL2

          public static final int FELICA_SMARTTAG_BATTERY_NORMAL2

      Normal, card can be used.
      See Also:
        Constant Field Values

    - #### FELICA_SMARTTAG_BATTERY_LOW1

          public static final int FELICA_SMARTTAG_BATTERY_LOW1

      Low, consider replacing.
      See Also:
        Constant Field Values

    - #### FELICA_SMARTTAG_BATTERY_LOW2

          public static final int FELICA_SMARTTAG_BATTERY_LOW2

      Very Low, replace it.
      See Also:
        Constant Field Values

    - #### FELICA_SMARTTAG_DRAW_WHITE_BACKGROUND

          public static final int FELICA_SMARTTAG_DRAW_WHITE_BACKGROUND

      The area outside of the image will be emptied.
      See Also:
        Constant Field Values

    - #### FELICA_SMARTTAG_DRAW_BLACK_BACKGROUND

          public static final int FELICA_SMARTTAG_DRAW_BLACK_BACKGROUND

      The area outside of the image will be shown black.
      See Also:
        Constant Field Values

    - #### FELICA_SMARTTAG_DRAW_KEEP_BACKGROUND

          public static final int FELICA_SMARTTAG_DRAW_KEEP_BACKGROUND

      The area outside of the image will be kept to its current state.
      See Also:
        Constant Field Values

    - #### FELICA_SMARTTAG_DRAW_USE_LAYOUT

          public static final int FELICA_SMARTTAG_DRAW_USE_LAYOUT

      The area outside of the image will be drawn using one of the previously stored layouts.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### FeliCaCard

          public FeliCaCard(RC663 module)

      Constructs a new instance of this class.
      Parameters:
        `module` - The instance of `RC663` module.

  - ### Method Detail

    - #### deinitialise

          protected boolean deinitialise()
                                  throws java.io.IOException

      Description copied from class: `ContactlessCard`
      Deinitialise card.
      Specified by:
        `deinitialise` in class `ContactlessCard`
      Returns:
        on success returns true, otherwise returns false.
      Throws:
        `java.io.IOException` - if an I/O error occurs.

    - #### initialize

          public boolean initialize()
                             throws java.io.IOException

      Initialize card.
      Specified by:
        `initialize` in class `ContactlessCard`
      Returns:
        On success returns true, otherwise returns false.
      Throws:
        `java.io.IOException` - if an I/O error occurs.

    - #### read

          public byte[] read(int serviceCode,
                             int startBlock,
                             int blocks)
                      throws java.io.IOException,
                             RFIDException

      Reads one more more blocks of data from FeliCa card.
      Parameters:
        `serviceCode` - The service code, default is 0x0900.
        `startBlock` - The starting block to read from.
        `blocks` - The number of bytes to read, this must be multiple of block size.
      Returns:
        The data.
      Throws:
        `java.io.IOException` - If an I/O error occurs.
        `RFIDException` - if an RF663 error occurs.

    - #### write

          public void write(int serviceCode,
                            int startBlock,
                            byte[] data)
                     throws java.io.IOException,
                            RFIDException

      Writes one more more blocks of data to FeliCa card.
      Parameters:
        `serviceCode` - The service code, default is 0x0900.
        `startBlock` - The starting block to write to.
        `data` - The data to write, it must be multiple of block size.
      Throws:
        `java.io.IOException` - If an I/O error occurs.
        `RFIDException` - if an RF663 error occurs.

    - #### smartTagGetBatteryStatus

          public int smartTagGetBatteryStatus()
                                       throws java.io.IOException,
                                              RFIDException

      Returns FeliCa SmartTag battery status.
      Returns:
        Upon successful execution, battery status will be returned here, one of FELICA_SMARTTAG_BATTERY_* constants.
      Throws:
        `java.io.IOException` - If an I/O error occurs.
        `RFIDException` - if an RF663 error occurs.

    - #### smartTagClearScreen

          public void smartTagClearScreen()
                                   throws java.io.IOException,
                                          RFIDException

      Clears the screen of FeliCa SmartTag.
      Throws:
        `java.io.IOException` - If an I/O error occurs.
        `RFIDException` - if an RF663 error occurs.

    - #### smartTagDrawImage

          public void smartTagDrawImage(int x,
                                        int y,
                                        int width,
                                        int height,
                                        int drawMode,
                                        int layout,
                                        byte[] data)
                                 throws java.io.IOException,
                                        RFIDException

      Draws image on FeliCa SmartTag's screen. The screen is 200x96 pixels.
      Parameters:
        `x` - Top-left X coordinate in pixels.
        `y` - Top-left Y coordinate in pixels.
        `width` - The image width.
        `height` - The image height.
        `drawMode` - Draw mode, one of the FELICA_SMARTTAG_DRAW_* constants.
        `layout` - Only used when drawMode is FELICA_SMARTTAG_DRAW_USE_LAYOUT, it specifies the index of the layout (1-12) of the previously stored image.
        `data` - The image data (one bit is one pixel).
      Throws:
        `java.io.IOException` - If an I/O error occurs.
        `RFIDException` - if an RF663 error occurs.

    - #### smartTagSaveLayout

          public void smartTagSaveLayout(int layout)
                                  throws java.io.IOException,
                                         RFIDException

      Saves the current display as layout number.
      Parameters:
        `layout` - The layout index (1-12) to which the currently displayed image will be saved.
      Throws:
        `java.io.IOException` - If an I/O error occurs.
        `RFIDException` - if an RF663 error occurs.

    - #### smartTagDisplayLayout

          public void smartTagDisplayLayout(int layout)
                                     throws java.io.IOException,
                                            RFIDException

      Displays previously stored layout.
      Parameters:
        `layout` - The layout index (1-12) of the previously stored image.
      Throws:
        `java.io.IOException` - If an I/O error occurs.
        `RFIDException` - if an RF663 error occurs.

    - #### smartTagWrite

          public void smartTagWrite(int address,
                                    byte[] data)
                             throws java.io.IOException,
                                    RFIDException

      Writes data in FeliCa SmartTag.
      Parameters:
        `address` - The address of the card to write to, refer to SmartTag documentation.
        `data` - The data to write, note that the data does not need to be aligned to block size.
      Throws:
        `java.io.IOException` - If an I/O error occurs.
        `RFIDException` - if an RF663 error occurs.

    - #### smartTagRead

          public byte[] smartTagRead(int address,
                                     int length)
                              throws java.io.IOException,
                                     RFIDException

      Writes data in FeliCa SmartTag.
      Parameters:
        `address` - The address of the card to read from, refer to SmartTag documentation.
        `length` - The length of the data to read, note that the data does not need to be aligned to block size.
      Returns:
        The data.
      Throws:
        `java.io.IOException` - If an I/O error occurs.
        `RFIDException` - if an RF663 error occurs.