semf
semf::Error Class Reference

Class for representing errors. Every error should have a unique source code. As a user feel encouraged to define your own errors and pass them via error signals and improve your debugging and error handling. More...

#include <error.h>

Collaboration diagram for semf::Error:
Collaboration graph

Public Types

enum  ClassID : uint32_t {
  AnalogDevicesAd5686 = 0 , AnalogDevicesLtc1867 , ArrowControl , BoschBme280 ,
  CanHardware , EepromEmulation , ExternalInterruptHardware , FirmwareHeader ,
  FirmwareUpdater , FimrwareVerifier , FlashLogger , FlashTester ,
  FlashTesterRandom , FlashTesterReader , FlashTesterWriter , FlashVerifier ,
  HammingCode , I2cEeprom , I2cMasterHardware , I2cScanner ,
  I2cSlaveDevice , I2cSlaveHardware , I2cSlaveRegisterDevice , Logger ,
  LoggerEntry , MicrochipSst26vf016b , MicrochipMcp3426 , OnSemiLc709204F ,
  PniRm3100i2c , Printer , Processor , Secded ,
  SoftI2cMaster , SpiMasterHardware , SpiNorFlash , SpiSlaveDevice ,
  SpiSlaveHardware , SpiSlaveRegisterDevice , StmLsm6Dso32I2c , StreamProtocol ,
  Tabulator , TiAds1115 , TiDrv425 , UartHardware ,
  SectionHardwareBegin = 0x08000000 , SectionAnaloginBegin , Stm32AnalogIn , Stm32AnalogInDma ,
  Stm32AnalogInInjected , Esp32AnalogIn , NetX90AnalogIn , NetX90AnalogInDma ,
  SectionAnaloginEnd , SectionAnalogoutBegin , Stm32AnalogOut , Stm32AnalogOutDma ,
  SectionAnalogoutEnd , SectionBootloaderBegin , SectionBootloaderEnd , SectionCanBegin ,
  Stm32Can , Esp32Can , SectionCanEnd , SectionCriticalSectionBegin ,
  SectionCriticalSectionEnd , SectionExternalInterruptBegin , Stm32ExternalInterrupt , NetX90ExternalInterrupt ,
  SectionExternalInterruptEnd , SectionFlashBegin , QtFlash , Stm32Flash ,
  Esp32SpiFlash , VirtualFlash , SectionFlashEnd , SectionGpioBegin ,
  NetX90Gpio , SectionGpioEnd , SectionI2cMasterBegin , Stm32F1I2cMaster ,
  Stm32F3I2cMaster , Stm32F4I2cMaster , Stm32F7I2cMaster , Stm32I2cMaster ,
  Stm32L0I2cMaster , Esp32I2cMaster , NetX90I2cMaster , VirtualI2cMasterHardware ,
  SectionI2cMasterEnd , SectionI2cSlaveBegin , Stm32F1I2cSlave , Stm32F3I2cSlave ,
  Stm32F4I2cSlave , Stm32F7I2cSlave , Stm32I2cSlave , Stm32L0I2cSlave ,
  SectionI2cSlaveEnd , SectionInputCaptureBegin , Stm32InputCapture , SectionInputCaptureEnd ,
  SectionPowerBegin , SectionPowerEnd , SectionPwmBegin , Stm32Pwm ,
  Esp32LedControlPwm , NetX90Pwm , SectionPwmEnd , SectionRtcBegin ,
  Stm32Rtc , SectionRtcEnd , SectionSpiMasterBegin , Stm32SpiMaster ,
  NetX90SpiMaster , VirtualSpiMasterHardware , SectionSpiMasterEnd , SectionSpiSlaveBegin ,
  Stm32SpiSlave , SectionSpiSlaveEnd , SectionTimerBegin , Stm32Timer ,
  Esp32Timer , Esp32TimerPeripheral , NetX90Timer , SectionTimerEnd ,
  SectionOutputCompareBegin , Stm32OutputCompare , SectionOutputCompareEnd , SectionUartBegin ,
  Stm32Uart , Esp32Uart , QtUart , NetX90Uart ,
  VirtualUart , SectionUartEnd , SectionUsbVcpBegin , Stm32F4UsbVcp ,
  Stm32F7UsbVcp , Stm32G0UsbVcp , SectionUsbVcpEnd , SectionHardwareEnd = 0x0FFFFFFF ,
  SectionUserBegin = 0x10000000 , SectionUserEnd = 0xFFFFFFFF
}
 Semf class IDs. More...
 

Public Member Functions

 Error (uint32_t classId, uint8_t errorCode)
 Constructor. More...
 
virtual ~Error ()=default
 
bool isHardwareError () const
 Checks if the error got submitted by a class from the semf-HAL. More...
 
uint32_t classId () const
 Returns the class id from the error. More...
 
uint8_t errorCode () const
 Returns the error code from the error. More...
 

Detailed Description

Class for representing errors. Every error should have a unique source code. As a user feel encouraged to define your own errors and pass them via error signals and improve your debugging and error handling.

Definition at line 21 of file error.h.

Member Enumeration Documentation

◆ ClassID

enum semf::Error::ClassID : uint32_t

Semf class IDs.

