Skip to content

Commit

Permalink
Addressed reviewer comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Holger Rapp <[email protected]>
  • Loading branch information
SirVer committed Dec 15, 2023
1 parent 2e8c408 commit 0f27451
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
1 change: 1 addition & 0 deletions zvt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ rust_test(
data = glob(["data/*.blob"]),
edition = "2021",
proc_macro_deps = all_crate_deps(proc_macro = True),
deps = all_crate_deps(),
)
5 changes: 3 additions & 2 deletions zvt/src/packets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ pub mod tests {
sak: Some(0x20),
subs: vec![tlv::Subs {
application_id: Some("a0000000041010".to_string()),
card_type: None,
}],
}),
..StatusInformation::default()
Expand Down Expand Up @@ -630,11 +631,11 @@ pub mod tests {
subs: Vec::new(),
subs_on_card: Some(tlv::SubsOnCard {
subs: vec![
tlv::SubOnCard {
tlv::Subs {
application_id: Some("a0000003591010028001".to_string()),
card_type: Some("0005".to_string()),
},
tlv::SubOnCard {
tlv::Subs {
application_id: Some("a0000000043060".to_string()),
card_type: Some("002e".to_string()),
},
Expand Down
18 changes: 6 additions & 12 deletions zvt/src/packets/tlv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ use chrono::NaiveDateTime;

#[derive(Debug, Default, PartialEq, Zvt)]
pub struct Subs {
#[zvt_bmp(number = 0x43, length = length::Tlv, encoding = encoding::Hex)]
pub application_id: Option<String>,
}

#[derive(Debug, Default, PartialEq, Zvt)]
pub struct SubOnCard {
#[zvt_tlv(tag = 0x41, encoding = encoding::Hex)]
pub card_type: Option<String>,

Expand All @@ -19,7 +13,7 @@ pub struct SubOnCard {
#[derive(Debug, Default, PartialEq, Zvt)]
pub struct SubsOnCard {
#[zvt_tlv(tag = 0x60)]
pub subs: Vec<SubOnCard>,
pub subs: Vec<Subs>,
}

#[derive(Debug, Default, PartialEq, Zvt)]
Expand Down Expand Up @@ -65,16 +59,16 @@ pub struct StatusEnquiry {

#[derive(Debug, PartialEq, Zvt)]
pub struct DeviceInformation {
#[zvt_bmp(number = 0x1f40, length = length::Tlv)]
#[zvt_tlv(tag = 0x1f40)]
pub device_name: Option<String>,

#[zvt_bmp(number = 0x1f41, length = length::Tlv)]
#[zvt_tlv(tag = 0x1f41)]
pub software_version: Option<String>,

#[zvt_bmp(number = 0x1f42, length = length::Tlv, encoding = encoding::Bcd)]
#[zvt_tlv(tag = 0x1f42, encoding = encoding::Bcd)]
pub serial_number: Option<usize>,

#[zvt_bmp(number = 0x1f43, length = length::Tlv)]
#[zvt_tlv(tag = 0x1f43)]
pub device_state: Option<u8>,
}

Expand Down Expand Up @@ -133,7 +127,7 @@ pub struct ReadCard {

#[derive(Debug, PartialEq, Zvt)]
pub struct ZvtString {
#[zvt_bmp(number = 0x07, length=length::Tlv)]
#[zvt_tlv(tag = 0x07)]
pub line: String,
}

Expand Down
2 changes: 1 addition & 1 deletion zvt/tests/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fn test_nested() {
#[derive(Zvt, PartialEq, Debug)]
struct Outer {
a: u16,
#[zvt_bmp(number = 0x12, length = length::Tlv)]
#[zvt_tlv(tag = 0x12)]
b: Option<Inner>,
}

Expand Down
2 changes: 1 addition & 1 deletion zvt_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ struct ReservationArgs {
#[argh(option, default = "64")]
payment_type: u8,

#[argh(option)]
/// track 2 data to identify past read card.
#[argh(option)]
track_2_data: Option<String>,

/// bmp_prefix. If this is set, bmp_data must be set too.
Expand Down

0 comments on commit 0f27451

Please sign in to comment.