ApduStatic

Trait ApduStatic 

Source
pub trait ApduStatic {
    const CLA: u8;
    const INS: u8;

    // Provided methods
    fn p1(&self) -> u8 { ... }
    fn p2(&self) -> u8 { ... }
}
Expand description

Helper trait for defining static APDU commands, automatically implements ApduReq.

use ledger_proto::{ApduStatic, ApduError, Encode, Decode};

// App information request APDU (no body)
#[derive(Clone, Debug, PartialEq, Encode, Decode)]
#[encdec(error = "ApduError")]
pub struct AppInfoReq {}

/// Set CLA and INS values for [AppInfoReq]
impl ApduStatic for AppInfoReq {
    /// Application Info GET APDU is class `0xb0`
    const CLA: u8 = 0xb0;

    /// Application Info GET APDU is instruction `0x00`
    const INS: u8 = 0x01;
}

Required Associated Constants§

Source

const CLA: u8

Class ID for APDU commands

Source

const INS: u8

Instruction ID for APDU commands

Provided Methods§

Source

fn p1(&self) -> u8

Fetch P1 value (defaults to 0 if not extended)

Source

fn p2(&self) -> u8

Fetch P2 value (defaults to 0 if not extended)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ApduStatic for AppInfoReq

Set CLA and INS values for AppInfoReq

Source§

const CLA: u8 = 176u8

Source§

const INS: u8 = 1u8

Source§

impl ApduStatic for DeviceInfoReq

Source§

const CLA: u8 = 224u8

Source§

const INS: u8 = 1u8