This repository has been archived by the owner on Jan 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
mapsearch.h
135 lines (122 loc) · 3.27 KB
/
mapsearch.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
Copyright 2013 Jared Wiltshire
This file is part of PPD Maps.
PPD Maps is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PPD Maps is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PPD Maps. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAPSEARCH_H
#define MAPSEARCH_H
#include <QObject>
#include <QFile>
#include <QByteArray>
#include <QList>
#include <QVector>
#include "util.h"
#include "axis.h"
#include "map.h"
#include "mappreset.h"
typedef struct {
int genericECU;
quint32 dataOffset;
quint32 codeOffset;
quint32 codeStart;
quint32 r2;
int dtcWidth;
int dtcCount;
quint32 dataLower;
quint32 dataUpper;
} ecuDescriptor;
enum {
UNKNOWN_ECU,
PPD,
SID803,
SID803_FORD,
SID803A,
SID803A_VOLVO,
SID201,
SID206,
SID30X,
SID30X_3M
};
enum {
UNKNOWN_MANUFACTURER,
VW,
PEUGEOT,
FORD,
VOLVO,
RENAULT,
NISSAN
};
class mapSearch : public QObject
{
Q_OBJECT
public:
explicit mapSearch(bool discardInvalid = true, QObject *parent = 0);
~mapSearch();
enum addressType {mapAddr, axisAddr, invalidAddr, outOfRangeAddr};
QList<map*>* getMapList();
QString getInfoStr();
int getBdmFileSize();
QString getBdmFilename();
bool fileIsValid();
public slots:
void open_file(QString filename);
void search();
void cancel();
void setDiscardInvalid(bool discard);
private:
QFile* bdm_file;
QByteArray* data;
bool stop;
bool validFile;
addressType examineAddr(quint32 address, bool extraCheck = false);
QList<map*>* mapList;
QList<axis*>* axisList;
QList<int> tableStarts;
bool discardInvalid;
int dtcPtrs;
int dtcCount_table;
int dtcCount_switch;
int manufacturer;
int specificECU;
ecuDescriptor ecu;
QString codeVersion;
QString partNumber;
QString engineInfo;
QString manufacturerStr;
QString ecuType;
QList<quint32> axisAddresses;
bool addMap(map* newMap);
axis* findExistingAxis(axis* newAxis);
bool createMap(quint32 addrMap, quint32 axis1, quint32 axis2);
void idMap(map* aMap, int i);
void checkOverlap();
int durationSearch();
void addDurationMaps(quint32 addr, int groupNum);
int dtcSearch();
void findTableStarts();
template <class fixedSizeInt>
fixedSizeInt readData(quint32 addr);
int switchSearchR2();
int switchSearchDirect();
quint32 findDTCPtrs(quint32 addr);
QString getPCodes(quint32 addr);
bool asmMatch(quint32 addr, quint32 mask[], quint32 value[], int len, int arrayIndex = 0);
bool addSwitches(quint32 addr1, quint32 addr2, quint16 tblIndex);
bool addDTC(quint32 addr);
int getDTCWidth();
void checkR2();
signals:
void log(const QString &text, int level = standardLvl, bool flushBuffer = false);
void resetTableModel();
void fileLoaded();
};
#endif // MAPSEARCH_H