Keypop Storage Card C++ API - 1.2.0
Component of the Keypop C++ API
keypop::storagecard::card::StorageCard Class Referenceabstract

Represents a storage card with various methods to retrieve information and data from it. More...

#include <keypop/storagecard/card/StorageCard.hpp>

Inheritance diagram for keypop::storagecard::card::StorageCard:
Collaboration diagram for keypop::storagecard::card::StorageCard:

Public Member Functions

virtual ~StorageCard ()=default
 
virtual ProductType getProductType () const =0
 Returns the product type of the storage card. More...
 
virtual std::vector< uint8_t > getUID () const =0
 Retrieves the unique identifier (UID) of the storage card. More...
 
virtual std::shared_ptr< std::vector< uint8_t > > getSystemBlock () const =0
 Retrieves the system block from the storage card when available. More...
 
virtual std::vector< uint8_t > getBlock (int blockAddress) const =0
 Retrieves the data block at the specified block address. More...
 
virtual std::vector< uint8_t > getBlocks (int fromBlockAddress, int toBlockAddress) const =0
 Retrieves the data blocks within the specified range from the memory image of the storage card. More...
 

Detailed Description

Represents a storage card with various methods to retrieve information and data from it.

Since
1.0.0

Definition at line 32 of file StorageCard.hpp.

Constructor & Destructor Documentation

◆ ~StorageCard()

virtual keypop::storagecard::card::StorageCard::~StorageCard ( )
virtualdefault

Member Function Documentation

◆ getBlock()

virtual std::vector< uint8_t > keypop::storagecard::card::StorageCard::getBlock ( int  blockAddress) const
pure virtual

Retrieves the data block at the specified block address.

If the block has not been previously read and stored in memory, the returned byte array will be filled with zeros.

Parameters
blockAddressThe address of the block to retrieve.
Returns
The data block as a byte array, or a zero-filled byte array if the block has not been read yet.
Exceptions
IndexOutOfBoundsExceptionIf the block address is out of range.
Since
1.0.0

◆ getBlocks()

virtual std::vector< uint8_t > keypop::storagecard::card::StorageCard::getBlocks ( int  fromBlockAddress,
int  toBlockAddress 
) const
pure virtual

Retrieves the data blocks within the specified range from the memory image of the storage card.

The returned array contains the blocks in order, from fromBlockAddress to toBlockAddress. If a block has not been previously read and stored in memory, its corresponding bytes in the returned array will be filled with zeros.

Parameters
fromBlockAddressThe starting block address (inclusive).
toBlockAddressThe ending block address (inclusive).
Returns
A byte array containing the data blocks within the specified range. Unread blocks are represented as zero-filled sections in the returned array.
Exceptions
IndexOutOfBoundsExceptionIf fromBlockAddress is greater than toBlockAddress, if either block address is negative, or if they exceed the available range of the memory image.
Since
1.0.0

◆ getProductType()

virtual ProductType keypop::storagecard::card::StorageCard::getProductType ( ) const
pure virtual

Returns the product type of the storage card.

Returns
The product type of the storage card.
Since
1.0.0

◆ getSystemBlock()

virtual std::shared_ptr< std::vector< uint8_t > > keypop::storagecard::card::StorageCard::getSystemBlock ( ) const
pure virtual

Retrieves the system block from the storage card when available.

The system block contains card-specific metadata and configuration data such as access control settings. This feature is specific to ST25/SRT512 cards which provide access to a system block at address 255.

The system block must have been previously read using the StorageCardSelectionExtension::prepareSt25ReadSystemBlock() method (or the deprecated StorageCardTransactionManager::prepareReadSystemBlock() method).

Returns
The system block data as a byte array, or nullptr if the system block has not been read yet.
Exceptions
std::logic_errorIf the current card type does not support system block access.
Since
1.0.0

◆ getUID()

virtual std::vector< uint8_t > keypop::storagecard::card::StorageCard::getUID ( ) const
pure virtual

Retrieves the unique identifier (UID) of the storage card.

Returns
A byte array representing the UID of the storage card.
Since
1.0.0

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