38 #ifndef WIN32_LEAN_AND_MEAN 39 #define WIN32_LEAN_AND_MEAN 1 46 #include <arpa/inet.h> 67 volatile bool doneG =
false;
69 void usage(
const char *programNameP)
71 std::cerr <<
"USAGE: " << programNameP <<
" [<options>]" << std::endl;
72 std::cerr <<
"Where <options> are:" << std::endl;
73 std::cerr <<
"\t-a <current_address> : CURRENT IPV4 address (default=10.66.171.21)" << std::endl;
79 BOOL WINAPI signalHandler(DWORD dwCtrlType)
81 std::cerr <<
"Shutting down on signal: CTRL-C" << std::endl;
86 void signalHandler(
int sig)
88 std::cerr <<
"Shutting down on signal: " << strsignal(sig) << std::endl;
93 bool savePgm(
const std::string& fileName,
96 uint32_t bitsPerPixel,
99 std::ofstream outputStream(fileName.c_str(), std::ios::binary | std::ios::out);
101 if (
false == outputStream.good()) {
102 std::cerr <<
"Failed to open \"" << fileName <<
"\"" << std::endl;
106 const uint32_t imageSize = height * width;
108 switch(bitsPerPixel) {
112 outputStream <<
"P5\n" 113 << width <<
" " << height <<
"\n" 116 outputStream.write(reinterpret_cast<const char*>(dataP), imageSize);
122 outputStream <<
"P5\n" 123 << width <<
" " << height <<
"\n" 126 const uint16_t *imageP =
reinterpret_cast<const uint16_t*
>(dataP);
128 for (uint32_t i=0; i<imageSize; ++i) {
129 uint16_t o = htons(imageP[i]);
130 outputStream.write(reinterpret_cast<const char*>(&o),
sizeof(uint16_t));
137 outputStream.close();
144 std::cerr <<
"PPS: " << header.
sensorTime <<
" ns" << std::endl;
160 static int64_t lastFrameId = -1;
162 if (-1 == lastFrameId)
176 std::cerr <<
"failed to get histogram for frame " << header.
frameId << std::endl;
184 std::string currentAddress =
"10.66.171.21";
188 SetConsoleCtrlHandler (signalHandler, TRUE);
190 signal(SIGINT, signalHandler);
198 while(-1 != (c =
getopt(argc, argvPP,
"a:m:")))
200 case 'a': currentAddress = std::string(
optarg);
break;
201 case 'm': mtu = atoi(
optarg);
break;
202 default:
usage(*argvPP);
break;
209 if (NULL == channelP) {
210 std::cerr <<
"Failed to establish communications with \"" << currentAddress <<
"\"" << std::endl;
227 std::cout <<
"API build date : " << v.
apiBuildDate <<
"\n";
228 std::cout <<
"API version : 0x" << std::hex << std::setw(4) << std::setfill(
'0') << v.
apiVersion <<
"\n";
230 std::cout <<
"Firmware version : 0x" << std::hex << std::setw(4) << std::setfill(
'0') << v.
sensorFirmwareVersion <<
"\n";
233 std::cout <<
"FPGA DNA : 0x" << std::hex << v.
sensorFpgaDna <<
"\n";
234 std::cout << std::dec;
262 status = channelP->
setMtu(mtu);
299 std::cout <<
"Uptime: " << statusMessage.
uptime <<
", " <<
300 "SystemOk: " << statusMessage.
systemOk <<
", " <<
304 "Input Voltage: " << statusMessage.
inputVoltage <<
", " <<
305 "Input Current: " << statusMessage.
inputCurrent <<
", " <<
306 "FPGA Power: " << statusMessage.
fpgaPower <<
", " <<
307 "Logic Power: " << statusMessage.
logicPower <<
", " <<
308 "Imager Power: " << statusMessage.
imagerPower << std::endl;
virtual Status startStreams(DataSource mask)=0
static const char * statusString(Status status)
static CRL_CONSTEXPR TriggerSource Trigger_Internal
virtual Status stopStreams(DataSource mask)=0
uint64_t sensorHardwareMagic
static Channel * Create(const std::string &sensorAddress)
int main(int argc, char **argvPP)
virtual Status getImageHistogram(int64_t frameId, image::Histogram &histogram)=0
void setResolution(uint32_t w, uint32_t h)
std::string sensorFirmwareBuildDate
virtual Status getVersionInfo(system::VersionInfo &v)=0
int getopt(int argc, char **argv, char *opts)
static CRL_CONSTEXPR DataSource Source_Lidar_Scan
virtual Status addIsolatedCallback(image::Callback callback, DataSource imageSourceMask, void *userDataP=NULL)=0
float leftImagerTemperature
virtual Status setTriggerSource(TriggerSource s)=0
static CRL_CONSTEXPR Status Status_Ok
virtual Status setMtu(int32_t mtu)=0
virtual Status setImageConfig(const image::Config &c)=0
VersionType sensorFirmwareVersion
virtual Status getDeviceStatus(system::StatusMessage &status)=0
static void Destroy(Channel *instanceP)
float rightImagerTemperature
uint64_t sensorHardwareVersion
virtual Status getImageConfig(image::Config &c)=0
virtual Status getSensorVersion(VersionType &version)=0
static CRL_CONSTEXPR DataSource Source_All
static CRL_CONSTEXPR DataSource Source_Luma_Rectified_Left