Major refactoring of ISOTP and UDS code to be more generic and have
better functionality.
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
#ifndef ISOTP_DECODER_H
|
||||
#define ISOTP_DECODER_H
|
||||
#ifndef ISOTP_HANDLER_H
|
||||
#define ISOTP_HANDLER_H
|
||||
|
||||
#include <Qt>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include "can_structs.h"
|
||||
#include "mainwindow.h"
|
||||
#include "canframemodel.h"
|
||||
|
||||
struct CODE_STRUCT
|
||||
//the same as the CANFrame struct but with arbitrary data size.
|
||||
struct ISOTP_MESSAGE
|
||||
{
|
||||
int code;
|
||||
QString shortDesc;
|
||||
QString longDesc;
|
||||
public:
|
||||
uint32_t ID;
|
||||
int bus;
|
||||
bool extended;
|
||||
bool isReceived;
|
||||
int len; //# of bytes this message should have (as reported)
|
||||
int actualSize; //# we actually got
|
||||
QVector<unsigned char> data;
|
||||
uint64_t timestamp;
|
||||
};
|
||||
|
||||
class ISOTP_HANDLER : public QObject
|
||||
@@ -18,11 +27,15 @@ class ISOTP_HANDLER : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ISOTP_HANDLER(const QVector<CANFrame> *frames, QObject *parent = 0);
|
||||
ISOTP_HANDLER();
|
||||
void setExtendedAddressing(bool mode);
|
||||
static ISOTP_HANDLER* getInstance();
|
||||
void setReception(bool mode); //set whether to accept and forward frames or not
|
||||
void sendISOTPFrame(int bus, int ID, QVector<unsigned char> data);
|
||||
|
||||
public slots:
|
||||
void updatedFrames(int);
|
||||
void rapidFrames(const CANConnection* conn, const QVector<CANFrame>& pFrames);
|
||||
|
||||
signals:
|
||||
void newISOMessage(ISOTP_MESSAGE &msg);
|
||||
@@ -31,9 +44,12 @@ private:
|
||||
QList<ISOTP_MESSAGE> messageBuffer;
|
||||
const QVector<CANFrame> *modelFrames;
|
||||
bool useExtendedAddressing;
|
||||
bool isReceiving;
|
||||
|
||||
void processFrame(const CANFrame &frame);
|
||||
void checkNeedFlush(uint64_t ID);
|
||||
|
||||
static ISOTP_HANDLER* mInstance;
|
||||
};
|
||||
|
||||
#endif // ISOTP_DECODER_H
|
||||
#endif // ISOTP_HANDLER_H
|
||||
|
||||
Reference in New Issue
Block a user