forked from collin80/SavvyCAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
framesenderobject.h
81 lines (67 loc) · 1.89 KB
/
framesenderobject.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef FRAMESENDEROBJECT_H
#define FRAMESENDEROBJECT_H
#include <QElapsedTimer>
#include <QTimer>
#include <QHash>
#include <QThread>
#include <QDebug>
#include <QMutex>
#include "can_structs.h"
#include "connections/canconmanager.h"
#include "can_trigger_structs.h"
#include "dbc/dbchandler.h"
class FrameSenderObject : public QObject
{
Q_OBJECT
public:
FrameSenderObject(const QVector<CANFrame> *frames);
~FrameSenderObject();
public slots:
/**
* @brief start the device. This calls piStarted
* @note starts the working thread if required (piStart is called in the working thread context)
*/
void initialize();
/**
* @brief stop the device. This calls piStop
* @note if a working thread is used, piStop is called before exiting the working thread
*/
void finalize();
void startSending();
void stopSending();
void addSendRecord(FrameSendData record);
void removeSendRecord(int idx);
FrameSendData *getSendRecordRef(int idx);
signals:
private slots:
void timerTriggered();
void updatedFrames(int);
private:
QList<CANFrame> sendingList;
int currentPosition;
QTimer *sendingTimer;
QElapsedTimer sendingElapsed;
quint64 sendingLastTimeStamp;
int statusCounter;
QList<FrameSendData> sendingData;
QThread* mThread_p;
QHash<int, CANFrame> frameCache; //hash with frame ID as the key and the most recent frame as the value
const QVector<CANFrame> *modelFrames;
bool inhibitChanged = false;
QMutex mutex;
DBCHandler *dbcHandler;
void doModifiers(int);
int fetchOperand(int, ModifierOperand);
CANFrame* lookupFrame(int, int);
void buildFrameCache();
void processIncomingFrame(CANFrame *frame);
/**
* @brief starts the device
*/
void piStart();
/**
* @brief stops the device
*/
void piStop();
};
#endif // FRAMESENDEROBJECT_H