mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 21:46:33 +00:00
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#include <QCommandLineParser>
|
|
#include <QCoreApplication>
|
|
#include <QThread>
|
|
#include "config.hpp"
|
|
#include "localControl.hpp"
|
|
#include "remoteControl.hpp"
|
|
#include "serialCommand.hpp"
|
|
#include "serialPort.hpp"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication app(argc, argv);
|
|
QCommandLineParser parser;
|
|
parser.addHelpOption();
|
|
parser.addVersionOption();
|
|
QCommandLineOption lOption(QStringList() << "l", "Use local mode");
|
|
parser.addOption(lOption);
|
|
QCommandLineOption pOption(QStringList() << "p", "Use serial port", "value");
|
|
parser.addOption(pOption);
|
|
parser.process(app);
|
|
bool useRemoteMode = true;
|
|
if (parser.isSet(lOption)) {
|
|
useRemoteMode = false;
|
|
}
|
|
QString useSerialPort;
|
|
if (parser.isSet(pOption)) {
|
|
useSerialPort = parser.value(pOption);
|
|
}
|
|
|
|
SerialPort serialPort(useSerialPort);
|
|
SerialCommand serialCommand;
|
|
Config::setInitalValues(&serialPort, &serialCommand);
|
|
|
|
// Remote mode will read commands from pipe
|
|
if (useRemoteMode == true) {
|
|
RemoteControl remoteControl;
|
|
} else {
|
|
LocalControl localControl;
|
|
}
|
|
|
|
return app.exec();
|
|
}
|