forked from collin80/SavvyCAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
canlogserver.h
57 lines (45 loc) · 1.11 KB
/
canlogserver.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
#ifndef CANLOGSERVER_H
#define CANLOGSERVER_H
#include <stdio.h>
#include <QCanBusDevice>
#include <QThread>
#include <QTimer>
#include <QTcpSocket>
/*************/
#include <QDateTime>
/*************/
#include "canframemodel.h"
#include "canconnection.h"
#include "canconmanager.h"
class CanLogServer : public CANConnection
{
Q_OBJECT
public:
CanLogServer(QString serverAddress);
virtual ~CanLogServer();
// Interface
protected:
virtual void piStarted();
virtual void piStop();
virtual void piSetBusSettings(int pBusIdx, CANBus pBus);
virtual bool piGetBusSettings(int pBusIdx, CANBus& pBus);
virtual void piSuspend(bool pSuspend);
virtual bool piSendFrame(const CANFrame&);
private slots:
void readNetworkData();
void networkConnected();
void networkDisconnected();
// Utility
private:
void readSettings();
void connectToDevice();
void disconnectFromDevice();
void heartbeat();
// Attributes
protected:
QTcpSocket *m_ptcpSocket = nullptr;
QString m_qsAddress;
// QUdpSocket *_udpClient;
// QTimer *_heartbeatTimer;
};
#endif // CANLOGSERVER_H