Class Smartcard::PCSC::ReaderStates
In: ext/smartcard_pcsc/pcsc_card.c
Parent: Object

Tracks reader status information, and is used in Smartcard::PCSC::Context#get_status_change. Wraps an array of SCARD_READERSTATE structures.

Methods

Public Class methods

Creates an array of num_states reader state elements. The states are unusable until they are assigned reader names by calling Smartcard::PCSC::ReaderStates#set_reader_name_of.

[Source]

/* :Document-method: new
 * call-seq:
 *      new(num_states) --> reader_states
 * 
 * Creates an array of +num_states+ reader state elements.
 * The states are unusable until they are assigned reader names by calling
 * Smartcard::PCSC::ReaderStates#set_reader_name_of.
 */
static VALUE PCSC_ReaderStates_initialize(VALUE self, VALUE rbNumStates) {

Public Instance methods

Mass-assigns current_state to event_state for each reader state element. Useful to acknowledge all the status changed communicated after a call to Smartcard::PCSC::Context#get_status_change (and thus prepare for a new call).

[Source]

/* :Document-method: acknowledge_events!
 * call-seq:
 *      acknowledge_events!() --> self
 * 
 * Mass-assigns +current_state+ to +event_state+ for each reader state element.
 * Useful to acknowledge all the status changed communicated after a call to Smartcard::PCSC::Context#get_status_change
 * (and thus prepare for a new call). 
 */
static VALUE PCSC_ReaderStates_acknowledge_events(VALUE self) {

The card ATR string in the indexth reader state element. Smartcard::PCSC::Context#get_status_change stores the updated ATR string in this value.

The returned ATR bytes are wrapped into a string. (don‘t complain, it‘s a low-level API)

index:the 0-based index of the reader state element to be queried

[Source]

/* :Document-method: atr_of
 * call-seq:
 *      atr_of(index) --> atr
 * 
 * The card ATR string in the <tt>index</tt>th reader state element.
 * Smartcard::PCSC::Context#get_status_change stores the updated ATR string in this value. 
 * 
 * The returned ATR bytes are wrapped into a string. (don't complain, it's a low-level API)
 * 
 * +index+:: the 0-based index of the reader state element to be queried
 */
static VALUE PCSC_ReaderStates_atr_of(VALUE self, VALUE rbIndex) {

The current state (dwCurrentState in PC/SC) in the indexth reader state element. Smartcard::PCSC::Context#get_status_change blocks as long as the reader state equals this value.

The returned state is a bitfield; the bits are defined in the Smartcard::PCSC::STATE_ constants. See Smartcard::PCSC::STATE_UNAWARE.

index:the 0-based index of the reader state element to be queried

[Source]

/* :Document-method: current_state_of
 * call-seq:
 *      current_state_of(index) --> current_state
 * 
 * The current state (_dwCurrentState_ in PC/SC) in the <tt>index</tt>th reader
 * state element. Smartcard::PCSC::Context#get_status_change blocks as long as
 * the reader state equals this value. 
 * 
 * The returned state is a bitfield; the bits are defined in the
 * Smartcard::PCSC::STATE_ constants. See Smartcard::PCSC::STATE_UNAWARE.
 * 
 * +index+:: the 0-based index of the reader state element to be queried
 */
static VALUE PCSC_ReaderStates_current_state_of(VALUE self, VALUE rbIndex) {

The event state (dwEventState in PC/SC) in the indexth reader state element. Smartcard::PCSC::Context#get_status_change stores the updated reader state in this value.

The returned state is a bitfield; the bits are defined in the Smartcard::PCSC::STATE_ constants. See Smartcard::PCSC::STATE_UNAWARE.

index:the 0-based index of the reader state element to be queried

[Source]

/* :Document-method: event_state_of
 * call-seq:
 *      event_state_of(index) --> event_state
 * 
 * The event state (_dwEventState_ in PC/SC) in the <tt>index</tt>th reader
 * state element. Smartcard::PCSC::Context#get_status_change stores the updated
 * reader state in this value.
 * 
 * The returned state is a bitfield; the bits are defined in the
 * Smartcard::PCSC::STATE_ constants. See Smartcard::PCSC::STATE_UNAWARE.
 * 
 * +index+:: the 0-based index of the reader state element to be queried
 */
static VALUE PCSC_ReaderStates_event_state_of(VALUE self, VALUE rbIndex) {

The name of the reader whose status is represented in the indexth reader state element. Smartcard::PCSC::Context#get_status_change reads this value, and never updates it.

index:the 0-based index of the reader state element to be queried

[Source]

/* :Document-method: reader_name_of
 * call-seq:
 *      reader_name_of(index) --> reader_name
 * 
 * The name of the reader whose status is represented in the <tt>index</tt>th reader state element.
 * Smartcard::PCSC::Context#get_status_change reads this value, and never updates it. 
 * 
 * +index+:: the 0-based index of the reader state element to be queried
 */
static VALUE PCSC_ReaderStates_reader_name_of(VALUE self, VALUE rbIndex) {

Sets the card ATR string in the indexth reader state element. Smartcard::PCSC::Context#get_status_change stores the updated ATR string in this value.

index:the 0-based index of the reader state element to be modified
atr:ATR bytes wrapped into a string (low-level API, remember?)

[Source]

/* :Document-method: set_atr_of!
 * call-seq:
 *      set_atr_of!(index, atr) --> self
 * 
 * Sets the card ATR string in the <tt>index</tt>th reader state element.
 * Smartcard::PCSC::Context#get_status_change stores the updated ATR string in this value. 
 * 
 * +index+:: the 0-based index of the reader state element to be modified
 * +atr+:: ATR bytes wrapped into a string (low-level API, remember?)
 */
static VALUE PCSC_ReaderStates_set_atr_of(VALUE self, VALUE rbIndex, VALUE rbAtr) {

Sets the current state (dwCurrentState in PC/SC) in the indexth reader state element. Smartcard::PCSC::Context#get_status_change blocks as long as the reader state equals this value.

index:the 0-based index of the reader state element to be modified
current_state:a bitfield; the bits are defined in the Smartcard::PCSC::STATE_ constants.

[Source]

/* :Document-method: set_current_state_of!
 * call-seq:
 *      set_current_state_of!(index, current_state) --> self 
 * 
 * Sets the current state (_dwCurrentState_ in PC/SC) in the <tt>index</tt>th reader state element.
 * Smartcard::PCSC::Context#get_status_change blocks as long as the reader state equals this value. 
 * 
 * 
 * +index+:: the 0-based index of the reader state element to be modified
 * +current_state+:: a bitfield; the bits are defined in the Smartcard::PCSC::STATE_ constants. 
 */
static VALUE PCSC_ReaderStates_set_current_state_of(VALUE self, VALUE rbIndex, VALUE rbCurrentState) {

Sets the event state (dwEventState in PC/SC) in the indexth reader state element. Smartcard::PCSC::Context#get_status_change stores the updated reader state in this value.

index:the 0-based index of the reader state element to be modified
event_state:a bitfield; the bits are defined in the Smartcard::PCSC::STATE_ constants.

[Source]

/* :Document-method: set_event_state_of!
 * call-seq:
 *      set_event_state_of!(index, event_state) --> self 
 * 
 * Sets the event state (_dwEventState_ in PC/SC) in the <tt>index</tt>th reader state element.
 * Smartcard::PCSC::Context#get_status_change stores the updated reader state in this value. 
 * 
 * +index+:: the 0-based index of the reader state element to be modified
 * +event_state+:: a bitfield; the bits are defined in the Smartcard::PCSC::STATE_ constants. 
 */
static VALUE PCSC_ReaderStates_set_event_state_of(VALUE self, VALUE rbIndex, VALUE rbEventState) {

The name of the reader whose status is represented in the indexth reader state element. Smartcard::PCSC::Context#get_status_change reads this value, and never updates it.

index:the 0-based index of the reader state element to be modified
reader_name:a string-like object containing the reader name to be associated with the state element

[Source]

/* :Document-method: set_reader_name_of!
 * call-seq:
 *      set_reader_name_of!(index, reader_name) --> self
 * 
 * The name of the reader whose status is represented in the <tt>index</tt>th reader state element.
 * Smartcard::PCSC::Context#get_status_change reads this value, and never updates it. 
 * 
 * +index+:: the 0-based index of the reader state element to be modified
 * +reader_name+:: a string-like object containing the reader name to be associated with the state element
 */
static VALUE PCSC_ReaderStates_set_reader_name_of(VALUE self, VALUE rbIndex, VALUE rbReaderName) {

[Validate]