sensor_api
source
Utilities
LibMultiSense
DeviceInfoUtility
LibMultiSense/DeviceInfoUtility/DeviceInfoUtility.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 <chrono>
49
#include <csignal>
50
#include <iostream>
51
52
#include <nlohmann/json.hpp>
53
54
#include <MultiSense/MultiSenseChannel.hh>
55
#include <
MultiSense/MultiSenseUtilities.hh
>
56
#include <
MultiSense/MultiSenseSerialization.hh
>
57
58
#include "
getopt/getopt.h
"
59
60
61
using
json
=
nlohmann::json
;
62
namespace
lms
=
multisense
;
63
64
namespace
65
{
66
67
void
usage
(
const
char
*name)
68
{
69
std::cerr <<
"USAGE: "
<< name <<
" [<options>]"
<< std::endl;
70
std::cerr <<
"Where <options> are:"
<< std::endl;
71
std::cerr <<
"\t-a <current_address> : CURRENT IPV4 address (default=10.66.171.21)"
<< std::endl;
72
std::cerr <<
"\t-m <mtu> : MTU to use to communicate with the camera (default=1500)"
<< std::endl;
73
exit(1);
74
}
75
76
}
77
78
int
main
(
int
argc,
char
** argv)
79
{
80
std::string ip_address =
"10.66.171.21"
;
81
int16_t mtu = 1500;
82
83
int
c;
84
while
(-1 != (c =
getopt
(argc, argv,
"a:m:s:k:y"
)))
85
{
86
switch
(c)
87
{
88
case
'a'
: ip_address = std::string(
optarg
);
break
;
89
case
'm'
: mtu =
static_cast<
uint16_t
>
(atoi(
optarg
));
break
;
90
default
:
usage
(*argv);
break
;
91
}
92
}
93
94
const
auto
channel =
lms::Channel::create
(lms::Channel::Config{ip_address, mtu});
95
if
(!channel)
96
{
97
std::cerr <<
"Failed to create channel"
<< std::endl;;
98
return
1;
99
}
100
101
const
json
info = channel->get_info().device;
102
std::cout << info.dump(4) << std::endl;
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
main
int main(int argc, char **argv)
Definition:
LibMultiSense/DeviceInfoUtility/DeviceInfoUtility.cc:78
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
json
nlohmann::json json
Definition:
LibMultiSense/DeviceInfoUtility/DeviceInfoUtility.cc:61
multisense
Definition:
factory.cc:39
MultiSenseSerialization.hh
optarg
char * optarg
Definition:
getopt.c:29
multisense_lib
Author(s):
autogenerated on Thu Apr 17 2025 02:49:08