forked from lishen2/isotp-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
can.h
48 lines (38 loc) · 901 Bytes
/
can.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
#ifndef CAN_H
#define CAN_H
#include <QObject>
#include <QCanBus>
#include <QDir>
#include <QProcess>
#include <QTimer>
#include <QDebug>
class Can : public QObject
{
Q_OBJECT
public:
explicit Can(QObject *parent = nullptr);
~Can();
void init();
void connect_device();
void disconnect_device();
void send_frame(QCanBusFrame frame);
void set_device_name(QString deviceName);
bool connect_socket();
private:
static const QString serverName;
QTimer *timeout = nullptr;
QCanBusDevice *can_device = nullptr;
void socket_received();
void new_client_connected();
void message_from_client();
QString deviceName;
void get_frame();
void send_heartbeat();
signals:
void new_frame(QCanBusFrame);
void error(QString);
void device_up();
void device_down();
void available_devices(QStringList);
};
#endif // CAN_H