Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UAVCAN UAVCAN_Subscriber
Diff: libuavcan_drivers/linux/apps/test_system_utils.cpp
- Revision:
- 0:dfe6edabb8ec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libuavcan_drivers/linux/apps/test_system_utils.cpp Sat Apr 14 10:25:32 2018 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2015 Pavel Kirienko <pavel.kirienko@gmail.com> + */ + +#include <uavcan_linux/uavcan_linux.hpp> +#include <iostream> +#include <iomanip> +#include "debug.hpp" + +int main(int argc, const char** argv) +{ + try + { + const std::vector<std::string> iface_names(argv + 1, argv + argc); + + const auto res = uavcan_linux::MachineIDReader(iface_names).readAndGetLocation(); + + const auto original_flags = std::cout.flags(); + + for (auto x : res.first) + { + std::cout << std::hex << std::setw(2) << std::setfill('0') << int(x); + } + + std::cout.width(0); + std::cout.flags(original_flags); + + std::cout << std::endl; + + std::cout << res.second << std::endl; + + return 0; + } + catch (const std::exception& ex) + { + std::cerr << "Exception: " << ex.what() << std::endl; + return 1; + } +}