LibMultiSense/VersionInfoUtility/VersionInfoUtility.cc
Go to the documentation of this file.
1 
37 #ifdef WIN32
38 #ifndef WIN32_LEAN_AND_MEAN
39 #define WIN32_LEAN_AND_MEAN 1
40 #endif
41 
42 #include <windows.h>
43 #include <winsock2.h>
44 #else
45 #include <unistd.h>
46 #endif
47 
48 #include <iostream>
49 
50 #include <MultiSense/MultiSenseChannel.hh>
52 
53 #include "getopt/getopt.h"
54 
55 namespace lms = multisense;
56 
57 namespace
58 {
59 
60 void usage(const char *name)
61 {
62  std::cerr << "USAGE: " << name << " [<options>]" << std::endl;
63  std::cerr << "Where <options> are:" << std::endl;
64  std::cerr << "\t-a <current_address> : CURRENT IPV4 address (default=10.66.171.21)" << std::endl;
65  std::cerr << "\t-m <mtu> : MTU to use to communicate with the camera (default=1500)" << std::endl;
66  exit(1);
67 }
68 
69 }
70 
71 int main(int argc, char** argv)
72 {
73  std::string ip_address = "10.66.171.21";
74  int16_t mtu = 1500;
75 
76  int c;
77  while(-1 != (c = getopt(argc, argv, "a:m:")))
78  {
79  switch(c)
80  {
81  case 'a': ip_address = std::string(optarg); break;
82  case 'm': mtu = static_cast<uint16_t>(atoi(optarg)); break;
83  default: usage(*argv); break;
84  }
85  }
86 
87  const auto channel = lms::Channel::create(lms::Channel::Config{ip_address, mtu});
88  if (!channel)
89  {
90  std::cerr << "Failed to create channel" << std::endl;;
91  return 1;
92  }
93 
94  //
95  // Query Static info from the camera
96  //
97  auto info = channel->get_info();
98 
99  std::cout << "Firmware build date : " << info.version.firmware_build_date << std::endl;
100  std::cout << "Firmware version : " << info.version.firmware_version.to_string() << std::endl;
101  std::cout << "Hardware version : 0x" << std::hex << info.version.hardware_version << std::endl;
102  std::cout << std::dec;
103 
104  return 0;
105 }
usage
static void usage()
Definition: FirmwareUpdateUtility.cc:51
getopt.h
getopt
int getopt(int argc, char **argv, char *opts)
Definition: getopt.c:31
MultiSenseUtilities.hh
multisense::Channel::create
static std::unique_ptr< Channel > create(const Config &config, const ChannelImplementation &impl=ChannelImplementation::LEGACY)
Factory create function which allows for switching between different channel implementations.
Definition: factory.cc:42
multisense
Definition: factory.cc:39
optarg
char * optarg
Definition: getopt.c:29
main
int main(int argc, char **argv)
Definition: LibMultiSense/VersionInfoUtility/VersionInfoUtility.cc:71


multisense_lib
Author(s):
autogenerated on Thu Apr 17 2025 02:49:09