-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmainwindow.h
More file actions
545 lines (482 loc) · 28.1 KB
/
mainwindow.h
File metadata and controls
545 lines (482 loc) · 28.1 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
/* OPConfig Configuration program for the Open Panzer TCB (Tank Control Board)
* Source: openpanzer.org
* Authors: Luke Middleton
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMessageBox>
#include <QLabel>
#include <QFrame>
#include <QDebug>
#include <QLineEdit>
#include <QProgressBar>
#include <QStringList> // Class of string lists
#include <QStringListModel> // String list model, for creating simple text models to populate listviews, etc.
#include <QAbstractItemView>
#include <QSerialPort>
#include <QSerialPortInfo> // Serial port info, used to populate the drop-down list of COM Ports
#include <QFileDialog.h>
#include <QSignalMapper>
#include <QSortFilterProxyModel>
#include <QGraphicsOpacityEffect>
#include <QPropertyAnimation>
#include <QTimer>
#include <QProcess>
#include <QScrollBar>
#include <QFileInfo>
#include <QPixmap>
#include <QCommandLineParser>
#include <QStandardPaths>
#include <QSettings>
#include <combo_drivetype.h> // My custom drive type combo box
#include <combo_channelorder.h>
#include <combo_baudrates.h>
#include <combo_specialfunction.h>
#include <combo_analogdigital.h>
#include <combo_auxchannelpositions.h>
#include <tablemodel_functiontriggers.h>
#include <getopqmaps.h>
#include <helpbutton.h> // Custom push button for help files
#include <qxmlstream.h>
#include <openpanzercomm.h> // OpenPanzer communication library
#include <op_eeprom_varinfo.h>
#include <assistant.h>
#include <downloader.h>
#include <console.h>
#include <version.h>
#include <winsparkle.h>
// We use this to more quickly create message boxes
enum ButtonCollection{vbYesNo, vbYesNoCancel, vbOkCancel, vbOkOnly};
enum IconCollection{vbCritical, vbInformation, vbQuestion, vbWarning, vbExclamation, vbNoIcon};
// Settings for the status label that we fade in and out
#define STATUS_LABEL_ON_DELAY 3000 // How long to show status messages in the bottom status bar
#define STATUS_LABEL_FADEOUT_TIME 2000 // How long does the fade out effect take
#define STATUS_LABEL_FADEIN_TIME 350 // How long does the fade in effect take
enum StatusLabelStatus{slGood, slBad, slNeutral}; // We use these to decide what color the label should have
// Settings for the radio streaming frame tha we also fade in and out
#define RADIO_STREAM_FADEOUT_TIME 4000 // How long does the fade out effect take
#define RADIO_STREAM_FADEIN_TIME 150 // How long does the fade in effect take
// How often to poll the COM ports list (mS)
#define CHECK_COM_PORTS_TIME 800 // Every 0.8 seconds
// Define the index numbers of the various tabs
#define TAB_INDEX_RADIO 0
#define TAB_INDEX_MOTORS 1
#define TAB_INDEX_LIGHTS 2
#define TAB_INDEX_FUNCTIONS 3
#define TAB_INDEX_DRIVING 4
#define TAB_INDEX_BATTLE 5
#define TAB_INDEX_SOUNDS 6
#define TAB_INDEX_MISC 7
#define TAB_INDEX_FIRMWARE 8
// Struct for firmware version info
struct FirmwareVersion{
uint8_t Major;
uint8_t Minor;
uint8_t Patch;
};
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
// ------------------------------------------------------------------------------------------------------------------------------------------------>>
// PUBLIC
// ------------------------------------------------------------------------------------------------------------------------------------------------>>
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
virtual void showEvent(QShowEvent *event); // We need this event so we can wait until the main form loads to show WinSparkle
// These functions will be used as callbacks for the WinSparkle dll and need to be static.
// WinSparkle is a program we use to check for OP Config updates
static int canShutdown(); // Are we ready to shutdown?
static void shutDown(); // Shutdown
// ------------------------------------------------------------------------------------------------------------------------------------------------>>
// PUBLIC SLOTS
// ------------------------------------------------------------------------------------------------------------------------------------------------>>
public slots:
// WinSparkle updater.
void initWinSparkle(); // Initialize the WinSparkle app
void checkForUpdates(); // The check for updates function
// Slot for processing command line arguments. Better as a slot because we can assign a signal to it that will only call it
// after the main loop has started. Also make it public so QApplication (or in our case, SingleApplication) can call it.
// ---------------------------------------------------------------------------------------------------->>
void ProcessCommandLineArgs(); // If the app is opened with command line arguments, we process them (MainWindow.cpp)
// -------------------------------------------------------------------------------------------------------->>
// SIGNALS
// -------------------------------------------------------------------------------------------------------->>
signals:
void PulseCentersSaved(boolean);
void windowWasShown(); // Has main form finished loading
// -------------------------------------------------------------------------------------------------------->>
// PRIVATE SLOTS
// -------------------------------------------------------------------------------------------------------->>
private slots:
// These are functions that will be called if we connect them to a signal
void changeStackedWidget(const QModelIndex&, const QModelIndex&);
// Uncomment the below if compiling with Qt 5.6. See bug report: https://bugreports.qt.io/browse/QTBUG-53186
// A fix for the dual-select bug in Qt 5.6
//void changeStackedWidget56Fix(const QModelIndex&);
// Slots for the Assistant (help documentation) and the About menu
// ---------------------------------------------------------------------------------------------------->>
void showDocumentation();
void AboutOP();
void showPageDocumentation(QString file);
// Slots for the Tools menu
// ---------------------------------------------------------------------------------------------------->>
void ResetAllValues();
void ShowHideHeader(); // Toggle
void ShowHeader();
void HideHeader();
// Slots for the two test buttons on the Radio tab
// ---------------------------------------------------------------------------------------------------->>
void cmdTest1_Click(); // These slots are in the mainwindow.cpp file under FORM-GENERAL
void cmdTest2_Click(); // And the connections are made in the MainWindow constructor
// Slots for connecting/disconnecting/error handling the device
// ---------------------------------------------------------------------------------------------------->>
void fillPortsInfo(); // Updates the list of detected COM ports
void pollCOMPorts(); // Calls fillPortsInfo but only if not already connected
void setCOMPort(); // Sets the current COM port
void setBaudRate(); // Sets the current baud rate
void toggleDeviceConnection(); // Connect/disconnect from device
void connectToDevice(); // Connect to device
void disconnectFromDevice(); // Disconnect from device
void ShowConnectionStatus(boolean connected); // When the device responds or is disconnected, this slot will get called
void ShowSnoopStatus(boolean connected); // If the port is open or closed for snooping, this will get called
void ProcessCommError(QString, QSerialPort::SerialPortError); // Display communication error message box
// Slots for reading/writing the device
// ---------------------------------------------------------------------------------------------------->>
void readSettingsFromDevice(); // Read all settings from device
void writeAllSettingsToDevice(); // Write all settings to device
void writeSomeSettingsToDevice(uint16_t startID, uint16_t endID); // Write some settings to device
void SerialStatus_displayFirmware(QString version); // Display device firmware version in status bar
void SerialStatus_displayHardware(uint8_t hardware); // Display device hardware version in status bar
void ProcessMinOPCVersion(QString); // The TCB will tell us the minimum OP Config version it requires, if it is greater than this version ask user to update.
void updateVarArray_fromSerial(uint16_t ID, QByteArray Value, boolean found); // Process return message from device after requesting value.
void processNextSentence(boolean); // When the device responds with a SERID_NEXT_SENTENCE request
// Slots for reading/writing to XML file
// ---------------------------------------------------------------------------------------------------->>
void actionReadSettingsFromFile(); // Read all settings from a file - this slot actually only gets the file name, which
// it then passes to the real readSettingsFromFile(Qstring) private function
void writeSettingsToFile(); // Save all settings to a file
// Form control slots
// ---------------------------------------------------------------------------------------------------->>
// Radio tab
void ValidateChannelOrder(QString priorChan, QString newChan, ChannelOrderComboBox *changedCombo);
void SaveChannelNum(QString, QString, ChannelOrderComboBox*, int);
void SaveChannelReversed(bool checked, int);
void SaveAuxChannelType(AnalogDigitalComboBox *, int);
void SaveAuxChannelPositions(AuxChannelPositionsCombo *, int);
void SaveThrottleDeadband(int value);
void SaveTurnDeadband(int value);
void SaveElevationDeadband(int value);
void SaveAzimuthDeadband(int value);
void checkAuxChannelsAgainstFunctionTriggers();
void SaveNumUtilizedChannels(uint8_t numChannels);
void ReadPulseWidths(int16_t *pulseWidths);
void RadioNotReady(void);
void cmdSaveMinMax_Click();
void cmdSaveCenters_Click();
void cmdToggleViewSavedValues_Click();
void ConfirmCentersSaved(boolean);
void cmdToggleRadioStream_Click();
void SetRadioStreamStatus(boolean streaming);
// Motor tab
void ValidateMotorSelections();
void ValidateSmokerSelections();
void ShowHideRecoilDelay();
void SetMechBarrelAuto(bool);
void SetRecoilServoAuto(bool);
void ShowHideSmokerSettings();
// Lights & IO tab
void SetHiFlashAuto(bool);
void ValidateAuxFlash(bool);
void SetupInputAType(int);
void SetupInputBType(int);
void SavePortA_InputType(int);
void SavePortB_InputType(int);
void SetupPortAFunctionTrigger(int);
void SetupPortBFunctionTrigger(int);
// Functions tab
void SetupTriggerSources(_special_function,boolean); // When they select a function from the drop-down, then we set up the appropriate triggers that can be applied
void SetupTriggerActions(int); // When they select a trigger from teh drop-down, then we set up the appropriate actions for that trigger
void cmdAddFunctionTrigger_clicked(bool checked);
void cmdRemoveFunctionTrigger_clicked(bool checked);
void UpdateTurretStickDelayOptions(boolean);
void UpdateFunctionTriggerCount(int);
// Driving tab
void ShowHideNudgeTime(int);
void ShowHideNeutralTurnPct(bool);
void ShowHideNeutralTurnAllowed(int);
void ShowHideHalftrackTurn(int);
void ShowHideAccelOptions_1(bool); // Profile 1
void ShowHideDecelOptions_1(bool);
void ShowHideAccelOptions_2(bool); // Profile 2
void ShowHideDecelOptions_2(bool);
void ShowHideBarrelStabilization(bool);
void ShowHideBarrelSensitivity(bool);
void ShowHideHillSensitivity(bool);
void ShowHideTrackRecoil();
// Battle tab
void ShowHideCannonIRSettings(int);
void SetupSecondaryCannonIR(int);
void SetupIRTeamList(int);
void ShowHideMGIRSettings(int);
void ShowHideMGHits(bool);
void ShowHideOtherBattleSettings(int);
void ShowHideTankIDSettings(bool);
// Sound tab
void ShowHideSoundCardSettings();
void ShowHideHeadlightSoundNote(bool);
void ShowHideHeadlight2SoundNote(bool);
void ShowHideSqueak1Settings(bool);
void ShowHideSqueak2Settings(bool);
void ShowHideSqueak3Settings(bool);
void ShowHideSqueak4Settings(bool);
void ShowHideSqueak5Settings(bool);
void ShowHideSqueak6Settings(bool);
void ShowHideOtherSqueakSettings();
void UpdateEngineVolumeLabel(int);
void UpdateOverlayVolumeLabel(int);
void UpdateEffectsVolumeLabel(int);
// Misc tab
void updateSabertoothBaudLabel(void);
void cmdSetSabertoothBaud_clicked(void);
void cmdConfigurePololuDrive_clicked(void);
void cmdConfigurePololuTurret_clicked(void);
// Firmware tab - hex flashing
void cmdFlashHex_clicked();
void flashStarted();
void flashFinished();
void readyReadStandardOutput();
void readyReadStandardError(); // Won't be using this one after all
void getLocalHex();
void getWebHex();
void clearGotHex();
void checkHexVersion();
void SaveWebHexToLocal();
void SaveWebHexFailed();
// Firmware tab - console
void ClearConsole();
void toggleSnoop();
void putDataToConsole(const QByteArray &data);
void stopTeensyTimer(void); // Teensy flash has timed-out
void handleDeviceTypeSelection(int);
// Status bar (along the bottom)
void StartStatusLabelOnDelay(void); // During this delay, the status label is visible
void FadeOutStatusLabel(); // This slot fades out the status label
// ------------------------------------------------------------------------------------------------------------------------------------------------>>
// PRIVATE
// ------------------------------------------------------------------------------------------------------------------------------------------------>>
private:
// Forms
// ---------------------------------------------------------------------------------------------------->>
Ui::MainWindow *ui; // This form
// Mouse
// ---------------------------------------------------------------------------------------------------->>
void MouseWait(); // Sets the mouse to hourglass
void MouseRestore(); // Returns the mouse to a pointer
// Application-specific settings
// ---------------------------------------------------------------------------------------------------->>
QSettings ProgIni;
QString LastPath;
QString GetLastPath(void); // The app will remember the last path the user accessed
void StoreLastPath(QString); // when reading/writing OPZ files
// QT Assistant
// ---------------------------------------------------------------------------------------------------->>
Assistant *assistant;
// Help Buttons
// ---------------------------------------------------------------------------------------------------->>
HelpButton *ptrHelpButton; // We create a pointer to one so we can pass the reference to Assistant
QSignalMapper *signalMapper; // We'll use a signal mapper to map a string output from each button's released event
void SetupHelpButtons(void); // This will map all the help buttons to the specific location in the help files
// Message box helper
// ---------------------------------------------------------------------------------------------------->>
int msgBox(QString msg, ButtonCollection buttons, QString title, IconCollection icon);
QMessageBox *mb;
uint8_t CountFailConnection;
#define CountConnectionFailuresToShowHelp 3 // How many connection failures before we show the help message
void ConnectAssistMsgBox(void);
boolean HideConnectAssistMsg;
// Form stuff
// ---------------------------------------------------------------------------------------------------->>
void initActionsConnections(); // Set up abstract actions
QLabel *serialStatusLabel; // References to labels and ProgressBar in the Status Bar
QLabel *otherStatusLabel;
QFrame *connectFrame;
QProgressBar *statusProgressBar;
QStringListModel *listViewWestModel; // This is a class that provides a model that supplies strings to views (we can use views in listboxes, combo boxes, whatever)
// Status bar
void SetupStatusBarLabel();
void SetStatusLabel(QString, StatusLabelStatus); // Sets the text and background color, handles the fade-in and fade-out
QTimer *statusLabelShowTimer; // Timer to show the status label
// Serial status label and colored box
void SerialStatus_SetAttemptConnect();
void SerialStatus_SetConnected();
void SerialStatus_SetNotConnected();
void SerialStatus_SetAttemptFlash();
// COM Check timer
QTimer *COMCheckTimer; // This timer will be used to poll the COM ports and update the list if any new devices are found
void startCOMChecker(void);
void stopCOMChecker(void);
// Tab-specific
// ---------------------------------------------------------------------------------------------------->>
// Radio tab
#define SLIDER_CENTER_ADJUST 10
void SetupControls_RadioTab(void);
QString calculateStickDirection(uint8_t StickNum, int16_t Pulse);
uint8_t calculateAuxSwitchPos(int16_t Pulse, uint8_t NumPositions, boolean Reversed);
ChannelOrderComboBox *channelOrderCombo[COUNT_OP_CHANNELS];
AnalogDigitalComboBox *auxTypeCombo[AUXCHANNELS];
AuxChannelPositionsCombo *auxSwitchPosCombo[AUXCHANNELS];
QCheckBox *stickReversedCheck[STICKCHANNELS];
QCheckBox *auxReversedCheck[AUXCHANNELS];
uint8_t NumUtilizedChannels;
void UpdateChannelControls_MinMaxCenter(void); // Will set sliders/min/max controls to whatever is stored in variables
void ShowHidePulsesPositions(boolean show);
QSlider *lowSlider[COUNT_OP_CHANNELS];
QSlider *highSlider[COUNT_OP_CHANNELS];
QLabel *lblChannelMin[COUNT_OP_CHANNELS];
QLabel *lblChannelMax[COUNT_OP_CHANNELS];
QLabel *lblChannelPulse[COUNT_OP_CHANNELS];
QLabel *lblChannelPosition[COUNT_OP_CHANNELS];
common_channel_settings ChannelSettings[COUNT_OP_CHANNELS];
boolean Flag_StartRadioStream;
boolean Flag_SaveCenterValues;
boolean Flag_SaveMinMaxValues;
boolean Flag_RadioValuesChanged; // If while streaming the user saves the center or min/max values, this flag will get set to true
void FadeInRadioStreaming(void);
void FadeOutRadioStreaming(void);
// Motor tab
void SetupControls_MotorTab(void);
void ValidateRCPassthroughs(void);
// Lights & IO tab
void SetupControls_LightsIOTab(void);
// Functions tab
FunctionTriggerTableModel *FT_TableModel;
QSortFilterProxyModel *FT_ProxyModel;
void SetupControls_FunctionsTab(void);
void RemovedFunctionTriggersMsgBox(void);
// Driving tab
void SetupControls_DrivingTab(void);
void ValidateFreewheelingGearboxOptions(void);
// Battle tab
void SetupControls_BattleTab(void);
// Sound tab
void SetupControls_SoundTab(void);
void EnableTurretSoundSettings(void);
void DisableTurretSoundSettings(void);
void EnableHeadlightSoundSetting(void);
void DisableHeadlightSoundSetting(void);
void EnableHeadlight2SoundSetting(void);
void DisableHeadlight2SoundSetting(void);
void RemoveVolumeFunctionsStep(void);
void AddSoundFunctionsOP(void);
void RemoveSoundFunctionsTaigen(void);
void RemoveSoundFunctionsBenedini_Mini(void);
void AddSoundFunctionsBenedini_Mini(void);
void RemoveSoundFunctionsBenedini_Micro(void);
void UpdateSoundFunctionsBenedini(void);
void EnableSqueaks1_3(void);
void EnableSqueaks4_6(void);
void DisableSqueaks1_3(void);
void DisableSqueaks4_6(void);
void EnableMinSqueakSpeed(void);
void DisableMinSqueakSpeed(void);
void SqueakSettingsMoveUp(void);
void SqueakSettingsMoveDown(void);
void HideSqueakHeader(void);
void ShowSqueakHeader(void);
// Misc tab
void SetupControls_MiscTab(void);
// Firmware tab
void SetupControls_FirmwareTab(void);
FirmwareVersion DownloadedVersion;
QString DownloadedVersionDate;
void ClearFirmwareVersion(FirmwareVersion);
FirmwareVersion DecodeVersion(QString);
FirmwareVersion DecodeVersion(QByteArray);
QString FirmwareVersionToString(FirmwareVersion);
boolean isFirmwareVersionEmpty(FirmwareVersion);
FirmwareVersion GetMinTCBVersion(void);
boolean FirmwareGreaterThanComparison(FirmwareVersion, FirmwareVersion);
Downloader *VersionDownloader;
Downloader *HexDownloader;
boolean AttemptFlash;
QString strAVRDUDEOutput;
QProcess *AVRDUDEProcess;
QString strTeensyLoaderOutput;
QProcess *TeensyLoaderProcess;
QTimer *TeensyTimeoutTimer; // This timer will be used to exit the Teensy flash operation if no chip is detected after a certain amount of time
void startTeensyTimer(void);
boolean GotWebHex; // If we've downloaded a hex from the web set this flag, so if the user tries again it's instantaneous
QString WebHexFilePath; // If we've downloaded the hex from the web, this is the full path (including file name) where we saved it.
boolean isCharNumeric(char); // Is this a character from 0 to 9
// Var Array (from op_eeprom_varinfo.h) - searching, reading, updating
// ---------------------------------------------------------------------------------------------------->>
QMap<uint16_t, QByteArray> VarArray; // QMap is a generic key/value list container, the key and value can be of any type. Very convenient for us.
void loadVarArrayDefaults(void); // Copies default values from STORAGEVARS to VarArray
boolean updateVarArray_byID(uint16_t ID, QByteArray Value);
boolean updateVarArray_byPos(uint16_t arrayPos, QByteArray value);
boolean getStorageVarInfo_byID(_storage_var_info &svi, uint16_t findID);
boolean getStorageVarInfo_byPos(_storage_var_info & svi, uint16_t arrayPos);
uint16_t findStorageArrayPosition(uint16_t findID);
void VarArray_to_Variables(void); // These two functions are really the critical ones in terms of mapping all our variables to the VarArray
void Variables_to_VarArray(void); // Mess these up, and you are in trouble, as they are hard-coded.
void ConvertOldAuxChannels(void); // Updates aux channel positions from old (0.92.22 and earlier) nomenclature to new
// Variables to Controls and back
// ---------------------------------------------------------------------------------------------------->>
void Variables_to_Controls(void); // These update all the controls with values stored in named variables
void Controls_to_Variables(void); // These copy all control values to named variables
// Named vars (as opposed to numbered variables)
// ---------------------------------------------------------------------------------------------------->>
_device_data DeviceData; // This struct holds a named version of every piece of information we may want from the device
// Physical Device Settings
// ---------------------------------------------------------------------------------------------------->>
uint8_t CurrentDevice; // The hardware ID to indicate what device we are communicating with
QString CurrentFirmware; // String value of the firmware the connected device is reporting
OpenPanzerComm *comm; // Our OpenPanzer Communication object
boolean AttemptConnect; // This will only be true while the connection attempt is in process. Once we are
// connected or disconnected it will become false, and connection status can be obtained
// from comm->isConnected()
// Reading from and Writing to Device
// ---------------------------------------------------------------------------------------------------->>
void readSettingsFromFile(QString, boolean); // Give a file path, it verifies the file exists and tries to read it in. If the second arg is true, will provide confirmation message
void sendReadCommand_byPos(uint16_t VarPos); // Read variable from device by VarArray position
void sendWriteCommand_byPos(uint16_t VarPos); // Write variable to device by VarArray position
boolean readAllSettings; // Flags
boolean writeAllSettings;
boolean writeSomeSettings;
boolean oneClickRead; // When the user clicks the read from device button but the device isn't yet connected
void ResetOneClickRead(void); //
boolean setSabertoothBaudRate; // Flag set during Sabertooth configuration
boolean configurePololuDrive; // Flags set during Pololu configuration
boolean configurePololuTurret;
uint16_t nextVarPos; // What position in the VarArray are we going to read/write next
uint16_t startVarPos; // Sometimes we may only want to write a subset of variables. This will be the start variable,
uint16_t endVarPos; // and this will be the end variable.
void DisableDeviceActionsDuringReadWrite(void); // We disable some stuff during read/write operations (see mainwindow_device_rw.cpp)
void EnableDeviceActionsAfterReadWrite(void); // This re-enables the same stuff
void resetReadWriteProcess(); // This sets the read and write flags to false
void DisableDeviceActionsDuringRadioStream(void); // Disable some actions when the radio is streaming (see mainwindow_tab_radio.cpp)
void EnableDeviceActionsAfterRadioStream(void); // This re-enables the same stuff
// XML File Reading/Writing
// ---------------------------------------------------------------------------------------------------->>
QXmlStreamReader xmlReader;
};
#endif // MAINWINDOW_H