CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
CanDevice Class Reference

The class provides abstraction layer for CAN BUS hardware. More...

#include <candevice.h>

Inheritance diagram for CanDevice:
Collaboration diagram for CanDevice:

Public Slots

void sendFrame (const QCanBusFrame &frame)
 
void startSimulation () override
 
void stopSimulation () override
 
void simBcastRcv (const QJsonObject &msg, const QVariant &param) override
 

Signals

void frameReceived (const QCanBusFrame &frame)
 
void frameSent (bool status, const QCanBusFrame &frame)
 
void mainWidgetDockToggled (QWidget *widget) override
 
void simBcastSnd (const QJsonObject &msg, const QVariant &param=QVariant()) override
 

Public Member Functions

 CanDevice ()
 
 CanDevice (CanDeviceCtx &&ctx)
 
 ~CanDevice ()
 
bool init ()
 Configures CAN BUS backend and interface. More...
 
QWidget * mainWidget () override
 
void setConfig (const QJsonObject &json) override
 
void setConfig (const QWidget &qobject) override
 
QJsonObject getConfig () const override
 
std::shared_ptr< QWidget > getQConfig () const override
 
virtual void configChanged () override
 
bool mainWidgetDocked () const override
 
ComponentProperties getSupportedProperties () const override
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual void mainWidgetDockToggled (QWidget *widget)=0
 Signal to be implemented by Component. Indicates when dock/undock action was invoked. More...
 
virtual void stopSimulation ()=0
 Slot to be implemented by Component to execute simulation stop action. More...
 
virtual void startSimulation ()=0
 Slot to be implemented by Component to execute simulation start action. More...
 
virtual void setConfig (const QJsonObject &json)=0
 Sets configuration for component. More...
 
virtual void setConfig (const QWidget &qobject)=0
 Sets configuration for component. More...
 
virtual void configChanged ()=0
 Reconfigure component if necessary. More...
 
virtual QJsonObject getConfig () const =0
 Gets current component configuation. More...
 
virtual std::shared_ptr< QWidget > getQConfig () const =0
 Gets current component configuation. More...
 
virtual ComponentProperties getSupportedProperties () const =0
 
virtual QWidget * mainWidget ()=0
 Gets components's main widget. More...
 
virtual bool mainWidgetDocked () const =0
 Main widget docking status. More...
 
virtual void simBcastSnd (const QJsonObject &msg, const QVariant &param=QVariant())=0
 
virtual void simBcastRcv (const QJsonObject &msg, const QVariant &param)=0
 

Additional Inherited Members

- Public Types inherited from ComponentInterface
using PropertyEditable = bool
 
using CustomEditFieldCbk = std::function< QWidget *(void)>
 
using ComponentProperty = std::tuple< QString, QVariant::Type, PropertyEditable, CustomEditFieldCbk >
 
using ComponentProperties = std::vector< ComponentProperty >
 
using PropertyContainer = std::map< QString, QVariant >
 
- Static Public Member Functions inherited from ComponentInterface
static constexpr const QString & propertyName (const ComponentProperty &p)
 
static constexpr const QVariant::Type & propertyType (const ComponentProperty &p)
 
static constexpr const PropertyEditablepropertyEditability (const ComponentProperty &p)
 
static constexpr const CustomEditFieldCbkpropertyField (const ComponentProperty &p)
 

Detailed Description

The class provides abstraction layer for CAN BUS hardware.

Constructor & Destructor Documentation

◆ CanDevice() [1/2]

CanDevice::CanDevice ( )
explicit

◆ CanDevice() [2/2]

CanDevice::CanDevice ( CanDeviceCtx &&  ctx)
explicit

◆ ~CanDevice()

CanDevice::~CanDevice ( )

Member Function Documentation

◆ configChanged()

void CanDevice::configChanged ( )
overridevirtual

◆ frameReceived

void CanDevice::frameReceived ( const QCanBusFrame &  frame)
signal

◆ frameSent

void CanDevice::frameSent ( bool  status,
const QCanBusFrame &  frame 
)
signal

◆ getConfig()

QJsonObject CanDevice::getConfig ( ) const
overridevirtual

◆ getQConfig()

std::shared_ptr< QWidget > CanDevice::getQConfig ( ) const
overridevirtual

◆ getSupportedProperties()

ComponentInterface::ComponentProperties CanDevice::getSupportedProperties ( ) const
overridevirtual

◆ init()

bool CanDevice::init ( )

Configures CAN BUS backend and interface.

This function configures QtCanBus class with backend and interface values stored in properties.

Returns
true on success, false on failure

◆ mainWidget()

QWidget * CanDevice::mainWidget ( )
overridevirtual

◆ mainWidgetDocked()

bool CanDevice::mainWidgetDocked ( ) const
overridevirtual

◆ mainWidgetDockToggled

void CanDevice::mainWidgetDockToggled ( QWidget *  widget)
overridesignal

◆ sendFrame

void CanDevice::sendFrame ( const QCanBusFrame &  frame)
slot

◆ setConfig() [1/2]

void CanDevice::setConfig ( const QJsonObject &  json)
overridevirtual

◆ setConfig() [2/2]

void CanDevice::setConfig ( const QWidget &  qobject)
overridevirtual

◆ simBcastRcv

void CanDevice::simBcastRcv ( const QJsonObject &  msg,
const QVariant &  param 
)
overrideslot

◆ simBcastSnd

void CanDevice::simBcastSnd ( const QJsonObject &  msg,
const QVariant &  param = QVariant() 
)
overridesignal

◆ startSimulation

void CanDevice::startSimulation ( )
overrideslot

◆ stopSimulation

void CanDevice::stopSimulation ( )
overrideslot

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