diff --git a/src/mvbluefox3.cpp b/src/mvbluefox3.cpp index e06e6e61beb3ad8b85ea33bdb2c29e392024f9e7..19236e44d202cda283fb4ab13b9d32524ba67ee5 100644 --- a/src/mvbluefox3.cpp +++ b/src/mvbluefox3.cpp @@ -17,7 +17,7 @@ namespace CMvbluefox3 { -CMvbluefox3::CMvbluefox3(const mvIMPACT::acquire::Device *device) +CMvbluefox3::CMvbluefox3(const mvIMPACT::acquire::Device *device, const std::string &sett_path) { // Initialize vars this->device_ = new mvIMPACT::acquire::Device(*device); @@ -26,7 +26,7 @@ CMvbluefox3::CMvbluefox3(const mvIMPACT::acquire::Device *device) this->depth_ = 8; this->bytes_per_pixel_ = 1; - OpenDevice(); + OpenDevice(sett_path); } CMvbluefox3::~CMvbluefox3() @@ -47,7 +47,7 @@ CMvbluefox3::~CMvbluefox3() DelPtr(this->stats_); } -void CMvbluefox3::OpenDevice(void) +void CMvbluefox3::OpenDevice(const std::string &sett_path) { // Open the device try { this->device_->open(); } @@ -70,7 +70,11 @@ void CMvbluefox3::OpenDevice(void) this->bf_sets_->imageDestination.restoreDefault(); this->bf_sets_->imageProcessing.restoreDefault(); - SetConfig(this->params_,true); + if (!sett_path.empty()) + LoadSettings(sett_path); + + // Uncomment this function in case of filling manually the parameters before creating the CMvbluefox3 object externally, otherwise LoadSettings function will be used. + // SetConfig(this->params_,true); } void CMvbluefox3::CloseDevice(void) @@ -87,6 +91,13 @@ void CMvbluefox3::CloseDevice(void) } } +void CMvbluefox3::LoadSettings(const std::string &path) +{ + std::cout << "[mvBlueFOX3]: Loading stored settings for " << this->device_->product.readS() << " " << this->device_->serial.readS() << " from path: " << path << "." << std::endl; + this->fi_->loadSetting(path,TStorageFlag(sfFile)); + // this->fi_->loadSetting(path,TStorageFlag(sfFile|sfIgnoreBasicData)); +} + std::string CMvbluefox3::GetProduct(void) { if (this->device_==NULL) diff --git a/src/mvbluefox3.h b/src/mvbluefox3.h index a00cfe5f9e6d44fe71f2b878e8bc792425f9ba0c..9832d8ce81fd97d0fb1dadf09fc2b5064c28d9f2 100644 --- a/src/mvbluefox3.h +++ b/src/mvbluefox3.h @@ -176,7 +176,7 @@ class CMvbluefox3 * * Open device. */ - void OpenDevice(void); + void OpenDevice(const std::string &sett_path = std::string()); /** * \brief Get image request format @@ -357,7 +357,7 @@ class CMvbluefox3 * * Class constructor. */ - CMvbluefox3(const mvIMPACT::acquire::Device *device); + CMvbluefox3(const mvIMPACT::acquire::Device *device, const std::string &sett_path = std::string()); /** * \brief Class destructor @@ -372,6 +372,13 @@ class CMvbluefox3 * Close device. */ void CloseDevice(void); + + /** + * \brief Load camera settings (previously stored with wxPropView + * + * Load camera settings (previously stored with wxPropView. + */ + void LoadSettings(const std::string &path); /** * \brief Get device product name