#include #include #include #include #include #include "proxyclient.h" int main(int argc, char *argv[]) { QCoreApplication application(argc, argv); application.setApplicationName(SERVER_NAME_STRING); application.setOrganizationName("guh"); application.setApplicationVersion(SERVER_VERSION_STRING); QCommandLineParser parser; parser.addHelpOption(); parser.addVersionOption(); parser.setApplicationDescription(QString("\nThe nymea remote proxy server client application. This client allowes to test " "a server application as client perspective.\n\n" "Server version: %1\n" "API version: %2\n\n" "Copyright %3 2018 Simon Stürz \n") .arg(SERVER_VERSION_STRING) .arg(API_VERSION_STRING) .arg(QChar(0xA9))); QCommandLineOption tokenOption(QStringList() << "t" << "token", "The AWS token for authentication.", "token"); parser.addOption(tokenOption); QCommandLineOption addressOption(QStringList() << "a" << "address", "The proxy server host address. Default 127.0.0.1", "address"); addressOption.setDefaultValue("127.0.0.1"); parser.addOption(addressOption); QCommandLineOption portOption(QStringList() << "p" << "port", "The proxy server port. Default 1212", "port"); portOption.setDefaultValue("1212"); parser.addOption(portOption); parser.process(application); if (!parser.isSet(tokenOption)) { qWarning() << "Please specify the token for authentication." << endl; exit(-1); } ProxyClient client; client.setHostAddress(QHostAddress(parser.value(addressOption))); client.setPort(parser.value(portOption).toInt()); client.start(parser.value(tokenOption)); return application.exec(); }