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

Connects Ruby to the PC/SC resource manager. Wraps a SCARDCONTEXT structure.

Methods

Public Class methods

Creates an application context connecting to the PC/SC resource manager. A context is required to access every piece of PC/SC functionality. Wraps SCardEstablishContext in PC/SC.

scope:scope of the context; use one of the Smartcard::PCSC::SCOPE_ constants

[Source]

/* :Document-method: new
 * call-seq:
 *      new(scope) --> context
 * 
 * Creates an application context connecting to the PC/SC resource manager.
 * A context is required to access every piece of PC/SC functionality.
 * Wraps _SCardEstablishContext_ in PC/SC.
 * 
 * +scope+:: scope of the context; use one of the Smartcard::PCSC::SCOPE_ constants
 */
static VALUE PCSC_Context_initialize(VALUE self, VALUE scope) {

Public Instance methods

Cancels all pending blocking requests on the Context#get_status_change function. Wraps SCardCancel in PC/SC.

[Source]

/* :Document-method: cancel
 * call-seq:
 *      cancel() --> self
 * 
 * Cancels all pending blocking requests on the Context#get_status_change function. 
 * Wraps _SCardCancel_ in PC/SC.
 */
static VALUE PCSC_Context_cancel(VALUE self) {

Blocks until a status change occurs in one of the given readers. Wraps SCardGetStatusChange in PC/SC.

reader_states:Smartcard::PCSC::ReaderStates instance indicating the readers to be monitored, and the interesting state changes
timeout:maximum ammount of time (in milliseconds) to block; use Smartcard::PCSC::INFINITE_TIMEOUT to block forever

The function blocks until the state of one of the readers in reader_states becomes different from the current_state (accessible via ReaderStates#set_current_state_of and ReaderStates#current_state_of). The new state is stored in event_state (accessible via ReaderStates#set_event_state_of and ReaderStates#event_state_of)

[Source]

/* :Document-method: get_status_change
 * call-seq:
 *      get_status_change(reader_states, timeout) --> self
 * 
 * Blocks until a status change occurs in one of the given readers. 
 * Wraps _SCardGetStatusChange_ in PC/SC.
 * 
 * +reader_states+:: Smartcard::PCSC::ReaderStates instance indicating the readers to be monitored, and the interesting state changes
 * +timeout+:: maximum ammount of time (in milliseconds) to block; use Smartcard::PCSC::INFINITE_TIMEOUT to block forever
 * 
 * The function blocks until the state of one of the readers in +reader_states+ becomes different from the +current_state+ (accessible via
 * ReaderStates#set_current_state_of and ReaderStates#current_state_of). The new state is stored in +event_state+ (accessible via
 * ReaderStates#set_event_state_of and ReaderStates#event_state_of)
 */
static VALUE PCSC_Context_get_status_change(VALUE self, VALUE rbReaderStates, VALUE rbTimeout) {

Checks if the PC/SC context is still valid. A context may become invalid if the resource manager service has been shut down. Wraps SCardIsValidContext in PC/SC.

Returns a boolean value with the obvious meaning.

[Source]

/* :Document-method: is_valid
 * call-seq:
 *      is_valid() --> valid_boolean
 * 
 * Checks if the PC/SC context is still valid.
 * A context may become invalid if the resource manager service has been shut down.
 * Wraps _SCardIsValidContext_ in PC/SC.
 * 
 * Returns a boolean value with the obvious meaning.
 */
static VALUE PCSC_Context_is_valid(VALUE self) {

The error code returned by the last PC/SC call. Useful for recovering from exceptions.

The returned code is a number, and should be one of the Smartcard::PCSC::SCARD_ constants. The code indicating correct operation is Smartcard::PCSC::SCARD_S_SUCCESS.

[Source]

/* :Document-method: last_error
 * call-seq:
 *      card.last_error() --> last_error
 * 
 * The error code returned by the last PC/SC call. Useful for recovering from exceptions.
 * 
 * The returned code is a number, and should be one of the Smartcard::PCSC::SCARD_ constants.
 * The code indicating correct operation is Smartcard::PCSC::SCARD_S_SUCCESS.
 */
static VALUE PCSC_Context_last_error(VALUE self) {

Retrieves the currently available reader groups on the system. Wraps SCardListReaderGroups in PC/SC.

Returns an array of strings containing the names of all the smart-card readers in the system.

[Source]

/* :Document-method: list_reader_groups
 * call-seq:
 *      list_reader_groups() --> reader_groups
 * 
 * Retrieves the currently available reader groups on the system. 
 * Wraps _SCardListReaderGroups_ in PC/SC.
 * 
 * Returns an array of strings containing the names of all the smart-card readers in the system.
 */
static VALUE PCSC_Context_list_reader_groups(VALUE self) {

Retrieves a subset of the currently available card readers in the system. Wraps SCardListReaders in PC/SC.

Returns an array of strings containing the names of the card readers in the given groups.

reader_groups:array of strings indicating the reader groups to list; also accepts a string or nil (meaning all readers)

[Source]

/* :Document-method: list_readers
 * call-seq:
 *      list_readers(reader_groups) --> readers
 * 
 * Retrieves a subset of the currently available card readers in the system. 
 * Wraps _SCardListReaders_ in PC/SC.
 * 
 * Returns an array of strings containing the names of the card readers in the given groups.
 * 
 * +reader_groups+:: array of strings indicating the reader groups to list; also accepts a string or +nil+ (meaning all readers)
 */
static VALUE PCSC_Context_list_readers(VALUE self, VALUE rbGroups) {

Destroys the communication context connecting to the PC/SC Resource Manager. Should be the last PC/SC function called, because a context is required to access every piece of PC/SC functionality. Wraps SCardReleaseContext in PC/SC.

[Source]

/* :Document-method: release
 * call-seq:
 *      release() --> self
 * 
 * Destroys the communication context connecting to the PC/SC Resource Manager. 
 * Should be the last PC/SC function called, because a context is required to access every piece of PC/SC functionality.
 * Wraps _SCardReleaseContext_ in PC/SC.
 */
static VALUE PCSC_Context_release(VALUE self) {

[Validate]