-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
140 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,56 @@ | ||
#include <QCoreApplication> | ||
#include <QCommandLineParser> | ||
#include <QCommandLineOption> | ||
#include "registermodifier.h" | ||
#include <iostream> | ||
|
||
#include <QDebug> | ||
|
||
#ifdef _MSC_VER | ||
#pragma execution_character_set("utf-8") | ||
#endif | ||
|
||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QCoreApplication a(argc, argv); | ||
QCoreApplication::setApplicationName("Com Property Modifier"); | ||
QCoreApplication::setApplicationVersion("1.0.0"); | ||
|
||
QCommandLineParser parser; | ||
// parser.setOptionsAfterPositionalArgumentsMode(QCommandLineParser::ParseAsOptions); | ||
// parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); | ||
parser.setApplicationDescription("Used for modify com delay."); | ||
parser.addHelpOption(); | ||
parser.addVersionOption(); | ||
|
||
QCommandLineOption comOption({"c", "com"}, "specify com name (COM4 for example)", "portname"); | ||
parser.addOption(comOption); | ||
|
||
QCommandLineOption delayOption({"d", "delay"}, "the delay value needs to be set.", "delay"); | ||
parser.addOption(delayOption); | ||
|
||
QCommandLineOption deviceOption({{"D", "devices"}, "Read port name and latency of All Devices."}); | ||
parser.addOption(deviceOption); | ||
|
||
parser.process(a); | ||
|
||
|
||
RegisterModifier rm; | ||
rm.modify(); | ||
// return a.exec(); | ||
if(parser.isSet(deviceOption)) { | ||
int delay = rm.getLatency(parser.value(comOption)); | ||
std::cout << delay << std::endl; | ||
return 0; | ||
} | ||
|
||
if(parser.isSet(delayOption)) { | ||
rm.setLatency(parser.value(delayOption).toInt()); | ||
} | ||
|
||
if(parser.isSet(comOption)) { | ||
rm.setCom(parser.value(comOption)); | ||
rm.modify(); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters