A partial commit that changes CANFrame over to be based on

QCanBusFrame so that things are more compatible with other Qt based
CAN bus code. Not complete yet but getting there.
This commit is contained in:
Collin Kidder
2019-12-11 21:17:33 -05:00
parent 29b635a009
commit 0baffa300f
22 changed files with 272 additions and 278 deletions
+10 -13
View File
@@ -4,35 +4,32 @@
#include <QObject>
#include <QVector>
#include <stdint.h>
#include <QCanBusFrame>
struct CANFrame
//Now inherits from the built-in CAN frame class from Qt. This should be more future proof and easier to integrate with other code
struct CANFrame : public QCanBusFrame
{
public:
uint32_t ID;
int bus;
bool extended;
bool remote;
bool isReceived; //did we receive this or send it?
int len;
unsigned char data[8];
uint64_t timestamp;
uint64_t timedelta;
uint32_t frameCount; //used in overwrite mode
friend bool operator<(const CANFrame& l, const CANFrame& r)
{
return l.timestamp < r.timestamp;
qint64 lStamp = l.timeStamp().seconds() * 1000000 + l.timeStamp().microSeconds();
qint64 rStamp = r.timeStamp().seconds() * 1000000 + r.timeStamp().microSeconds();
return lStamp < rStamp;
}
CANFrame()
{
ID = 0;
setFrameId(0);
bus = 0;
extended = false;
remote = false;
setExtendedFrameFormat(false);
setFrameType(QCanBusFrame::DataFrame);
isReceived = true;
len = 0;
timestamp = 0;
timedelta = 0;
frameCount = 1;
}