// main.cpp - virtual front panel of the AdvancedController for the PC. // // Looks like the real device: the same buttons with the same icons, drawn as vectors. // A click on a button sends the same "KEY" command the physical button generates; the led // of every button mirrors the real led of the device (command LEDS, polled 5 times a second). // Hold a button for 1.5 s to get the "long press" where the device has one (ENTER -> camera // OSD menu, crosshair 1 / 2 -> edit mode). PC keyboard arrows / Enter = the cross pad. // // Up to three controllers at once: the tabs CONTROLLER 1 / 2 / 3 at the top. Everything below // the tabs belongs to the selected controller: its serial port, OPEN / CLOSE, the panel and // the exchange line. The dot in the tab: grey = port closed, red = port open but the // controller does not answer, green = connected. IDENTIFY makes the gear led of that // controller blink fast for 3 s - to see which physical device the tab is talking to. // // Usage: ./run.sh or ./bin/AdvancedControllerPanel [-p /dev/ttyUSB0 [-p /dev/ttyUSB1]] [-b 9600] // Needs: firmware r7.2.6 or later. #include "mainwindow.h" #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QApplication::setApplicationName(QStringLiteral("AdvancedControllerPanel")); QCommandLineParser parser; parser.setApplicationDescription(QStringLiteral("AdvancedController virtual front panel")); parser.addHelpOption(); const QCommandLineOption portOption({QStringLiteral("p"), QStringLiteral("port")}, QStringLiteral("serial port to preselect for CONTROLLER 1 (repeat for 2 and 3), e.g. -p /dev/ttyUSB0 -p /dev/ttyUSB1"), QStringLiteral("port")); const QCommandLineOption baudOption({QStringLiteral("b"), QStringLiteral("baud")}, QStringLiteral("baud rate (default 9600)"), QStringLiteral("baud"), QStringLiteral("9600")); parser.addOption(portOption); parser.addOption(baudOption); parser.process(app); bool baudOk = false; const int baud = parser.value(baudOption).toInt(&baudOk); if (!baudOk || baud <= 0) parser.showHelp(1); MainWindow window(parser.values(portOption), baud); window.show(); return app.exec(); }