#ifndef ISOTP_HANDLER_H #define ISOTP_HANDLER_H #include #include #include #include "can_structs.h" #include "mainwindow.h" #include "canframemodel.h" //the same as the CANFrame struct but with arbitrary data size. struct ISOTP_MESSAGE { 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 data; uint64_t timestamp; }; class ISOTP_HANDLER : public QObject { Q_OBJECT public: 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 data); public slots: void updatedFrames(int); void rapidFrames(const CANConnection* conn, const QVector& pFrames); signals: void newISOMessage(ISOTP_MESSAGE &msg); private: QList messageBuffer; const QVector *modelFrames; bool useExtendedAddressing; bool isReceiving; void processFrame(const CANFrame &frame); void checkNeedFlush(uint64_t ID); static ISOTP_HANDLER* mInstance; }; #endif // ISOTP_HANDLER_H