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 arrayScardReaderState[]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
FieldsModifier and TypeFieldDescriptionNumber of octets in ATR.Current state of reader.Reader state ofter a state change.com.sun.jna.PointerPointer 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic ScardReaderState[]createArray(List<String> readerNames, boolean withPnp) Creates and initializes an array ofScardReaderState.toString()ReturnStringrepresentation.static StringtoString(ScardReaderState... readerStates) Return aStringrepresentation 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
-
Field Details
-
szReader
Zero terminated string with name of card reader.Set the value of this member to "\\?PnP?\Notification" and the values of all other instance attributes to zero to be notified of the arrival of a new smart card reader.
Note: According to the implementation of the superclass
Structurethe visibility of this instance attribute has to be "public".- See Also:
-
pvUserData
@Nullable public com.sun.jna.Pointer pvUserDataPointer to user defined data.Not used by the smart card subsystem. This member is used by the application.
Note: According to the implementation of the superclass
Structurethe visibility of this instance attribute has to be "public".- See Also:
-
dwCurrentState
Current state of reader.Current state of the reader, as seen by the application. This field can take on any of the following values, in combination, as a bitmask.
SCARD_STATE_UNAWARESCARD_STATE_IGNORESCARD_STATE_UNAVAILABLESCARD_STATE_EMPTYSCARD_STATE_PRESENTSCARD_STATE_ATRMATCHSCARD_STATE_EXCLUSIVESCARD_STATE_INUSESCARD_STATE_MUTESCARD_STATE_UNPOWERED
Note: According to the implementation of the superclass
Structurethe visibility of this instance attribute has to be "public".- See Also:
-
dwEventState
Reader state ofter a state change.Current state of the reader, as known by the smart card resource manager. This field can take on any of the following values, in combination, as a bitmask.
SCARD_STATE_IGNORESCARD_STATE_CHANGEDSCARD_STATE_UNKNOWNSCARD_STATE_UNAVAILABLESCARD_STATE_EMPTYSCARD_STATE_PRESENTSCARD_STATE_ATRMATCHSCARD_STATE_EXCLUSIVESCARD_STATE_INUSESCARD_STATE_MUTESCARD_STATE_UNPOWERED
Note: According to the implementation of the superclass
Structurethe visibility of this instance attribute has to be "public".- See Also:
-
cbAtr
Number of octets in ATR.Note: According to the implementation of the superclass
Structurethe visibility of this instance attribute has to be "public".- See Also:
-
rgbAtr
public byte[] rgbAtrAnswer-To-Reset (ATR).Note: According to the implementation of the superclass
Structurethe visibility of this instance attribute has to be "public".- See Also:
-
-
Constructor Details
-
ScardReaderState
public ScardReaderState()Default constructor.
-
-
Method Details
-
createArray
Creates and initializes an array ofScardReaderState.First an array is created and memory is allocated for the elements of that array. Then
szReaderis set to names fromreaderNames.If
withPnpisTRUE, then an additional array element withszReaderset toWinscardLibrary.PNP_READER_IDis added as the first element.- Parameters:
readerNames- names of readers, possibly emptywithPnp- flag indicating if a special array element for Plug-And-Play readers shall be added to the result- Returns:
- appropriate allocated array
-
toString
ReturnStringrepresentation.The following information is concatenated:
- "szReader=
szReader" - "pvUserData=
pvUserData" - "cS=
dwCurrentStatein six hex-digits prefixed with "0x" - "cS=
dwEventStatein six hex-digits prefixed with "0x" - "atrSize=
cbAtras two decimal digits (no leading zero) - "ATR='
rgbAtr' as hex-digits
- Overrides:
toStringin classcom.sun.jna.Structure- Returns:
Stringrepresentation- See Also:
- "szReader=
-
toString
Return aStringrepresentation of given array.
-