test_system_utils.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Pavel Kirienko <pavel.kirienko@gmail.com>
3  */
4 
6 #include <iostream>
7 #include <iomanip>
8 #include "debug.hpp"
9 
10 int main(int argc, const char** argv)
11 {
12  try
13  {
14  const std::vector<std::string> iface_names(argv + 1, argv + argc);
15 
16  const auto res = uavcan_linux::MachineIDReader(iface_names).readAndGetLocation();
17 
18  const auto original_flags = std::cout.flags();
19 
20  for (auto x : res.first)
21  {
22  std::cout << std::hex << std::setw(2) << std::setfill('0') << int(x);
23  }
24 
25  std::cout.width(0);
26  std::cout.flags(original_flags);
27 
28  std::cout << std::endl;
29 
30  std::cout << res.second << std::endl;
31 
32  return 0;
33  }
34  catch (const std::exception& ex)
35  {
36  std::cerr << "Exception: " << ex.what() << std::endl;
37  return 1;
38  }
39 }
int main(int argc, const char **argv)
std::pair< MachineID, std::string > readAndGetLocation() const
int
Definition: libstubs.cpp:120


uavcan_communicator
Author(s):
autogenerated on Wed Jan 11 2023 03:59:40