Struct pcsc::Context
[−]
[src]
pub struct Context { /* fields omitted */ }
Library context to the PCSC service.
This structure wraps SCARDCONTEXT
.
Methods
impl Context
[src]
fn establish(scope: Scope) -> Result<Context, Error>
[src]
fn release(self) -> Result<(), (Context, Error)>
[src]
Release the context.
In case of error, ownership of the context is returned to the caller.
This function wraps SCardReleaseContext
(pcsclite,
MSDN).
Note
Context
implements Drop
which automatically releases the
context; you only need to call this function if you want to handle
errors.
fn is_valid(&self) -> Result<(), Error>
[src]
fn cancel(&self) -> Result<(), Error>
[src]
Cancel any ongoing blocking operation in the Context.
See the cancel.rs
example program.
fn list_readers<'buf>(
&self,
buffer: &'buf mut [u8]
) -> Result<ReaderNames<'buf>, Error>
[src]
&self,
buffer: &'buf mut [u8]
) -> Result<ReaderNames<'buf>, Error>
List all connected card readers.
buffer
is a buffer that should be large enough to hold all of
the connected reader names. The function list_readers_len
can be
used to find the exact required length.
Returns an iterator over the reader names. The iterator yields
values directly from buffer
.
If the buffer is not large enough to hold all of the names,
Error::InsufficientBuffer
is returned.
fn list_readers_len(&self) -> Result<usize, Error>
[src]
Get the needed length of a buffer to be passed to list_readers
.
fn connect(
&self,
reader: &CStr,
share_mode: ShareMode,
preferred_protocols: Protocols
) -> Result<Card, Error>
[src]
&self,
reader: &CStr,
share_mode: ShareMode,
preferred_protocols: Protocols
) -> Result<Card, Error>
Connect to a card which is present in a reader.
See the connect.rs
example program.
fn get_status_change<D>(
&self,
timeout: D,
readers: &mut [ReaderState]
) -> Result<(), Error> where
D: Into<Option<Duration>>,
[src]
&self,
timeout: D,
readers: &mut [ReaderState]
) -> Result<(), Error> where
D: Into<Option<Duration>>,
Wait for card and card reader state changes.
The function blocks until the state of one of the readers changes
from corresponding passed-in ReaderState
. The ReaderState
s are
updated to report the new state.
A special reader name, \\?PnP?\Notification
, can be used to
detect card reader insertions and removals, as opposed to state
changes of a specific reader. Use PNP_NOTIFICATION()
to easily
obtain a static reference to this name.
See the monitor.rs
example program.