semf
semf::app::Communication Class Referenceabstract

This interface standardized the read and write interface for communication hardware like CAN, SPI and protocols. More...

#include <communication.h>

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

Public Member Functions

virtual ~Communication ()=default
 
virtual void write (const uint8_t data[], size_t dataSize)=0
 For writing data, dataWritten signal will be emitted after successful write. More...
 
virtual void read (uint8_t buffer[], size_t bufferSize)=0
 For reading data, dataAvailable signal will be emitted after successful read. More...
 
virtual void stopRead ()=0
 
virtual void stopWrite ()=0
 
virtual bool isBusyReading () const =0
 Communication hardware is busy reading at the moment. More...
 
virtual bool isBusyWriting () const =0
 Communication hardware is busy writing at the moment. More...
 

Public Attributes

Signal dataWritten
 
Signal dataAvailable
 
Signal writeStopped
 
Signal readStopped
 
Signal< Errorerror
 

Detailed Description

This interface standardized the read and write interface for communication hardware like CAN, SPI and protocols.

Definition at line 24 of file communication.h.

Constructor & Destructor Documentation

◆ ~Communication()

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

Member Function Documentation

◆ isBusyReading()

virtual bool semf::app::Communication::isBusyReading ( ) const
pure virtual

Communication hardware is busy reading at the moment.

Returns
State of the communication hardware.

Implemented in semf::CanHardware, semf::I2cMasterHardware, semf::I2cSlaveHardware, semf::SpiMasterHardware, semf::SpiSlaveHardware, and semf::UartHardware.

◆ isBusyWriting()

virtual bool semf::app::Communication::isBusyWriting ( ) const
pure virtual

Communication hardware is busy writing at the moment.

Returns
State of the communication hardware.

Implemented in semf::CanHardware, semf::I2cMasterHardware, semf::I2cSlaveHardware, semf::SpiMasterHardware, semf::SpiSlaveHardware, and semf::UartHardware.

◆ read()

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

For reading data, dataAvailable signal will be emitted after successful read.

Parameters
bufferBuffer to store received bytes in.
bufferSizeSize of receive buffer.

Implemented in semf::CanHardware, semf::I2cMasterHardware, semf::I2cSlaveHardware, semf::SpiMasterHardware, semf::SpiSlaveHardware, and semf::UartHardware.

◆ stopRead()

virtual void semf::app::Communication::stopRead ( )
pure virtual

Stops the read process as fast as possible without destroying anything. The readStopped Signal gets emitted if the call was successful.

Implemented in semf::SoftI2cMaster, semf::SpiMasterHardware, semf::SpiSlaveHardware, semf::Stm32Can, semf::Stm32I2cMaster, semf::Stm32I2cSlave, and semf::Stm32Uart.

◆ stopWrite()

virtual void semf::app::Communication::stopWrite ( )
pure virtual

Stops the write process as fast as possible without destroying anything. The writeStopped Signal gets emitted if the call was successful.

Implemented in semf::SoftI2cMaster, semf::SpiMasterHardware, semf::SpiSlaveHardware, semf::Stm32Can, semf::Stm32I2cMaster, semf::Stm32I2cSlave, and semf::Stm32Uart.

◆ write()

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

For writing data, dataWritten signal will be emitted after successful write.

Parameters
dataArray, containing data to write.
dataSizeSize of write data.

Implemented in semf::CanHardware, semf::I2cMasterHardware, semf::I2cSlaveHardware, semf::SpiMasterHardware, semf::SpiSlaveHardware, and semf::UartHardware.

Member Data Documentation

◆ dataAvailable

Signal semf::app::Communication::dataAvailable

Signal is emitted after size of data from called read() function are received.

Definition at line 58 of file communication.h.

◆ dataWritten

Signal semf::app::Communication::dataWritten

Signal is emitted after data from called write() function are written.

Definition at line 56 of file communication.h.

◆ error

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

Signal is emitted if any error happens in the communication hardware or hardware abstraction layer.

Definition at line 64 of file communication.h.

◆ readStopped

Signal semf::app::Communication::readStopped

Signal is emitted after writing was canceled by stopRead().

Definition at line 62 of file communication.h.

◆ writeStopped

Signal semf::app::Communication::writeStopped

Signal is emitted after writing was canceled by stopWrite().

Definition at line 60 of file communication.h.