aboutsummaryrefslogtreecommitdiffstats
path: root/mock-jetting-controller/main.cpp
blob: e5677fa90ab4d8bb59b370c74c127d2f06daa8c9 (plain)
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
/**
 * @file   main.cpp
 * @brief  Mock jetting controller on three protocol ports.
 */
#include "MockServer.h"

#include <QCommandLineParser>
#include <QCoreApplication>

int
main (int argc, char *argv[])
{
  qSetMessagePattern ("MockJC     [%{time HH:mm:ss.zzz}] %{message}");

  QCoreApplication app (argc, argv);

  QCommandLineParser parser;
  parser.addOption ({ "wire-debug", "Log raw wire TX/RX to dev log" });
  parser.addOption ({ "host", "Target host to connect to (default 127.0.0.1)",
                      "address", "127.0.0.1" });
  parser.addHelpOption ();
  parser.process (app);

  if (parser.isSet ("wire-debug"))
    MockServer::enableWireDebug ();

  new MockServer (parser.value ("host"), &app);

  return app.exec ();
}