37 #ifndef WIN32_LEAN_AND_MEAN 38 #define WIN32_LEAN_AND_MEAN 1 46 #include <sys/socket.h> 47 #include <netinet/in.h> 48 #include <arpa/inet.h> 72 void usage(
const char *programNameP)
74 fprintf(stderr,
"USAGE: %s [<options>]\n", programNameP);
75 fprintf(stderr,
"Where <options> are:\n");
76 fprintf(stderr,
"\t-a address : MultiSense IP Address (default=10.66.171.21)\n");
77 fprintf(stderr,
"\t-h height : Imager width, in px (default=544)\n");
78 fprintf(stderr,
"\t-w width : Imager height, in px (default=1024)\n");
79 fprintf(stderr,
"\t-m mode : Imager crop mode, (default=0)\n");
80 fprintf(stderr,
"\t 0 = No change sent\n");
81 fprintf(stderr,
"\t 2000 = Switch to CMV2000 ROI\n");
82 fprintf(stderr,
"\t 4000 = Switch to CMV4000 ROI\n");
83 fprintf(stderr,
"\t-o offset : Position of cropped ROI, in px from bottom of image\n");
84 fprintf(stderr,
"\t -1 = No change sent\n");
85 fprintf(stderr,
"\t 0 = ROI is bottom of CMV4000 FOV\n");
86 fprintf(stderr,
"\t 480 = ROI is center of CMV4000 FOV, assuming full resolution\n");
87 fprintf(stderr,
"\t 960 = ROI is top of CMV4000 FOV, assuming full resolution\n");
99 std::string currentAddress =
"10.66.171.21";
100 int32_t height = 544;
101 uint32_t width = 1024;
110 while(-1 != (c =
getopt(argc, argvPP,
"a:h:w:m:o:")))
112 case 'a': currentAddress = std::string(
optarg);
break;
113 case 'h': height = atoi(
optarg);
break;
114 case 'w': width = atoi(
optarg);
break;
115 case 'm': mode = atoi(
optarg);
break;
116 case 'o': offset = atoi(
optarg);
break;
117 default:
usage(*argvPP);
break;
123 Channel *channelP = Channel::Create(currentAddress);
124 if (NULL == channelP) {
125 std::cerr <<
"Failed to establish communications with \"" << currentAddress <<
"\"" << std::endl;
137 std::cerr <<
"Failed to query sensor version: " << Channel::statusString(status) << std::endl;
141 std::cout <<
"API build date : " << v.
apiBuildDate <<
"\n";
142 std::cout <<
"API version : 0x" << std::hex << std::setw(4) << std::setfill(
'0') << v.
apiVersion <<
"\n";
144 std::cout <<
"Firmware version : 0x" << std::hex << std::setw(4) << std::setfill(
'0') << v.
sensorFirmwareVersion <<
"\n";
147 std::cout <<
"FPGA DNA : 0x" << std::hex << v.
sensorFpgaDna <<
"\n";
148 std::cout << std::dec;
151 if (mode != 0 || offset >= 0) {
152 std::cerr <<
"Changing crop mode of a CMV4000 imager requires v3.5 or greater, sensor is " <<
166 std::cerr <<
"Failed to get image config: " << Channel::statusString(status) << std::endl;
181 std::cerr <<
"Failed to configure sensor: " << Channel::statusString(status) << std::endl;
189 Channel::Destroy(channelP);
uint64_t sensorHardwareMagic
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)
int main(int argc, char **argvPP)
static CRL_CONSTEXPR Status Status_Ok
virtual Status setImageConfig(const image::Config &c)=0
VersionType sensorFirmwareVersion
uint64_t sensorHardwareVersion
virtual Status getImageConfig(image::Config &c)=0