SE050 Driver
API reference
Loading...
Searching...
No Matches
Public Member Functions | List of all members
se050::T1Session< TransportT > Class Template Reference

Stateful T=1 session bound to a concrete I²C transport. More...

#include <se050_t1_session.hpp>

Public Member Functions

 T1Session (TransportT &transport) noexcept
 
void SetInterFrameDelayMs (std::uint32_t ms) noexcept
 Delay between a completed Write and the first Read of the response.
 
std::uint32_t InterFrameDelayMs () const noexcept
 
void SetReadRetries (std::uint8_t retries) noexcept
 Number of retry attempts for retryable I²C read errors while waiting response blocks.
 
std::uint8_t ReadRetries () const noexcept
 
void SetReadRetryDelayMs (std::uint32_t ms) noexcept
 Delay between retryable read attempts (transport polling interval).
 
std::uint32_t ReadRetryDelayMs () const noexcept
 
void SetMaxWtxRequests (std::uint8_t max_wtx_requests) noexcept
 Upper bound of tolerated WTX request/response cycles within a single exchange.
 
std::uint8_t MaxWtxRequests () const noexcept
 
void SetIfsc (std::size_t ifsc) noexcept
 Information field size of the SE (IFSC): the largest INF the host puts in one I-block.
 
std::size_t Ifsc () const noexcept
 
void SetMaxRetransmissions (std::uint8_t n) noexcept
 How many times one block is requested or sent again within an exchange before it fails (ISO/IEC 7816-3 11.6.3). Default t1::kDefaultMaxRetransmissions.
 
std::uint8_t MaxRetransmissions () const noexcept
 
TransportT & Transport () noexcept
 
const TransportT & Transport () const noexcept
 
Error ChipWarmReset (std::uint32_t timeout_ms) noexcept
 Send an S-block warm-reset style request (PCB = t1::kPcbSWarmReset, empty INF).
 
Error GetAnswerToReset (std::uint8_t *buf, std::size_t cap, std::size_t *len_out, std::uint32_t timeout_ms) noexcept
 Retrieve the SE050 T=1oI2C profile / ATR-like byte string (S-block GET ATR).
 
Error RecoverAfterHostReset (std::uint32_t timeout_ms) noexcept
 Start-up sequence for SE050 erratum I2C.1, then resynchronise the block numbers.
 
Error ExchangeInformation (const std::uint8_t *cmd, std::size_t cmd_len, std::uint8_t *rsp, std::size_t rsp_cap, std::size_t *rsp_len, std::uint32_t timeout_ms) noexcept
 Exchange a raw information field payload (APDU bytes) with the SE using I-blocks.
 
void ResetSequenceState () noexcept
 Reset sequence counters (call after electrical / protocol reset).
 

Detailed Description

template<typename TransportT>
class se050::T1Session< TransportT >

Stateful T=1 session bound to a concrete I²C transport.

Template Parameters
TransportTCRTP transport (I2cTransceiveInterface<TransportT>).

Constructor & Destructor Documentation

◆ T1Session()

template<typename TransportT >
se050::T1Session< TransportT >::T1Session ( TransportT &  transport)
inlineexplicitnoexcept

Member Function Documentation

◆ ChipWarmReset()

template<typename TransportT >
Error se050::T1Session< TransportT >::ChipWarmReset ( std::uint32_t  timeout_ms)
inlinenoexcept

Send an S-block warm-reset style request (PCB = t1::kPcbSWarmReset, empty INF).

Parameters
timeout_msI²C segment timeout.

◆ ExchangeInformation()

template<typename TransportT >
Error se050::T1Session< TransportT >::ExchangeInformation ( const std::uint8_t *  cmd,
std::size_t  cmd_len,
std::uint8_t *  rsp,
std::size_t  rsp_cap,
std::size_t *  rsp_len,
std::uint32_t  timeout_ms 
)
inlinenoexcept

Exchange a raw information field payload (APDU bytes) with the SE using I-blocks.

Performs chained transmission/reception per ISO 7816-3 (R-block ACK between chained blocks).

Parameters
cmdCommand INF (typically a full C-APDU).
cmd_lenLength of cmd (may exceed t1::kMaxInformationField; chaining used).
rspBuffer for concatenated response INF (typically R-APDU body + status).
rsp_capCapacity of rsp.
rsp_lenTotal INF bytes stored into rsp.
Note
If this returns any error other than Error::Ok, call ResetSequenceState (or perform a warm / electrical reset) before the next exchange — N(S) / N(R) state may no longer match the SE.

◆ GetAnswerToReset()

