forked from collin80/SavvyCAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisotp_handler.h
56 lines (49 loc) · 1.44 KB
/
isotp_handler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <Qt>
#include <QObject>
#include <QDebug>
#include <QTimer>
#include "can_structs.h"
#include "mainwindow.h"
#include "canframemodel.h"
#include "isotp_message.h"
#include "canfilter.h"
class ISOTP_HANDLER : public QObject
{
Q_OBJECT
public:
ISOTP_HANDLER();
~ISOTP_HANDLER();
void setExtendedAddressing(bool mode);
void setReception(bool mode); //set whether to accept and forward frames or not
void setEmitPartials(bool mode);
void sendISOTPFrame(int bus, int ID, QByteArray data);
void setProcessAll(bool state);
void setFlowCtrl(bool state);
void addFilter(int pBusId, uint32_t ID, uint32_t mask);
void removeFilter(int pBusId, uint32_t ID, uint32_t mask);
void clearAllFilters();
public slots:
void updatedFrames(int);
void rapidFrames(const CANConnection* conn, const QVector<CANFrame>& pFrames);
void frameTimerTick();
signals:
void newISOMessage(ISOTP_MESSAGE msg);
private:
QHash<uint32_t, ISOTP_MESSAGE> messageBuffer;
QList<CANFrame> sendingFrames;
QList<CANFilter> filters;
const QVector<CANFrame> *modelFrames;
bool useExtendedAddressing;
bool isReceiving;
bool waitingForFlow;
int framesUntilFlow;
bool processAll;
bool issueFlowMsgs;
bool sendPartialMessages;
QTimer frameTimer;
uint32_t lastSenderID;
uint32_t lastSenderBus;
void processFrame(const CANFrame &frame);
void checkNeedFlush(uint64_t ID);
};