Modified runDDSCommandUI to accept command line argument.

If no arguments, it behaves like before.
Removed runDDSCommand and replaced calls to it in controlDDS.
This commit is contained in:
Radoslaw Karabowicz
2016-05-30 11:25:47 +02:00
parent 65ca151620
commit fd09321fd9
3 changed files with 9 additions and 113 deletions

View File

@@ -7,6 +7,7 @@
#include <sstream>
#include <thread>
#include <atomic>
#include <unistd.h>
using namespace std;
using namespace dds::intercom_api;
@@ -38,7 +39,10 @@ int main(int argc, char* argv[])
t.c_lflag &= ~ICANON; // disable canonical input
tcsetattr(STDIN_FILENO, TCSANOW, &t); // apply the new settings
PrintControlsHelp();
if ( argc != 2 )
PrintControlsHelp();
else
cin.putback(argv[1][0]);
while (cin >> c)
{
@@ -96,6 +100,10 @@ int main(int argc, char* argv[])
{
cerr << "Error sending custom command" << endl;
}
if ( argc == 2 ) {
usleep(50000);
return EXIT_SUCCESS;
}
}
// disable raw mode