Class ScardReaderState

java.lang.Object
com.sun.jna.Structure
de.gematik.smartcards.pcsc.lib.ScardReaderState

@FieldOrder({"szReader","pvUserData","dwCurrentState","dwEventState","cbAtr","rgbAtr"}) public final class ScardReaderState extends com.sun.jna.Structure
The SCARD_READERSTATE struct used by SCardGetStatusChange, see pcsclite.h.

On each platform, the sizeof and alignment is different. On Windows, ScardReaderState is explicitly aligned to word boundaries.

  • Windows has extra padding after rgbAtr, so that the structure is aligned at word boundaries even when it is in an array ScardReaderState[]
             sizeof(SCARD_READERSTATE_A):
             windows x86: 4+4+4+4+4+36 = 56
             windows x64: 8+8+4+4+4+36 = 64
             structure alignment: not sure (but it doesn't matter)
           
  • OSX has no extra padding around rgbAtr, and pcsclite.h contains "#pragma pack(1)", so it is not word-aligned.
             sizeof(SCARD_READERSTATE_A):
             osx x86: 4+4+4+4+4+33 = 53
             osx x64: 8+8+4+4+4+33 = 61
             structure alignment: packed
           
  • Linux pcsclite.h has no extra padding around rgbAtr, but it is aligned by default. In addition, DWORD is typedef'd to long instead of int.
             sizeof(SCARD_READERSTATE_A):
             linux x86: 4+4+4+4+4+33 = 53
             linux x64: 8+8+8+8+8+33 = 73
             structure alignment: default
           

Note: According to the implementation of the superclass Structure the visibility of this class has to be "public".

Author:
gematik
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.sun.jna.Structure

    com.sun.jna.Structure.ByReference, com.sun.jna.Structure.ByValue, com.sun.jna.Structure.FieldOrder, com.sun.jna.Structure.StructField
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Number of octets in ATR.
    Current state of reader.
    Reader state ofter a state change.
    com.sun.jna.Pointer
    Pointer to user defined data.
    byte[]
    Answer-To-Reset (ATR).
    Zero terminated string with name of card reader.

    Fields inherited from class com.sun.jna.Structure

    ALIGN_DEFAULT, ALIGN_GNUC, ALIGN_MSVC, ALIGN_NONE, CALCULATE_SIZE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    createArray(List<String> readerNames, boolean withPnp)
    Creates and initializes an array of ScardReaderState.
    Return String representation.
    static String
    toString(ScardReaderState... readerStates)
    Return a String representation of given array.

    Methods inherited from class com.sun.jna.Structure

    allocateMemory, allocateMemory, autoAllocate, autoRead, autoRead, autoWrite, autoWrite, cacheTypeInfo, calculateSize, clear, createFieldsOrder, createFieldsOrder, createFieldsOrder, createFieldsOrder, dataEquals, dataEquals, ensureAllocated, equals, fieldOffset, getAutoRead, getAutoWrite, getFieldList, getFieldOrder, getFields, getNativeAlignment, getNativeSize, getNativeSize, getPointer, getStringEncoding, getStructAlignment, hashCode, newInstance, newInstance, read, readField, readField, setAlignType, setAutoRead, setAutoSynch, setAutoWrite, setStringEncoding, size, sortFields, toArray, toArray, toString, useMemory, useMemory, write, writeField, writeField, writeField

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait