There are a TON of explorations I did here, many may be unnecessary, but this is a stake in the ground. The main issue was the strange queue logic in canconmanager::sendFrame which puts the tx data in the rx queue so it will show up in the displayed data. It caused SIGABRT and SIGSEG to show up everywhere. It is NOT fixed yet, but TX works over the wire you just can't see it in the tableview. I thought at first it was only when overwrite data was active, so I put in a a pile of changes to keep frames and filtered frames as two seperate copies of data where frames was always complete and filtered was only what was seen in the mainwindow. It made it so the graphing window would work with overwrite data active which is an improvement. I wouldn't roll these changes back. Because of these changes I had to update the frame sorting code adjust the refresh function in canframemode.cpp I also thought it was related to UI updates, but its not, that's been confirmed. I put a mutex around the custom sender tick timer so that the 1ms timer wouldn't re-enter its callback. This didn't fix the crash, but it sure seems to make a lot of sense, and the way I did it no elasped time is lost for tracking purposes, and in reality theres no way 1ms was consistent anyway. I put a mutex around the shrinking of frames and filteredframes to make sure we weren't deleting at the same time as accessing, but honestly we acccess those lists in many places without semaphores so that probably did nothing. Fixed a bug in FrameSenderWindow:DoModifiers that was improperly parsing and sometimes crashing when looking for the ~ operator before a symbol. Also added some minor work to keep row expansion functioning when changing filters or sorting. Need to make some tweaks so it stops trying so hard when overwrite is not active Theres also code in main.c taht makes debugging output super verbose. Committing now to start cleanup
211 lines
6.3 KiB
C++
211 lines
6.3 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include "config.h"
|
|
#include <QMainWindow>
|
|
#include <QSerialPort>
|
|
#include <QSerialPortInfo>
|
|
#include "canframemodel.h"
|
|
#include "can_structs.h"
|
|
#include "framefileio.h"
|
|
#include "dbc/dbchandler.h"
|
|
#include "bus_protocols/isotp_handler.h"
|
|
|
|
#include "re/graphingwindow.h"
|
|
#include "re/frameinfowindow.h"
|
|
#include "frameplaybackwindow.h"
|
|
#include "bisectwindow.h"
|
|
#include "re/flowviewwindow.h"
|
|
#include "framesenderwindow.h"
|
|
#include "re/filecomparatorwindow.h"
|
|
#include "dbc/dbcmaineditor.h"
|
|
#include "mainsettingsdialog.h"
|
|
#include "firmwareuploaderwindow.h"
|
|
#include "re/discretestatewindow.h"
|
|
#include "scriptingwindow.h"
|
|
#include "re/rangestatewindow.h"
|
|
#include "dbc/dbcloadsavewindow.h"
|
|
#include "re/fuzzingwindow.h"
|
|
#include "re/udsscanwindow.h"
|
|
#include "re/sniffer/snifferwindow.h"
|
|
#include "re/isotp_interpreterwindow.h"
|
|
#include "motorcontrollerconfigwindow.h"
|
|
#include "signalviewerwindow.h"
|
|
#include "re/temporalgraphwindow.h"
|
|
#include "re/dbccomparatorwindow.h"
|
|
|
|
class CANConnection;
|
|
class ConnectionWindow;
|
|
class ISOTP_InterpreterWindow;
|
|
class ScriptingWindow;
|
|
|
|
namespace Ui {
|
|
class MainWindow;
|
|
}
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWindow(QWidget *parent = 0);
|
|
static QString loadedFileName;
|
|
static MainWindow *getReference();
|
|
CANFrameModel * getCANFrameModel();
|
|
~MainWindow();
|
|
|
|
void handleDroppedFile(const QString &filename);
|
|
|
|
private slots:
|
|
void handleLoadFile();
|
|
void handleSaveFile();
|
|
void handleSaveFilteredFile();
|
|
void handleSaveFilters();
|
|
void handleLoadFilters();
|
|
void handleContinousLogging();
|
|
void showGraphingWindow();
|
|
void showFrameDataAnalysis();
|
|
void clearFrames();
|
|
void expandAllRows();
|
|
void collapseAllRows();
|
|
void showPlaybackWindow();
|
|
void showFlowViewWindow();
|
|
void showFrameSenderWindow();
|
|
void showSingleMultiWindow();
|
|
void showRangeWindow();
|
|
void showFuzzyScopeWindow();
|
|
void showComparisonWindow();
|
|
void showSettingsDialog();
|
|
void showFirmwareUploaderWindow();
|
|
void showConnectionSettingsWindow();
|
|
void showScriptingWindow();
|
|
void showDBCFileWindow();
|
|
void showFuzzingWindow();
|
|
void showMCConfigWindow();
|
|
void showUDSScanWindow();
|
|
void showISOInterpreterWindow();
|
|
void showSnifferWindow();
|
|
void showBisectWindow();
|
|
void showSignalViewer();
|
|
void showTemporalGraphWindow();
|
|
void showDBCComparisonWindow();
|
|
void exitApp();
|
|
void handleSaveDecoded();
|
|
void connectionStatusUpdated(int conns);
|
|
void gridClicked(QModelIndex);
|
|
void gridDoubleClicked(QModelIndex);
|
|
void gridContextMenuRequest(QPoint pos);
|
|
void setupAddToNewGraph();
|
|
void setupSendToLatestGraphWindow();
|
|
void interpretToggled(bool);
|
|
void overwriteToggled(bool);
|
|
void presistentFiltersToggled(bool state);
|
|
void logReceivedFrame(CANConnection*, QVector<CANFrame>);
|
|
void tickGUIUpdate();
|
|
void toggleCapture();
|
|
void normalizeTiming();
|
|
void updateFilterList();
|
|
void filterListItemChanged(QListWidgetItem *item);
|
|
void busFilterListItemChanged(QListWidgetItem *item);
|
|
void filterSetAll();
|
|
void filterClearAll();
|
|
void headerClicked (int logicalIndex);
|
|
void DBCSettingsUpdated();
|
|
|
|
public slots:
|
|
void gotFrames(int);
|
|
void updateSettings();
|
|
void readUpdateableSettings();
|
|
void gotCenterTimeID(uint32_t ID, double timestamp);
|
|
void updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1);
|
|
|
|
signals:
|
|
void sendCANFrame(const CANFrame *, int);
|
|
void suspendCapturing(bool);
|
|
|
|
//-1 = frames cleared, -2 = a new file has been loaded (so all frames are different), otherwise # of new frames
|
|
void framesUpdated(int numFrames); //something has updated the frame list (send at gui update frequency)
|
|
void frameUpdateRapid(int numFrames);
|
|
void settingsUpdated();
|
|
void sendCenterTimeID(uint32_t ID, double timestamp);
|
|
|
|
private:
|
|
Ui::MainWindow *ui;
|
|
static MainWindow *selfRef;
|
|
|
|
//canbus related data
|
|
CANFrameModel *model;
|
|
DBCHandler *dbcHandler;
|
|
QByteArray inputBuffer;
|
|
QTimer updateTimer;
|
|
QElapsedTimer *elapsedTime;
|
|
int framesPerSec;
|
|
int rxFrames;
|
|
bool inhibitFilterUpdate;
|
|
bool useHex;
|
|
bool allowCapture;
|
|
bool secondsMode;
|
|
bool millisMode;
|
|
bool useSystemClock;
|
|
bool ignoreDBCColors;
|
|
bool bDirty; //have frames been added or subtracted since the last save/load?
|
|
bool useFiltered; //should sub-windows use the unfiltered or filtered frames list?
|
|
|
|
bool continuousLogging;
|
|
int continuousLogFlushCounter;
|
|
|
|
//References to other windows we can display
|
|
|
|
//Graph window is allowed to instantiate more than once. All the rest are not (yet).
|
|
GraphingWindow *lastGraphingWindow;
|
|
QList<GraphingWindow *> graphWindows;
|
|
|
|
FrameInfoWindow *frameInfoWindow;
|
|
FramePlaybackWindow *playbackWindow;
|
|
FlowViewWindow *flowViewWindow;
|
|
FrameSenderWindow *frameSenderWindow;
|
|
DBCMainEditor *dbcMainEditor;
|
|
FileComparatorWindow *comparatorWindow;
|
|
MainSettingsDialog *settingsDialog;
|
|
DiscreteStateWindow *discreteStateWindow;
|
|
FirmwareUploaderWindow *firmwareUploaderWindow;
|
|
ConnectionWindow *connectionWindow;
|
|
ScriptingWindow *scriptingWindow;
|
|
RangeStateWindow *rangeWindow;
|
|
DBCLoadSaveWindow *dbcFileWindow;
|
|
FuzzingWindow *fuzzingWindow;
|
|
UDSScanWindow *udsScanWindow;
|
|
ISOTP_InterpreterWindow *isoWindow;
|
|
SnifferWindow* snifferWindow;
|
|
MotorControllerConfigWindow *motorctrlConfigWindow;
|
|
BisectWindow* bisectWindow;
|
|
SignalViewerWindow *signalViewerWindow;
|
|
TemporalGraphWindow *temporalGraphWindow;
|
|
DBCComparatorWindow *dbcComparatorWindow;
|
|
|
|
//various private storage
|
|
QLabel lbStatusConnected;
|
|
QLabel lbStatusFilename;
|
|
QLabel lbStatusDatabase;
|
|
QLabel lbHelp;
|
|
int normalRowHeight;
|
|
bool isConnected;
|
|
QPoint contextMenuPosition;
|
|
bool rowExpansionActive = false;
|
|
|
|
//private methods
|
|
QString getSignalNameFromPosition(QPoint pos);
|
|
uint32_t getMessageIDFromPosition(QPoint pos);
|
|
void saveDecodedTextFile(QString);
|
|
void addFrameToDisplay(CANFrame &, bool);
|
|
void updateFileStatus();
|
|
void closeEvent(QCloseEvent *event);
|
|
void killEmAll();
|
|
void killWindow(QDialog *win);
|
|
void readSettings();
|
|
void writeSettings();
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|