Commit a4d8be7b authored by Yuelong Yu's avatar Yuelong Yu
Browse files

changed get camera method and do error check on each step

parent 69cd30f9
......@@ -43,30 +43,36 @@ namespace PcoNS
SLLoaderNS::SharedLibLoader<PcoInterfaces> pco_loader;
std::string libpath = lib_path+"/";
if(det_type == 0) //clhs
libpath += libname_pcoclhs;
if(det_type == 1) //me4
libpath += libname_pcome4;
if(!(pco_loader.OpenLib(libpath)))
{
cerr << "Error opening :" << libpath
<< "det type : "<< det_type << endl;
return nullptr;
}
if(!(pco = pco_loader.GetInstance()))
{
//try pco clhs then
std::string libpcoclhs = lib_path + "/" + libname_pcoclhs;
if((pco_loader.OpenLib(libpcoclhs)) &&
(pco = pco_loader.GetInstance()) &&
(pco->OpenCamera() == 0))
return pco;
else
pco_loader.CloseLib();
}
cerr << "Error on get instance" << endl;
pco_loader.CloseLib();
return nullptr;
}
if(det_type == 1)
if(!(pco->OpenCamera() == 0))
{
// try pcome4 first
std::string libpcome4 = lib_path + "/" + libname_pcome4;
if((pco_loader.OpenLib(libpcome4)) &&
(pco = pco_loader.GetInstance()) &&
(pco->OpenCamera() == 0))
return pco;
else
pco_loader.CloseLib();
cerr << "Error on open camera" << endl;
pco_loader.CloseLib();
return nullptr;
}
return nullptr;
return pco;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment