4 changed files with 30 additions and 19 deletions
@ -1,28 +1,38 @@ |
|||||
#include <iostream> |
#include <iostream> |
||||
#include <include/stepper.h> |
#include <include/stepper.h> |
||||
#include <boost/program_options.hpp> |
#include <boost/program_options.hpp> |
||||
|
|
||||
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
||||
{ |
{ |
||||
using namespace simon; |
using namespace simon; |
||||
namespace po = boost::program_options; |
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() |
desc.add_options() |
||||
("help", "produce help message") |
("help", "Produce help message") |
||||
("compression", po::value<int>(), "set compression level"); |
("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::variables_map vm; |
||||
po::store(po::parse_command_line(argc, argv, desc), vm); |
po::store(po::parse_command_line(argc, argv, desc), vm); |
||||
po::notify(vm); |
po::notify(vm); |
||||
if (vm.count("help")) { |
if (vm.count("help")) { |
||||
std::cout << desc << "\n"; |
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 { |
} 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"); |
if (ptr_stepper != nullptr) |
||||
std::cout << "Hello camera :*" << std::endl; |
delete ptr_stepper; |
||||
return 0; |
return EXIT_SUCCESS; |
||||
} |
} |
||||
|
Loading…
Reference in new issue