minor modifications. after verif. with ros and opencv

parent c950bff4
......@@ -18,22 +18,33 @@ namespace CMvbluefox3 {
CMvbluefox3::CMvbluefox3(const std::string &serial)
{
if (this->devMgr_.getDeviceBySerial(serial) == 0)
throw CmvBlueFOX3Exception(_HERE_, "No device found! Unable to continue. " + AvailableDevices());
if( !serial.empty() )
{
std::cout << "[mvBlueFOX3]: Trying to open device with serial: " << serial << std::endl;
// create an interface to the found device
this->device_ = this->devMgr_[0];
if (this->devMgr_.getDeviceBySerial(serial) == 0)
{
throw CmvBlueFOX3Exception(_HERE_, "No device found! Unable to continue. " + AvailableDevices());
}
else
{
// create an interface to the found device
this->device_ = this->devMgr_[0];
// Initialize other vars
this->timeout_ms_ = -1;
this->depth_ = 8;
this->bytes_per_pixel_ = 1;
// Initialize other vars
this->timeout_ms_ = -1;
this->depth_ = 8;
this->bytes_per_pixel_ = 1;
// displayPropertyData(this->device_->defaultRequestCount);
// WriteProperty(this->device_->defaultRequestCount,1);
// displayPropertyData(this->device_->defaultRequestCount);
// WriteProperty(this->device_->defaultRequestCount,1);
// open device
OpenDevice(serial);
// open device
OpenDevice(serial);
}
}
else
throw CmvBlueFOX3Exception(_HERE_, "Device cannot be found because serial number is not specified.");
}
CMvbluefox3::~CMvbluefox3()
......@@ -57,16 +68,23 @@ CMvbluefox3::~CMvbluefox3()
std::string CMvbluefox3::AvailableDevices(SUPPORTED_DEVICE_CHECK pSupportedDeviceCheckFn) const
{
std::ostringstream devices;
devices << "[mvBlueFOX3]: Available device(s): \n";
devices << "Available device(s): ";
const unsigned int devCnt = this->devMgr_.deviceCount();
for( unsigned int i = 0; i < devCnt; i++ )
if (devCnt == 0)
{
devices << "0.";
}
else
{
Device* pDev = this->devMgr_[i];
if( pDev )
for( unsigned int i = 0; i < devCnt; i++ )
{
if( !pSupportedDeviceCheckFn || pSupportedDeviceCheckFn( pDev ) )
Device* pDev = this->devMgr_[i];
if( pDev )
{
devices << " - " << pDev->product.read() << ": " << pDev->serial.read();
if( !pSupportedDeviceCheckFn || pSupportedDeviceCheckFn( pDev ) )
{
devices << " \n - " << pDev->product.read() << ": " << pDev->serial.read();
}
}
}
}
......
Markdown is supported
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