4 changed files with 30 additions and 19 deletions
@ -1,28 +1,38 @@ |
|||
#include <iostream> |
|||
#include <include/stepper.h> |
|||
#include <boost/program_options.hpp> |
|||
|
|||
int main(int argc, char *argv[]) |
|||
{ |
|||
using namespace simon; |
|||
namespace po = boost::program_options; |
|||
po::options_description desc("Allowed options"); |
|||
po::options_description desc("This small program allows to control SMcam. Allowed options"); |
|||
desc.add_options() |
|||
("help", "produce help message") |
|||
("compression", po::value<int>(), "set compression level"); |
|||
("help", "Produce help message") |
|||
("axis", po::value<std::string>(), "Name of the axis to rotate") |
|||
("settings", po::value<std::string>(), "Settings file name") |
|||
("rotate", po::value<int>(), "Rotation in degrees. Positive means clockwise."); |
|||
po::variables_map vm; |
|||
po::store(po::parse_command_line(argc, argv, desc), vm); |
|||
po::notify(vm); |
|||
if (vm.count("help")) { |
|||
std::cout << desc << "\n"; |
|||
return 1; |
|||
return EXIT_FAILURE; |
|||
} |
|||
stepper::c_stepper* ptr_stepper = nullptr; |
|||
if (vm.count("axis") && vm.count("settings")) { |
|||
auto axis = vm["axis"].as<std::string>(); |
|||
auto fname_settings = vm["settings"].as<std::string>(); |
|||
ptr_stepper = new stepper::c_stepper(axis, fname_settings); |
|||
if (vm.count("rotate")) { |
|||
auto degrees = vm["rotate"].as<int>(); |
|||
ptr_stepper->rotate(degrees); |
|||
} |
|||
if (vm.count("compression")) { |
|||
std::cout << "Compression level was set to " |
|||
<< vm["compression"].as<int>() << ".\n"; |
|||
} else { |
|||
std::cout << "Compression level was not set.\n"; |
|||
std::cerr << "Please specify axis and settings file.\n"; |
|||
return EXIT_FAILURE; |
|||
} |
|||
stepper::c_stepper("azimuth", "settings.json"); |
|||
std::cout << "Hello camera :*" << std::endl; |
|||
return 0; |
|||
if (ptr_stepper != nullptr) |
|||
delete ptr_stepper; |
|||
return EXIT_SUCCESS; |
|||
} |
|||
|
Loading…
Reference in new issue