class Appl: addArgs function added.
This commit is contained in:
@@ -32,6 +32,8 @@ Appl& A = Appl::Instance();
|
||||
|
||||
void define_args()
|
||||
{
|
||||
A.addArgs("", 0);
|
||||
|
||||
A.addItem("p_device", Appl::Param("/dev/ttyUSB60"), "d", "device",
|
||||
"dummy serial device (/dev/ttyUSB60)\n\t\t(hint: socat -d -d pty,raw,echo=0 pty,raw,echo=0)",
|
||||
Appl::type_string, Appl::opt_mandatory);
|
||||
@@ -41,7 +43,7 @@ void define_args()
|
||||
Appl::type_string, Appl::opt_mandatory);
|
||||
|
||||
A.addItem("p_time", Appl::Param(10000), "t", "time",
|
||||
"wait time [ms] (10000)",
|
||||
"wait time [ms] (10000)\n",
|
||||
Appl::type_long, Appl::opt_mandatory);
|
||||
|
||||
A.addItem("p_help", Appl::Param(false), "h", "help",
|
||||
|
||||
+12
-4
@@ -26,12 +26,14 @@ Appl& A = Appl::Instance();
|
||||
|
||||
void define_args()
|
||||
{
|
||||
A.addArgs("type value", 2);
|
||||
|
||||
A.addItem("p_server", Appl::Param("localhost"), "s", "server",
|
||||
"servername or IP (localhost)",
|
||||
"name or ip (localhost)",
|
||||
Appl::type_string, Appl::opt_mandatory);
|
||||
|
||||
A.addItem("p_port", Appl::Param(8888), "p", "port",
|
||||
"\tport (8888)",
|
||||
"port (8888)\n",
|
||||
Appl::type_int, Appl::opt_mandatory);
|
||||
|
||||
A.addItem("p_help", Appl::Param(false), "h", "help",
|
||||
@@ -56,11 +58,17 @@ int main(int argc, char* argv[])
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
std::cout << "1: " << A.getArg(1) << std::endl;
|
||||
std::cout << "2: " << A.getArg(2) << std::endl;
|
||||
|
||||
TCPClient* client = new TCPClient();
|
||||
TCPSocket* socket = client->connect(A.getParam<const char*>("p_server"), A.getParam<int>("p_port"));
|
||||
//~ TCPSocket* socket = client->connect(A.getParam<const char*>("p_server"), A.getParam<int>("p_port"));
|
||||
|
||||
delete socket;
|
||||
if (socket != NULL) {
|
||||
socket->send("help", 4);
|
||||
delete socket;
|
||||
}
|
||||
|
||||
delete client;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user