MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / main

Function main

OpenHD/ohd_interface/test/test_interface.cpp:48–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46};
47
48int main(int argc, char *argv[]) {
49 OHDUtil::terminate_if_not_root();
50 bool is_air = false;
51 {
52 int c;
53 while ((c = getopt_long(argc, argv, optstr, long_options, NULL)) != -1) {
54 const char *tmp_optarg = optarg;
55 switch (c) {
56 case 'a':
57 is_air = true;
58 break;
59 case '?':
60 default:
61 std::cout << "Usage: \n"
62 << "--air (-a) run as air, otherwise run as ground \n";
63 exit(1);
64 }
65 }
66 }
67 std::cout << "Test_interface run as air:" << OHDUtil::yes_or_no(is_air)
68 << "\n";
69
70 const auto platform = OHDPlatform::instance();
71 const OHDProfile profile{is_air, "0"};
72 OHDInterface ohdInterface(profile);
73
74 std::cout << "OHDInterface started\n";
75
76 // run forever, OHDInterface runs in its own threads
77 while (true) {
78 std::this_thread::sleep_for(std::chrono::seconds(2));
79 std::cout << "XInterface\n";
80 }
81 std::cerr << "OHDInterface stopped\n";
82
83 return 0;
84}

Callers

nothing calls this directly

Calls 1

yes_or_noFunction · 0.85

Tested by

no test coverage detected