template<typename TransportT >
Error se050::T1Session< TransportT >::GetAnswerToReset ( std::uint8_t *  buf,
std::size_t  cap,
std::size_t *  len_out,
std::uint32_t  timeout_ms 
)
inlinenoexcept

Retrieve the SE050 T=1oI2C profile / ATR-like byte string (S-block GET ATR).

Parameters
bufDestination buffer for the information field bytes (ATR payload only).
capCapacity of buf.
len_outWritten INF length on success.

◆ Ifsc()

template<typename TransportT >
std::size_t se050::T1Session< TransportT >::Ifsc ( ) const
inlinenoexcept

◆ InterFrameDelayMs()

template<typename TransportT >
std::uint32_t se050::T1Session< TransportT >::InterFrameDelayMs ( ) const
inlinenoexcept

◆ MaxRetransmissions()

template<typename TransportT >
std::uint8_t se050::T1Session< TransportT >::MaxRetransmissions ( ) const
inlinenoexcept

◆ MaxWtxRequests()

template<typename TransportT >
std::uint8_t se050::T1Session< TransportT >::MaxWtxRequests ( ) const
inlinenoexcept

◆ ReadRetries()

template<typename TransportT >
std::uint8_t se050::T1Session< TransportT >::ReadRetries ( ) const
inlinenoexcept

◆ ReadRetryDelayMs()

template<typename TransportT >
std::uint32_t se050::T1Session< TransportT >::ReadRetryDelayMs ( ) const
inlinenoexcept

◆ RecoverAfterHostReset()

template<typename TransportT >
Error se050::T1Session< TransportT >::RecoverAfterHostReset ( std::uint32_t  timeout_ms)
inlinenoexcept

Start-up sequence for SE050 erratum I2C.1, then resynchronise the block numbers.

Errata sheet Rev. 1.0, 3.1.3: if the host resets in the middle of an exchange, the SE050 may still hold an answer; writing the next command before it is read can make the SE050 stretch SCL until it is power-cycled. Call this once after the host starts, before the first command: it reads (and discards) any pending block, then sends S(RESYNCH request) and resets N(S)/N(R) on both sides. When nothing is pending the read is simply NACKed (it costs ReadRetries x ReadRetryDelayMs). It cannot clear a lock-up that has already happened: that needs a power cycle (HardwareReset()).

◆ ResetSequenceState()

template<typename TransportT >
void se050::T1Session< TransportT >::ResetSequenceState ( )
inlinenoexcept

Reset sequence counters (call after electrical / protocol reset).

◆ SetIfsc()

template<typename TransportT >
void se050::T1Session< TransportT >::SetIfsc ( std::size_t  ifsc)
inlinenoexcept

Information field size of the SE (IFSC): the largest INF the host puts in one I-block.

Clamped to 1..254. GetAnswerToReset sets it from the SE050's profile (DLLP IFSC).

◆ SetInterFrameDelayMs()

template<typename TransportT >
void se050::T1Session< TransportT >::SetInterFrameDelayMs ( std::uint32_t  ms)
inlinenoexcept

Delay between a completed Write and the first Read of the response.

◆ SetMaxRetransmissions()

template<typename TransportT >
void se050::T1Session< TransportT >::SetMaxRetransmissions ( std::uint8_t  n)
inlinenoexcept

How many times one block is requested or sent again within an exchange before it fails (ISO/IEC 7816-3 11.6.3). Default t1::kDefaultMaxRetransmissions.

◆ SetMaxWtxRequests()

template<typename TransportT >
void se050::T1Session< TransportT >::SetMaxWtxRequests ( std::uint8_t  max_wtx_requests)
inlinenoexcept

Upper bound of tolerated WTX request/response cycles within a single exchange.

◆ SetReadRetries()

template<typename TransportT >
void se050::T1Session< TransportT >::SetReadRetries ( std::uint8_t  retries)
inlinenoexcept

Number of retry attempts for retryable I²C read errors while waiting response blocks.

◆ SetReadRetryDelayMs()

template<typename TransportT >
void se050::T1Session< TransportT >::SetReadRetryDelayMs ( std::uint32_t  ms)
inlinenoexcept

Delay between retryable read attempts (transport polling interval).

◆ Transport() [1/2]

template<typename TransportT >
const TransportT & se050::T1Session< TransportT >::Transport ( ) const
inlinenoexcept

◆ Transport() [2/2]

template<typename TransportT >
TransportT & se050::T1Session< TransportT >::Transport ( )
inlinenoexcept

The documentation for this class was generated from the following file: