|
@@ -19,6 +19,7 @@ static char gstr_devport[256];
|
|
|
static char gstr_yaml[256];
|
|
|
static char gstr_modulename[256];
|
|
|
static char gstr_devmode[256];
|
|
|
+static char gstr_devtype[256];
|
|
|
|
|
|
/**
|
|
|
* @brief print_useage
|
|
@@ -35,6 +36,7 @@ void print_useage()
|
|
|
std::cout<<" -d --devport $port : port . eq. -d 2369"<<std::endl;
|
|
|
std::cout<<" -f --devport $port : port . eq. -f 0"<<std::endl;
|
|
|
std::cout<<" -s --setyaml $yaml : port . eq. -s rs1.yaml"<<std::endl;
|
|
|
+ std::cout<<" -t --settype $type : type . eq. -t ch128x1"<<std::endl;
|
|
|
std::cout<<" -h --help print help"<<std::endl;
|
|
|
}
|
|
|
|
|
@@ -48,7 +50,7 @@ int GetOptLong(int argc, char *argv[]) {
|
|
|
// 第几个元素的描述,即是long_opts的下标值
|
|
|
int option_index = 0;
|
|
|
// 设置短参数类型及是否需要参数
|
|
|
- const char *optstring = "n:m:r:x:y:p:d:f:s:h";
|
|
|
+ const char *optstring = "n:m:r:x:y:p:d:f:s:t:h";
|
|
|
|
|
|
// 设置长参数类型及其简写,比如 --reqarg <==>-r
|
|
|
/*
|
|
@@ -74,6 +76,7 @@ int GetOptLong(int argc, char *argv[]) {
|
|
|
{"devport", required_argument, NULL, 'd'},
|
|
|
{"devmode", required_argument, NULL, 'f'},
|
|
|
{"setyaml", required_argument, NULL, 's'},
|
|
|
+ {"settype", required_argument, NULL, 't'},
|
|
|
{"help", no_argument, NULL, 'h'},
|
|
|
// {"optarg", optional_argument, NULL, 'o'},
|
|
|
{0, 0, 0, 0} // 添加 {0, 0, 0, 0} 是为了防止输入空值
|
|
@@ -122,6 +125,9 @@ int GetOptLong(int argc, char *argv[]) {
|
|
|
case 's':
|
|
|
strncpy(gstr_yaml,optarg,255);
|
|
|
break;
|
|
|
+ case 't':
|
|
|
+ strncpy(gstr_devtype,optarg,255);
|
|
|
+ break;
|
|
|
case 'h':
|
|
|
print_useage();
|
|
|
nRtn = 1; //because use -h
|
|
@@ -212,6 +218,7 @@ int main(int argc, char *argv[])
|
|
|
snprintf(gstr_devmode,255,"0");//默认端口号
|
|
|
snprintf(gstr_yaml,255," ");
|
|
|
snprintf(gstr_modulename,255,"driver_lidar_leishenc16");
|
|
|
+ snprintf(gstr_devtype,255,"ch128x1");
|
|
|
|
|
|
int nRtn = GetOptLong(argc,argv);
|
|
|
if(nRtn == 1) //show help,so exit.
|
|
@@ -226,7 +233,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
leishenchx * pleishenchx = new leishenchx(gstr_memname,atof(gstr_rollang),atof(gstr_inclinationang_xaxis),
|
|
|
atof(gstr_inclinationang_yaxis),atoi(gstr_devmode),static_cast<unsigned short>(atoi(gstr_port)),
|
|
|
- static_cast<unsigned short>(atoi(gstr_devport)));
|
|
|
+ static_cast<unsigned short>(atoi(gstr_devport)),std::string(gstr_devtype));
|
|
|
(void)pleishenchx;
|
|
|
|
|
|
return a.exec();
|