Enumerator
AnalogDevicesAd5686 
AnalogDevicesLtc1867 
ArrowControl 
BoschBme280 
CanHardware 
EepromEmulation 
ExternalInterruptHardware 
FirmwareHeader 
FirmwareUpdater 
FimrwareVerifier 
FlashLogger 
FlashTester 
FlashTesterRandom 
FlashTesterReader 
FlashTesterWriter 
FlashVerifier 
HammingCode 
I2cEeprom 
I2cMasterHardware 
I2cScanner 
I2cSlaveDevice 
I2cSlaveHardware 
I2cSlaveRegisterDevice 
Logger 
LoggerEntry 
MicrochipSst26vf016b 
MicrochipMcp3426 
OnSemiLc709204F 
PniRm3100i2c 
Printer 
Processor 
Secded 
SoftI2cMaster 
SpiMasterHardware 
SpiNorFlash 
SpiSlaveDevice 
SpiSlaveHardware 
SpiSlaveRegisterDevice 
StmLsm6Dso32I2c 
StreamProtocol 
Tabulator 
TiAds1115 
TiDrv425 
UartHardware 
SectionHardwareBegin 
SectionAnaloginBegin 
Stm32AnalogIn 
Stm32AnalogInDma 
Stm32AnalogInInjected 
Esp32AnalogIn 
NetX90AnalogIn 
NetX90AnalogInDma 
SectionAnaloginEnd 
SectionAnalogoutBegin 
Stm32AnalogOut 
Stm32AnalogOutDma 
SectionAnalogoutEnd 
SectionBootloaderBegin 
SectionBootloaderEnd 
SectionCanBegin 
Stm32Can 
Esp32Can 
SectionCanEnd 
SectionCriticalSectionBegin 
SectionCriticalSectionEnd 
SectionExternalInterruptBegin 
Stm32ExternalInterrupt 
NetX90ExternalInterrupt 
SectionExternalInterruptEnd 
SectionFlashBegin 
QtFlash 
Stm32Flash 
Esp32SpiFlash 
VirtualFlash 
SectionFlashEnd 
SectionGpioBegin 
NetX90Gpio 
SectionGpioEnd 
SectionI2cMasterBegin 
Stm32F1I2cMaster 
Stm32F3I2cMaster 
Stm32F4I2cMaster 
Stm32F7I2cMaster 
Stm32I2cMaster 
Stm32L0I2cMaster 
Esp32I2cMaster 
NetX90I2cMaster 
VirtualI2cMasterHardware 
SectionI2cMasterEnd 
SectionI2cSlaveBegin 
Stm32F1I2cSlave 
Stm32F3I2cSlave 
Stm32F4I2cSlave 
Stm32F7I2cSlave 
Stm32I2cSlave 
Stm32L0I2cSlave 
SectionI2cSlaveEnd 
SectionInputCaptureBegin 
Stm32InputCapture 
SectionInputCaptureEnd 
SectionPowerBegin 
SectionPowerEnd 
SectionPwmBegin 
Stm32Pwm 
Esp32LedControlPwm 
NetX90Pwm 
SectionPwmEnd 
SectionRtcBegin 
Stm32Rtc 
SectionRtcEnd 
SectionSpiMasterBegin 
Stm32SpiMaster 
NetX90SpiMaster 
VirtualSpiMasterHardware 
SectionSpiMasterEnd 
SectionSpiSlaveBegin 
Stm32SpiSlave 
SectionSpiSlaveEnd 
SectionTimerBegin 
Stm32Timer 
Esp32Timer 
Esp32TimerPeripheral 
NetX90Timer 
SectionTimerEnd 
SectionOutputCompareBegin 
Stm32OutputCompare 
SectionOutputCompareEnd 
SectionUartBegin 
Stm32Uart 
Esp32Uart 
QtUart 
NetX90Uart 
VirtualUart 
SectionUartEnd 
SectionUsbVcpBegin 
Stm32F4UsbVcp 
Stm32F7UsbVcp 
Stm32G0UsbVcp 
SectionUsbVcpEnd 
SectionHardwareEnd 
SectionUserBegin 
SectionUserEnd 

Definition at line 27 of file error.h.

Constructor & Destructor Documentation

◆ Error()

semf::Error::Error ( uint32_t  classId,
uint8_t  errorCode 
)

Constructor.

Parameters
classIdA class Id for identifying the class submitting the error (poor man's RTTI).
errorCodeCode for Identifying the source code location inside the failing class.

Definition at line 14 of file error.cpp.

◆ ~Error()

virtual semf::Error::~Error ( )
virtualdefault

Member Function Documentation

◆ classId()

uint32_t semf::Error::classId ( ) const

Returns the class id from the error.

Returns
A class Id for identifying the class submitting the error (poor man's RTTI).

Definition at line 25 of file error.cpp.

◆ errorCode()

uint8_t semf::Error::errorCode ( ) const

Returns the error code from the error.

Returns
Code for Identifying the source code location inside the failing class.

Definition at line 30 of file error.cpp.

◆ isHardwareError()

bool semf::Error::isHardwareError ( ) const

Checks if the error got submitted by a class from the semf-HAL.

Returns
True if error is from the semf-HAL, false otherwise.

Definition at line 20 of file error.cpp.