Go to the documentation of this file.00001
00002
00003
00004 #include <librealsense/rs.hpp>
00005 #include <iostream>
00006 #include <iomanip>
00007
00008 int main() try
00009 {
00010 rs::log_to_console(rs::log_severity::warn);
00011
00012
00013
00014 rs::context ctx;
00015 int device_count = ctx.get_device_count();
00016 if (!device_count) printf("No device detected. Is it plugged in?\n");
00017
00018 for(int i = 0; i < device_count; ++i)
00019 {
00020
00021 rs::device * dev = ctx.get_device(i);
00022 std::cout << "Device " << i << " - " << dev->get_name() << ":\n";
00023 std::cout << " Serial number: " << dev->get_serial() << "\n";
00024 std::cout << " Firmware version: " << dev->get_firmware_version() << "\n";
00025 try { std::cout << " USB Port ID: " << dev->get_usb_port_id() << "\n"; } catch (...) {}
00026 if (dev->supports(rs::capabilities::adapter_board)) std::cout << " Adapter Board Firmware version: " << dev->get_info(rs::camera_info::adapter_board_firmware_version) << "\n";
00027 if (dev->supports(rs::capabilities::motion_events)) std::cout << " Motion Module Firmware version: " << dev->get_info(rs::camera_info::motion_module_firmware_version) << "\n";
00028
00029
00030 std::cout << " Camera info: \n";
00031 for (int j = RS_CAMERA_INFO_DEVICE_NAME; j < RS_CAMERA_INFO_COUNT; ++j)
00032 {
00033 rs::camera_info param = (rs::camera_info)j;
00034 if (dev->supports(param))
00035 std::cout << " " << std::left << std::setw(20) << rs_camera_info_to_string(rs_camera_info(param)) << ": \t" << dev->get_info(param) << std::endl;
00036 }
00037
00038
00039 std::cout << std::setw(55) << " Supported options:" << std::setw(10) << "min" << std::setw(10) << " max" << std::setw(6) << " step" << std::setw(10) << " default" << std::endl;
00040 for(int j = 0; j < RS_OPTION_COUNT; ++j)
00041 {
00042 rs::option opt = (rs::option)j;
00043 if(dev->supports_option(opt))
00044 {
00045 double min, max, step, def;
00046 dev->get_option_range(opt, min, max, step, def);
00047 std::cout << " " << std::left << std::setw(50) << opt << " : " << std::setw(5) << min << "... " << std::setw(12) << max << std::setw(6) << step << std::setw(10) << def << "\n";
00048 }
00049 }
00050
00051
00052 for(int j = 0; j < RS_STREAM_COUNT; ++j)
00053 {
00054
00055 rs::stream strm = (rs::stream)j;
00056 int mode_count = dev->get_stream_mode_count(strm);
00057 if(mode_count == 0) continue;
00058
00059
00060 std::cout << " Stream " << strm << " - " << mode_count << " modes:\n";
00061 for(int k = 0; k < mode_count; ++k)
00062 {
00063
00064 int width, height, framerate;
00065 rs::format format;
00066 dev->get_stream_mode(strm, k, width, height, format, framerate);
00067 std::cout << " " << width << "\tx " << height << "\t@ " << framerate << "Hz\t" << format;
00068
00069
00070 dev->enable_stream(strm, width, height, format, framerate);
00071 rs::intrinsics intrin = dev->get_stream_intrinsics(strm);
00072
00073
00074 std::cout << "\t" << std::setprecision(3) << intrin.hfov() << " x " << intrin.vfov() << " degrees, distortion = " << intrin.model() << std::endl;
00075 }
00076
00077
00078 dev->disable_stream(strm);
00079 }
00080 }
00081
00082 return EXIT_SUCCESS;
00083 }
00084 catch(const rs::error & e)
00085 {
00086 std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n " << e.what() << std::endl;
00087 return EXIT_FAILURE;
00088 }