#ifndef COMMANDLINEPARSER_H #define COMMANDLINEPARSER_H #include #include #include #include "witcommand.h" enum CommandLineParseResult { CommandLineOk, CommandLineError, CommandLineVersionRequested, CommandLineHelpRequested }; struct TcQuery { QString serialPort; int connectBaudrate; bool isSetAlgorithm; ALGROITHM_ENUM algorithm; bool isSetInstallationOrientation; ORIENT_ENUM installationOrientation; bool isSetTimeZone; TIMEZONE_ENUM timeZone; bool isSetDefaultReturnContent;//wit默认 + 经纬度 RETURN_CONTENT_STRUCT defaultReturnContent; RETURN_CONTENT_STRUCT returnContent; bool isSetBaudrate; BAUD_ENUM baudrate; bool isSetReturnRate; RRATE_ENUM returnRate; bool isSetDeviceAddress; int deviceAddress; bool isSetInterface_D0; MODEL_D0_D2_D3_ENUM modelForInterface_D0;//模式 int pulseWidth_D0;//脉宽 int period_D0;//周期 bool isSetInterface_D1; MODEL_D1_ENUM modelForInterface_D1;//模式 int pulseWidth_D1;//脉宽 int period_D1;//周期 bool isSetInterface_D2; MODEL_D0_D2_D3_ENUM modelForInterface_D2;//模式 int pulseWidth_D2;//脉宽 int period_D2;//周期 bool isSetInterface_D3; MODEL_D0_D2_D3_ENUM modelForInterface_D3;//模式 int pulseWidth_D3;//脉宽 int period_D3;//周期 }; CommandLineParseResult parseCommandLine2(QCommandLineParser &parser, TcQuery *query, QString *errorMessage); bool getModel(int modelIndex, MODEL_D0_D2_D3_ENUM & model); bool getModel_D1(int modelIndex, MODEL_D1_ENUM & model); bool processModelParm(QCommandLineParser &parser, QCommandLineOption commandLineOption, MODEL_D0_D2_D3_ENUM & model, bool &isSetInterface); bool processModelParm_D1(QCommandLineParser &parser, QCommandLineOption commandLineOption, MODEL_D1_ENUM & model, bool &isSetInterface); bool processPulseWidthParm(QCommandLineParser &parser, QCommandLineOption commandLineOption, int & pulseWidth, bool &isSetInterface); bool processPeriodParm(QCommandLineParser &parser, QCommandLineOption commandLineOption, int & period, bool &isSetInterface); #endif // COMMANDLINEPARSER_H