forked from collin80/SavvyCAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blfhandler.h
79 lines (69 loc) · 1.43 KB
/
blfhandler.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
#ifndef BLFHANDLER_H
#define BLFHANDLER_H
#include <Qt>
#include <QByteArray>
#include <QList>
#include "can_structs.h"
enum
{
BLF_CAN_MSG = 1,
BLF_CAN_ERR = 2,
BLF_CONTAINER = 10,
BLF_GLOBAL_MARKER = 96,
};
struct BLF_FILE_HEADER
{
uint32_t sig;
uint32_t headerSize;
uint8_t appID;
uint8_t appVerMajor;
uint8_t appVerMinor;
uint8_t appVerBuild;
uint8_t binLogVerMajor;
uint8_t binLogVerMinor;
uint8_t binLogVerBuild;
uint8_t binLogVerPatch;
uint64_t fileSize;
uint64_t uncompressedFileSize;
uint32_t countObjs;
uint32_t countObjsRead;
uint8_t startTime[16];
uint8_t stopTime[16];
uint8_t unused[72];
}; //144 bytes
struct BLF_OBJ_HEADER
{
uint32_t sig; //0 offset from start
uint16_t headerSize; //4
uint16_t headerVersion; //6
uint32_t objSize; //8
uint32_t objType; //12
uint32_t flags; //16
uint16_t nothing; //20
uint16_t objVer; //22
uint64_t uncompSize; //24
}; //32 bytes
struct BLF_OBJECT
{
BLF_OBJ_HEADER header;
QByteArray data;
};
struct BLF_CAN_OBJ
{
uint16_t channel;
uint8_t flags;
uint8_t dlc;
uint32_t id;
uint8_t data[8];
};
class BLFHandler
{
public:
BLFHandler();
bool loadBLF(QString filename, QVector<CANFrame>* frames);
bool saveBLF(QString filename, QVector<CANFrame>* frames);
private:
BLF_FILE_HEADER header;
QList<BLF_OBJECT> objects;
};
#endif // BLFHANDLER_H