mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
CAN interface
add next mid function
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#include "CAN_interface.hpp"
|
#include "CAN_interface.hpp"
|
||||||
|
|
||||||
CAN_Interface::CAN_Interface(QString dev, QObject *parent)
|
CAN_Interface::CAN_Interface(QString dev, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent), m_mid(0)
|
||||||
{
|
{
|
||||||
if (!QCanBus::instance()->plugins().contains(QStringLiteral("socketcan"))) {
|
if (!QCanBus::instance()->plugins().contains(QStringLiteral("socketcan"))) {
|
||||||
throw std::runtime_error("CAN Interface: socketcan plugin not found");
|
throw std::runtime_error("CAN Interface: socketcan plugin not found");
|
||||||
@@ -33,3 +33,9 @@ void CAN_Interface::send_frame(const QCanBusFrame &frame)
|
|||||||
{
|
{
|
||||||
m_canDevice->writeFrame(frame);
|
m_canDevice->writeFrame(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t CAN_Interface::next_mid()
|
||||||
|
{
|
||||||
|
return m_mid++;
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ class CAN_Interface : public QObject
|
|||||||
~CAN_Interface();
|
~CAN_Interface();
|
||||||
|
|
||||||
void send_frame(const QCanBusFrame &frame);
|
void send_frame(const QCanBusFrame &frame);
|
||||||
|
uint8_t next_mid();
|
||||||
signals:
|
signals:
|
||||||
void frame_received(const QCanBusFrame frame);
|
void frame_received(const QCanBusFrame frame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCanBusDevice *m_canDevice;
|
QCanBusDevice *m_canDevice;
|
||||||
|
uint8_t m_mid;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user