mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Change can interface
Now emits can frames via signal
This commit is contained in:
@@ -16,7 +16,10 @@ CAN_Interface::CAN_Interface(QString dev, QObject *parent)
|
|||||||
|
|
||||||
m_canDevice->connectDevice();
|
m_canDevice->connectDevice();
|
||||||
connect(m_canDevice, &QCanBusDevice::framesReceived, this, [this] {
|
connect(m_canDevice, &QCanBusDevice::framesReceived, this, [this] {
|
||||||
emit frames_received();
|
for (const QCanBusFrame &frame : m_canDevice->readAllFrames())
|
||||||
|
{
|
||||||
|
emit frame_received(frame);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,8 +33,3 @@ void CAN_Interface::send_frame(const QCanBusFrame &frame)
|
|||||||
{
|
{
|
||||||
m_canDevice->writeFrame(frame);
|
m_canDevice->writeFrame(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
QCanBusFrame CAN_Interface::read_frame()
|
|
||||||
{
|
|
||||||
return m_canDevice->readFrame();
|
|
||||||
}
|
|
||||||
@@ -14,9 +14,9 @@ class CAN_Interface : public QObject
|
|||||||
~CAN_Interface();
|
~CAN_Interface();
|
||||||
|
|
||||||
void send_frame(const QCanBusFrame &frame);
|
void send_frame(const QCanBusFrame &frame);
|
||||||
QCanBusFrame read_frame();
|
|
||||||
signals:
|
signals:
|
||||||
void frames_received();
|
void frame_received(const QCanBusFrame frame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCanBusDevice *m_canDevice;
|
QCanBusDevice *m_canDevice;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user