[−][src]Struct pcsc::Card
A connection to a smart card.
This structure wraps SCARDHANDLE
.
Methods
impl Card
[src]
pub fn transaction(&mut self) -> Result<Transaction, Error>
[src]
Start a new exclusive transaction with the card.
Operations on the card for the duration of the transaction
can only be performed through the returned Transaction
.
pub fn reconnect(
&mut self,
share_mode: ShareMode,
preferred_protocols: Protocols,
initialization: Disposition
) -> Result<(), Error>
[src]
&mut self,
share_mode: ShareMode,
preferred_protocols: Protocols,
initialization: Disposition
) -> Result<(), Error>
pub fn disconnect(self, disposition: Disposition) -> Result<(), (Card, Error)>
[src]
Disconnect from the card.
In case of error, ownership of the card is returned to the caller.
This function wraps SCardDisconnect
(pcsclite, MSDN).
Note
Card
implements Drop
which automatically disconnects the card
using Disposition::ResetCard
; you only need to call this
function if you want to handle errors or use a different
disposition method.
pub fn status(&self) -> Result<(Status, Protocol), Error>
[src]
Not portable; use status2() instead.
Get current info on the card.
This function wraps SCardStatus
(pcsclite, MSDN).
Deprecated
The Status
return value is not portable to Windows.
The reader names and ATR return values are missing.
Use status2()
instead.
pub fn status2<'names_buf, 'atr_buf>(
&self,
names_buffer: &'names_buf mut [u8],
atr_buffer: &'atr_buf mut [u8]
) -> Result<CardStatus<'names_buf, 'atr_buf>, Error>
[src]
&self,
names_buffer: &'names_buf mut [u8],
atr_buffer: &'atr_buf mut [u8]
) -> Result<CardStatus<'names_buf, 'atr_buf>, Error>
Get current info on the card.
names_buffer
is a buffer that should be large enough to hold all of
the reader names.
atr_buffer
is a buffer that should be large enough to hold the ATR.
The recommended size is MAX_ATR_SIZE
, which should be always
sufficent.
The function status2_len
can be used to find the exact required
lengths.
If the buffers are not large enough to hold all of the names or the
ATR, Error::InsufficientBuffer
is returned.
pub fn status2_len(&self) -> Result<(usize, usize), Error>
[src]
Get the needed length of the names buffer (first result) and ATR buffer
(second result) to be passed to status2
.
pub fn get_attribute<'buf>(
&self,
attribute: Attribute,
buffer: &'buf mut [u8]
) -> Result<&'buf [u8], Error>
[src]
&self,
attribute: Attribute,
buffer: &'buf mut [u8]
) -> Result<&'buf [u8], Error>
Get an attribute of the card or card reader.
buffer
is a buffer that should be large enough for the attribute
data. The function get_attribute_len
can be used to find the
exact required length.
Returns a slice into buffer
containing the attribute data.
If the buffer is not large enough, Error::InsufficientBuffer
is
returned.
pub fn get_attribute_len(&self, attribute: Attribute) -> Result<usize, Error>
[src]
Get the needed length of a buffer to be passed to get_attribute
.
pub fn set_attribute(
&self,
attribute: Attribute,
attribute_data: &[u8]
) -> Result<(), Error>
[src]
&self,
attribute: Attribute,
attribute_data: &[u8]
) -> Result<(), Error>
pub fn transmit<'buf>(
&self,
send_buffer: &[u8],
receive_buffer: &'buf mut [u8]
) -> Result<&'buf [u8], Error>
[src]
&self,
send_buffer: &[u8],
receive_buffer: &'buf mut [u8]
) -> Result<&'buf [u8], Error>
Transmit an APDU command to the card.
receive_buffer
is a buffer that should be large enough to hold
the APDU response.
Returns a slice into receive_buffer
containing the APDU
response.
If receive_buffer
is not large enough to hold the APDU response,
Error::InsufficientBuffer
is returned.
pub fn control<'buf>(
&self,
control_code: DWORD,
send_buffer: &[u8],
receive_buffer: &'buf mut [u8]
) -> Result<&'buf [u8], Error>
[src]
&self,
control_code: DWORD,
send_buffer: &[u8],
receive_buffer: &'buf mut [u8]
) -> Result<&'buf [u8], Error>
Sends a command directly to the reader (driver).
control_code
is the reader-specific control code. You may need
to pass it through the ctl_code()
function, according to the
driver documentation.
receive_buffer
is a buffer that should be large enough to hold
the response.
Returns a slice into receive_buffer
containing the response.
If receive_buffer
is not large enough to hold the response,
Error::InsufficientBuffer
is returned.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,