Adjust visibility and add accessors to CardCaps.
This commit is contained in:
parent
a8c53056f0
commit
f28c9c2204
2 changed files with 12 additions and 18 deletions
|
@ -84,31 +84,25 @@ pub type CardClientBox = Box<dyn CardClient + Send + Sync>;
|
|||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct CardCaps {
|
||||
/// Extended Lc and Le fields
|
||||
pub ext_support: bool,
|
||||
ext_support: bool,
|
||||
|
||||
/// Command chaining
|
||||
pub chaining_support: bool,
|
||||
chaining_support: bool,
|
||||
|
||||
/// Maximum number of bytes in a command APDU
|
||||
pub max_cmd_bytes: u16,
|
||||
max_cmd_bytes: u16,
|
||||
|
||||
/// Maximum number of bytes in a response APDU
|
||||
pub max_rsp_bytes: u16,
|
||||
max_rsp_bytes: u16,
|
||||
}
|
||||
|
||||
impl CardCaps {
|
||||
pub fn new(
|
||||
ext_support: bool,
|
||||
chaining_support: bool,
|
||||
max_cmd_bytes: u16,
|
||||
max_rsp_bytes: u16,
|
||||
) -> CardCaps {
|
||||
Self {
|
||||
ext_support,
|
||||
chaining_support,
|
||||
max_cmd_bytes,
|
||||
max_rsp_bytes,
|
||||
}
|
||||
pub fn get_ext_support(&self) -> bool {
|
||||
self.ext_support
|
||||
}
|
||||
|
||||
pub fn get_max_rsp_bytes(&self) -> u16 {
|
||||
self.max_rsp_bytes
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,9 +197,9 @@ impl CardClient for ScdClient {
|
|||
let hex = hex::encode(cmd);
|
||||
|
||||
let ext = if self.card_caps.is_some()
|
||||
&& self.card_caps.unwrap().ext_support
|
||||
&& self.card_caps.unwrap().get_ext_support()
|
||||
{
|
||||
format!("--exlen={} ", self.card_caps.unwrap().max_rsp_bytes)
|
||||
format!("--exlen={} ", self.card_caps.unwrap().get_max_rsp_bytes())
|
||||
} else {
|
||||
"".to_string()
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue