This repository has been archived by the owner on Jun 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
robot_test.cxx
62 lines (52 loc) · 1.6 KB
/
robot_test.cxx
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <cstring>
#include <ndds/ndds_cpp.h>
#include "common.h"
void client_rr(const std::string & service_name);
void server_rr(const std::string & service_name);
void client_func(const std::string & service_name);
void server_func(const std::string & service_name);
void usage()
{
printf("Usage: robot_test domainid [client_rr|client_func|server_rr|server_func]\n");
}
int main(int argc, char *argv[])
{
try {
int domainid = 65;
std::string service_name = "RobotControl";
/*NDDSConfigLogger::get_instance()->set_verbosity_by_category(
NDDS_CONFIG_LOG_CATEGORY_API,
NDDS_CONFIG_LOG_VERBOSITY_STATUS_ALL);
*/
if (argc == 3)
{
domainid = atoi(argv[1]);
DDSDomainParticipant * default_participant =
dds::rpc::details::DefaultDomainParticipant::singleton().set_domainid(domainid).get();
if (strcmp(argv[2], "client_rr") == 0)
client_rr(service_name);
else if (strcmp(argv[2], "server_rr") == 0)
server_rr(service_name);
else if (strcmp(argv[2], "client_func") == 0)
client_func(service_name);
else if (strcmp(argv[2], "server_func") == 0)
server_func(service_name);
else
usage();
}
else
usage();
return 0;
}
catch (std::exception & ex)
{
printf("Exception in main: %s\n", ex.what());
}
catch (...)
{
printf("Unknown exception in main\n");
}
}