semf
semf::app::Storage Class Referenceabstract

Interface for using storage memories/devices (e.g. FLASH or EEPROM). More...

#include <storage.h>

Inheritance diagram for semf::app::Storage:
Inheritance graph
Collaboration diagram for semf::app::Storage:
Collaboration graph

Public Member Functions

virtual ~Storage ()=default
 
virtual void write (uint32_t address, const uint8_t data[], size_t dataSize)=0
 Writes data into the storage. More...
 
virtual void read (uint32_t address, uint8_t buffer[], size_t bufferSize)=0
 Reads data from the storage into a given read buffer. More...
 
virtual bool isBusy () const =0
 Returns if the storage is busy reading, writing or e.g. erasing. More...
 

Public Attributes

Signal dataAvailable
 
Signal dataWritten
 
Signal< Errorerror
 

Detailed Description

Interface for using storage memories/devices (e.g. FLASH or EEPROM).

Definition at line 24 of file storage.h.

Constructor & Destructor Documentation

◆ ~Storage()

virtual semf::app::Storage::~Storage ( )
virtualdefault

Member Function Documentation

◆ isBusy()

virtual bool semf::app::Storage::isBusy ( ) const
pure virtual

Returns if the storage is busy reading, writing or e.g. erasing.

Returns
true for busy, otherwise false.

Implemented in semf::Stm32Flash.

◆ read()

virtual void semf::app::Storage::read ( uint32_t  address,
uint8_t  buffer[],
size_t  bufferSize 
)
pure virtual

Reads data from the storage into a given read buffer.

  • dataAvailable signal will be emitted for all data are read.
  • error signal will be emitted if an error occurred.
Parameters
addressThe address from which the data will be read.
bufferPointer at which the read data is stored.
bufferSizeSize of the data to be read in bytes.

Implemented in semf::Stm32Flash.

◆ write()

virtual void semf::app::Storage::write ( uint32_t  address,
const uint8_t  data[],
size_t  dataSize 
)
pure virtual

Writes data into the storage.

  • dataWritten signal will be emitted for all data are written.
  • error signal will be emitted if an error occurred.
Parameters
addressThe address where the data will be written to.
dataPointer to the data to be written.
dataSizeSize of data to be written in bytes.

Implemented in semf::Stm32Flash.

Member Data Documentation

◆ dataAvailable

Signal semf::app::Storage::dataAvailable

The signal is triggered after the data has been read completely.

Definition at line 53 of file storage.h.

◆ dataWritten

Signal semf::app::Storage::dataWritten

The signal is triggered after the data has been written completely.

Definition at line 54 of file storage.h.

◆ error

Signal<Error> semf::app::Storage::error

The signal is triggered after an error occurred.

Definition at line 55 of file storage.h.