diff --git a/VimbaCPP/Examples/ListCameras/ListCameras.sublime-workspace b/VimbaCPP/Examples/ListCameras/ListCameras.sublime-workspace index 2bfd018979ebf5cdbd39ffe2c501d147e92e325c..ed0d8209aaa23aca290a48e3d2e10d1545291f14 100644 --- a/VimbaCPP/Examples/ListCameras/ListCameras.sublime-workspace +++ b/VimbaCPP/Examples/ListCameras/ListCameras.sublime-workspace @@ -241,17 +241,29 @@ { "buffer_size": 1869, "line_ending": "Windows" - } + }, + "undo_stack": + [ + ] }, { "file": "Source/ListCameras.cpp", "settings": { - "buffer_size": 5414, + "buffer_size": 5413, + "encoding": "UTF-8", "line_ending": "Windows" }, "undo_stack": [ + [ + 3, + 1, + "left_delete", + null, + "AQAAAEIHAAAAAAAAQgcAAAAAAAABAAAAYQ", + "AwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPC/AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8L8AAAAAAQAAAEMHAAAAAAAAQwcAAAAAAAAAAAAAAADwvw" + ] ] }, { @@ -499,7 +511,7 @@ ], "find": { - "height": 46.0 + "height": 45.0 }, "find_in_files": { @@ -513,6 +525,14 @@ "case_sensitive": false, "find_history": [ + "streamsyste", + "streamsyste,", + "streaminfo", + "ErrorCodeToMessage", + "error", + "strError", + "PrintCameraInfo", + "camera->", "VmbInterfaceType", "PrintCameraInfo", "asyn", @@ -632,15 +652,7 @@ "[]", "sort", "DEBUG", - "find(", - "parent", - "fix_all_parents", - "Parent", - "parent", - "sort(", - "add_kid", - "rand", - "std::" + "find(" ], "highlight": true, "in_selection": false, @@ -707,8 +719,8 @@ "selection": [ [ - 0, - 0 + 1664, + 1664 ] ], "settings": @@ -732,15 +744,15 @@ "semi_transient": false, "settings": { - "buffer_size": 5414, + "buffer_size": 5413, "regions": { }, "selection": [ [ - 1657, - 1657 + 1476, + 1476 ] ], "settings": @@ -750,7 +762,7 @@ "translate_tabs_to_spaces": true }, "translation.x": 0.0, - "translation.y": 675.0, + "translation.y": 430.0, "zoom_level": 1.0 }, "stack_index": 0, @@ -760,7 +772,7 @@ { "buffer": 2, "file": "Source/program.cpp", - "semi_transient": true, + "semi_transient": false, "settings": { "buffer_size": 1894, @@ -899,7 +911,7 @@ "show_minimap": true, "show_open_files": false, "show_tabs": true, - "side_bar_visible": true, + "side_bar_visible": false, "side_bar_width": 199.0, "status_bar_visible": true, "template_settings": diff --git a/VimbaCPP/Examples/ListCameras/Source/ListCameras.cpp b/VimbaCPP/Examples/ListCameras/Source/ListCameras.cpp index b60bea25acde7ba1f5b16c305624b32aaae348a9..0258c994201ffb57b170077b7e29d1750cc5fb83 100644 --- a/VimbaCPP/Examples/ListCameras/Source/ListCameras.cpp +++ b/VimbaCPP/Examples/ListCameras/Source/ListCameras.cpp @@ -42,7 +42,7 @@ namespace VmbAPI { namespace Examples { /**printing camera info for a camera. -*\note this function is used with for_each and is called for each camera in range cameras.begin(), cameraas.end() +*\note this function is used with for_each and is called for each camera in range cameras.begin(), cameras.end() */ void PrintCameraInfo( const CameraPtr &camera ) { diff --git a/VimbaCPP/Include/Feature.hpp b/VimbaCPP/Include/Feature.hpp index 023b5f7b91d968f32ed81581725b7714d87b7143..e782c18be07b6a8154a2f52e9bd23c25b5169f78 100644 --- a/VimbaCPP/Include/Feature.hpp +++ b/VimbaCPP/Include/Feature.hpp @@ -137,7 +137,8 @@ inline VmbErrorType Feature::GetValue( std::string &rStrValue ) const VmbErrorType res; VmbUint32_t nLength; - res = GetValue( (char * const)NULL, nLength ); + // res = GetValue( (char * const)NULL, nLength ); //threw warning of ignored type qualifiers... + res = GetValue( NULL, nLength ); if ( VmbErrorSuccess == res ) { if ( 0 != nLength ) diff --git a/recorder/obj/moc_mainwindow.cpp b/recorder/obj/moc_mainwindow.cpp index f6290f87d201aa13916f97b04a3fa50e413f0c3c..11a1798abb1cac1fe4c73efc9cbef03fb722d0cf 100644 --- a/recorder/obj/moc_mainwindow.cpp +++ b/recorder/obj/moc_mainwindow.cpp @@ -22,8 +22,8 @@ QT_BEGIN_MOC_NAMESPACE QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED struct qt_meta_stringdata_MainWindow_t { - const uint offsetsAndSize[8]; - char stringdata0[38]; + const uint offsetsAndSize[10]; + char stringdata0[48]; }; #define QT_MOC_LITERAL(ofs, len) \ uint(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs), len @@ -32,10 +32,12 @@ static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = { QT_MOC_LITERAL(0, 10), // "MainWindow" QT_MOC_LITERAL(11, 3), // "log" QT_MOC_LITERAL(15, 0), // "" -QT_MOC_LITERAL(16, 21) // "on_pushButton_clicked" +QT_MOC_LITERAL(16, 21), // "on_pushButton_clicked" +QT_MOC_LITERAL(38, 9) // "list_cams" }, - "MainWindow\0log\0\0on_pushButton_clicked" + "MainWindow\0log\0\0on_pushButton_clicked\0" + "list_cams" }; #undef QT_MOC_LITERAL @@ -45,7 +47,7 @@ static const uint qt_meta_data_MainWindow[] = { 10, // revision 0, // classname 0, 0, // classinfo - 2, 14, // methods + 3, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -53,11 +55,13 @@ static const uint qt_meta_data_MainWindow[] = { 0, // signalCount // slots: name, argc, parameters, tag, flags, initial metatype offsets - 1, 1, 26, 2, 0x0a, 1 /* Public */, - 3, 0, 29, 2, 0x08, 3 /* Private */, + 1, 1, 32, 2, 0x0a, 1 /* Public */, + 3, 0, 35, 2, 0x08, 3 /* Private */, + 4, 0, 36, 2, 0x08, 4 /* Private */, // slots: parameters QMetaType::Void, QMetaType::QString, 2, + QMetaType::Void, QMetaType::Void, 0 // eod @@ -71,6 +75,7 @@ void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, switch (_id) { case 0: _t->log((*reinterpret_cast< std::add_pointer_t<QString>>(_a[1]))); break; case 1: _t->on_pushButton_clicked(); break; + case 2: _t->list_cams(); break; default: ; } } @@ -84,7 +89,7 @@ const QMetaObject MainWindow::staticMetaObject = { { nullptr, qt_incomplete_metaTypeArray<qt_meta_stringdata_MainWindow_t , QtPrivate::TypeAndForceComplete<MainWindow, std::true_type> -, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<const QString &, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type> +, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<const QString &, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type> >, @@ -111,13 +116,13 @@ int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { - if (_id < 2) + if (_id < 3) qt_static_metacall(this, _c, _id, _a); - _id -= 2; + _id -= 3; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { - if (_id < 2) + if (_id < 3) *reinterpret_cast<QMetaType *>(_a[0]) = QMetaType(); - _id -= 2; + _id -= 3; } return _id; } diff --git a/recorder/obj/recorder.pro b/recorder/obj/recorder.pro index 0f15cdddbbb4b860e23bf7663853c85587a933a9..2162e8f1a9593940f69d9691850bf4fe76804926 100644 --- a/recorder/obj/recorder.pro +++ b/recorder/obj/recorder.pro @@ -4,12 +4,14 @@ QT += core gui widgets CONFIG += c++20 warn_on SOURCES += \ + ../src/main.cpp \ ../src/mainwindow.cpp \ - ../src/main.cpp + ../src/utils.cpp HEADERS += \ + ui_mainwindow.h \ ../src/mainwindow.h \ - ui_mainwindow.h + ../src/utils.h FORMS += \ ../src/mainwindow.ui diff --git a/recorder/recorder.sublime-project b/recorder/recorder.sublime-project index 1da6170837725a8d309336b345dabf41cb522c1a..5a915b83e2f4967c062e394d6241964c892ddb76 100644 --- a/recorder/recorder.sublime-project +++ b/recorder/recorder.sublime-project @@ -20,25 +20,24 @@ "working_dir": "$project_path/obj", "shell_cmd": "qmake6 && make -j8 && cd ../bin && recorder", + // COLORS in output? - // "syntax": "Packages/Makefile/Make Output.sublime-syntax", + "env": {"GCC_COLORS": "error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01"}, //force color for some CLI programs + "env": {"CLICOLOR_FORCE": "1"}, //force color for some CLI programs + "syntax": "/home/sugu/.config/sublime-text/Packages/User/make-output.sublime-syntax", + // "syntax": "/home/sugu/.config/sublime-text/Packages/User/C++.sublime-syntax", - // "env": {"GCC_COLORS": "error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01"}, //force color for some CLI programs - // "env": {"CLICOLOR_FORCE": "1"}, //force color for some CLI programs - // "target": "ansi_color_build", //add target and syntax - // "syntax": "Packages/ANSIescape/ANSI.sublime-syntax", - // "syntax": "Packages/User/ANSIescape/ansi.sublime-color-scheme", - // "target": "ansi_color_build", - // "syntax": "Packages/ANSIescape/ansi.sublime-color-scheme", + //### RESULTS // -> toggle with shortcuts + // capture up to four fields of error information from a results view, namely: filename, line number, column number and error message. + // Use groups in the pattern to capture this information. The filename field and the line number field are required. + // test in: https://regex101.com/r/yN4tJ6/1 + "file_regex": "([a-zA-Z0-9\\.\\/_-]+):([0-9]*):([0-9]*): ((note|warning|error|fatal error): ([^\\n]*))", + // (\w+\.\w+)*:([0-9]*):([0-9]*): ((note|warning|error): ([^\n]*)) -// RESULTS -// -> toggle with shortcuts -// result_file_regex -// capture up to four fields of error information from a results view, namely: filename, line number, column number and error message. Use groups in the pattern to capture this information. The filename field and the line number field are required. -// result_line_regex -// If result_file_regex doesn’t match but result_line_regex exists and does match on the current line, -// walk backwards through the buffer until a line matching result_file_regex is found, and use the two matches to determine the file and line to go to. -// result_base_dir + // "line_regex": "...", // If file_regex doesn’t match but result_line_regex exists and does match on the current line, + // walk backwards through the buffer until a line matching result_file_regex is found, + // and use the two matches to determine the file and line to go to. + // result_base_dir "variants": diff --git a/recorder/src/main.cpp b/recorder/src/main.cpp index b1489ef6f1ac7da0b4bc82a7fae2dcd6106fce3a..64d07bcac2d9e7df8e166035b050071d6c3cff2d 100644 --- a/recorder/src/main.cpp +++ b/recorder/src/main.cpp @@ -5,43 +5,17 @@ #include "VimbaCPP/Include/VimbaCPP.h" -#include "version.h" -#include <QThread> -#include <QDebug> - using namespace AVT::VmbAPI; -int main2(int argc, char *argv[]) +int main(int argc, char *argv[]) { - MainWindow w; - QApplication a(argc, argv); + QApplication a(argc, argv); + MainWindow w; - w.show(); - return a.exec(); + w.show(); + return a.exec(); } -using namespace std; -int main(int, char const *[]) -{ - QThread::msleep(500); - qDebug() << getVersionString(); - QThread::msleep(500); - VimbaSystem& sys = VimbaSystem::GetInstance(); - QThread::msleep(500); - if ( VmbErrorSuccess == sys.Startup() ) - { - std::cout << " Started Vimba Api" << std::endl; - } - else - { - std::cout << " Failed to start Vimba Api" << std::endl; - } - return 0; -} - - -// using std::cout; -// using std::endl; // #include "opencv2/opencv.hpp" // cv::VideoWriter m_VideoWriter; // OpenCV VideoWriter diff --git a/recorder/src/mainwindow.cpp b/recorder/src/mainwindow.cpp index ddad3298b44a47f084fc920e926891ee83a656e3..d3474b2733868f8bb306fe118e355021caf60199 100644 --- a/recorder/src/mainwindow.cpp +++ b/recorder/src/mainwindow.cpp @@ -1,60 +1,107 @@ -#include "version.h" +#include "utils.h" #include "mainwindow.h" #include "../obj/ui_mainwindow.h" #include <QDebug> #include <unistd.h> - -#include "VimbaCPP/Include/VimbaCPP.h" +#include <iostream> using namespace AVT::VmbAPI; MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) - , ui(new Ui::MainWindow) - , sys(VimbaSystem::GetInstance()) // Create and get Vimba singleton -{ - ui->setupUi(this); - - // VimbaSystem &sys = VimbaSystem::GetInstance(); // Create and get Vimba singleton +: QMainWindow(parent) +, ui(new Ui::MainWindow) + , sys(VimbaSystem::GetInstance()) // Create and get Vimba singleton + { + ui->setupUi(this); - // sys = VimbaSystem::GetInstance(); - log(getVersionString()); + log(getVersionString()); - if ( VmbErrorSuccess == sys.Startup() ) - { - log( " Started Vimba Api" ); - } - else - { - log( " Failed to start Vimba Api" ); - } + if ( VmbErrorSuccess == sys.Startup() ) + { + log( " Started Vimba C++ Api" ); + } + else + { + log( " Failed to start Vimba C++ Api" ); + } } MainWindow::~MainWindow() { - if ( VmbErrorSuccess == sys.Shutdown() ) - { - log( " Shutdown Vimba Api" ); - } - else - { - log( " Failed to Shutdown Vimba Api" ); - } - delete ui; + if ( VmbErrorSuccess == sys.Shutdown() ) + { + log( " Shutdown Vimba Api" ); + } + else + { + log( " Failed to Shutdown Vimba Api" ); + } + delete ui; } void MainWindow::on_pushButton_clicked() { - log("button click"); + list_cams(); +} + +void MainWindow::list_cams() +{ + CameraPtrVector cameras; // A vector of std::shared_ptr<AVT::VmbAPI::Camera> objects + VmbErrorType err = sys.GetCameras( cameras ); // Fetch all cameras known to Vimba + if( VmbErrorSuccess == err ) + { + std::cout << "Cameras found: " << cameras.size() <<"\n\n"; + + // query and print all _static_ details of all known cams [without opening cams] + auto mf = std::bind(&MainWindow::printCamInfo, this, std::placeholders::_1); //weird syntax for calling non-static memberfunction... + std::for_each( cameras.begin(), cameras.end(), mf ); + } + else + { + log( QString("Could not list cameras Err: %1\n" ).arg(errorCodeToMessage(err)) ); + } +} + +void MainWindow::printCamInfo( const CameraPtr &camera ) +{ + std::string strID, strName, strModelName, strSerialNumber, strInterfaceID, caminfo; + + VmbErrorType err = camera->GetID( strID ); + if( VmbErrorSuccess != err ) + strID = errorCodeToMessage(err).toStdString(); + + err = camera->GetName( strName ); + if( VmbErrorSuccess != err ) + strName = errorCodeToMessage(err).toStdString(); + + err = camera->GetModel( strModelName ); + if( VmbErrorSuccess != err ) + strModelName = errorCodeToMessage(err).toStdString(); + + err = camera->GetSerialNumber( strSerialNumber ); + if( VmbErrorSuccess != err ) + strSerialNumber = errorCodeToMessage(err).toStdString(); + + err = camera->GetInterfaceID( strInterfaceID ); + if( VmbErrorSuccess != err ) + strInterfaceID = errorCodeToMessage(err).toStdString(); + + caminfo = "/// Camera Name : " + strName + + "\n/// Model Name : " + strModelName + + "\n/// Camera ID : " + strID + + "\n/// Serial Number : " + strSerialNumber + + "\n/// @ Interface ID : " + strInterfaceID + "\n\n"; + + log( QString::fromStdString(caminfo)); } void MainWindow::log(const QString& msg) { - // QString::fromStdString( ) - ui->logWidget->insertItem( 0, msg ); - qDebug() << msg; + // QString::fromStdString( ) + ui->logWidget->insertItem( 0, msg ); + qDebug() << msg; } diff --git a/recorder/src/mainwindow.h b/recorder/src/mainwindow.h index a39cd25018678a59718b6c77576782ff4f2debd2..34cfa30a64a832e2695a67d5489afe1cb350e578 100644 --- a/recorder/src/mainwindow.h +++ b/recorder/src/mainwindow.h @@ -2,30 +2,33 @@ #define MAINWINDOW_H #include <QMainWindow> +#include "VimbaCPP/Include/VimbaCPP.h" QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE -namespace AVT { namespace VmbAPI { class VimbaSystem; } } - +namespace AVT { namespace VmbAPI { class VimbaSystem; } } class MainWindow : public QMainWindow { - Q_OBJECT + Q_OBJECT public: - MainWindow(QWidget *parent = nullptr); - ~MainWindow(); + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); public slots: - void log(const QString&); + void log(const QString&); private slots: - void on_pushButton_clicked(); + void on_pushButton_clicked(); + void list_cams(); private: - Ui::MainWindow *ui; - AVT::VmbAPI::VimbaSystem &sys; + void printCamInfo( const AVT::VmbAPI::CameraPtr &camera ); + + Ui::MainWindow *ui; + AVT::VmbAPI::VimbaSystem &sys; }; #endif // MAINWINDOW_H diff --git a/recorder/src/recorder.cpp b/recorder/src/recorder.cpp index d2a23eec0e11babdbd3841545d98c5bb2105319a..6a4f7b6fca5ccab5808da1dccbd121900311e346 100644 --- a/recorder/src/recorder.cpp +++ b/recorder/src/recorder.cpp @@ -18,20 +18,20 @@ using std::endl; // read_and_display_img("/home/sugu/code/c++/opencv_quark/starry_night.png"); //make HOME user independent // int read_and_display_img( cv::String img_with_path ) // { -// std::vector<int> vec; -// cv::Mat image; -// image = imread(img_with_path, cv::IMREAD_COLOR); // Read the file -// if( image.empty() ) // Check for invalid input -// { -// cout << "Could not open or find the image" << std::endl ; -// return -1; -// } - -// namedWindow( "Display window", cv::WINDOW_AUTOSIZE ); // Create a window for display. -// imshow( "Display window", image ); // Show our image inside it. -// cv::waitKey(0); // Wait for a keystroke in the window - -// return 0; +// std::vector<int> vec; +// cv::Mat image; +// image = imread(img_with_path, cv::IMREAD_COLOR); // Read the file +// if( image.empty() ) // Check for invalid input +// { +// cout << "Could not open or find the image" << std::endl ; +// return -1; +// } + +// namedWindow( "Display window", cv::WINDOW_AUTOSIZE ); // Create a window for display. +// imshow( "Display window", image ); // Show our image inside it. +// cv::waitKey(0); // Wait for a keystroke in the window + +// return 0; // } @@ -39,47 +39,47 @@ using std::endl; // { -// CameraPtrVector cameras; - -// if ( VmbErrorSuccess == sys.Startup() ) -// { -// sys.GetCameras( cameras ); -// if ( VmbErrorSuccess == sys.GetCameras ( cameras ) ) -// { -// cout << "found " << cameras.size() << " cameras" << endl; -// for ( auto iter = cameras.begin (); cameras.end () != iter; ++ iter ) -// { -// if ( VmbErrorSuccess == (* iter)->Open( VmbAccessModeFull ) ) -// { -// std::cout << " Camera opened " << std::endl; -// std::string str; -// (*iter)->GetID( str ); -// std::cout << " Id: " << str << std::endl; -// (*iter)->GetName( str ); -// std::cout << " name: " << str << std::endl; -// (*iter)->GetModel( str ); -// std::cout << " model: " << str << std::endl; -// (*iter)->GetSerialNumber( str ); -// std::cout << " serial: " << str << std::endl; -// // (*iter)->GetPermittedAccess( VmbAccessModeType& ); -// // std::cout << " model: " << str << std::endl; -// (*iter)->GetInterfaceID( str ); //name/id of connected IF -// std::cout << " interfaceID: " << str << std::endl; -// } -// } -// } -// else -// { -// cout << "Couldn't get cameras" << endl; -// } - -// sys.Shutdown(); //unload TLs -// } -// else -// { -// cout << "Couldn't initialize API" << endl; -// } -// return 0; -// } +// CameraPtrVector cameras; + +// if ( VmbErrorSuccess == sys.Startup() ) +// { +// sys.GetCameras( cameras ); +// if ( VmbErrorSuccess == sys.GetCameras ( cameras ) ) +// { +// cout << "found " << cameras.size() << " cameras" << endl; +// for ( auto iter = cameras.begin (); cameras.end () != iter; ++ iter ) +// { +// if ( VmbErrorSuccess == (* iter)->Open( VmbAccessModeFull ) ) +// { +// std::cout << " Camera opened " << std::endl; +// std::string str; +// (*iter)->GetID( str ); +// std::cout << " Id: " << str << std::endl; +// (*iter)->GetName( str ); +// std::cout << " name: " << str << std::endl; +// (*iter)->GetModel( str ); +// std::cout << " model: " << str << std::endl; +// (*iter)->GetSerialNumber( str ); +// std::cout << " serial: " << str << std::endl; +// // (*iter)->GetPermittedAccess( VmbAccessModeType& ); +// // std::cout << " model: " << str << std::endl; +// (*iter)->GetInterfaceID( str ); //name/id of connected IF +// std::cout << " interfaceID: " << str << std::endl; +// } +// } +// } +// else +// { +// cout << "Couldn't get cameras" << endl; +// } + +// sys.Shutdown(); //unload TLs +// } +// else +// { +// cout << "Couldn't initialize API" << endl; +// } +// return 0; +// } // // }} diff --git a/recorder/src/utils.cpp b/recorder/src/utils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0b3bb98df62da5222ff2efb2fbebe3b5e6a83b7d --- /dev/null +++ b/recorder/src/utils.cpp @@ -0,0 +1,55 @@ +#include "opencv2/core/version.hpp" + +#include "mainwindow.h" +#include "VimbaCPP/Include/VimbaCPP.h" +#include <QString> + +const int APP_VERSION_MAJOR = 0; +const int APP_VERSION_MINOR = 0; +const int APP_VERSION_PATCH = 2; + +using namespace AVT::VmbAPI; + +const QString getVersionString() +{ + VmbVersionInfo_t version; + VimbaSystem::GetInstance().QueryVersion(version); + + QString s = "### Versions\n"; + s += QStringLiteral("# Recorder: %1.%2.%3\n").arg(APP_VERSION_MAJOR).arg(APP_VERSION_MINOR).arg(APP_VERSION_PATCH); + s += QStringLiteral("# Vimba: %1.%2.%3\n").arg(version.major).arg(version.minor).arg(version.patch); + s += QStringLiteral("# Qt: %1.%2.%3\n").arg(QT_VERSION_MAJOR).arg(QT_VERSION_MINOR).arg(QT_VERSION_PATCH); + s += QStringLiteral("# openCV: %1.%2.%3\n").arg(CV_VERSION_MAJOR).arg(CV_VERSION_MINOR).arg(CV_VERSION_REVISION); + + return s; +} + + +const QString errorCodeToMessage( VmbError_t err ) +{ + QString msg = "error: "; + switch( err ) + { + default: msg += "Unknown"; break; + case VmbErrorSuccess: msg += "Success."; break; + case VmbErrorInternalFault: msg += "Unexpected fault in VmbApi or driver."; break; + case VmbErrorApiNotStarted: msg += "API not started."; break; + case VmbErrorNotFound: msg += "Not found."; break; + case VmbErrorBadHandle: msg += "Invalid handle "; break; + case VmbErrorDeviceNotOpen: msg += "Device not open."; break; + case VmbErrorInvalidAccess: msg += "Invalid access."; break; + case VmbErrorBadParameter: msg += "Bad parameter."; break; + case VmbErrorStructSize: msg += "Wrong DLL version."; break; + case VmbErrorMoreData: msg += "More data returned than memory provided."; break; + case VmbErrorWrongType: msg += "Wrong type."; break; + case VmbErrorInvalidValue: msg += "Invalid value."; break; + case VmbErrorTimeout: msg += "Timeout."; break; + case VmbErrorOther: msg += "TL error."; break; + case VmbErrorResources: msg += "Resource not available."; break; + case VmbErrorInvalidCall: msg += "Invalid call."; break; + case VmbErrorNoTL: msg += "TL not loaded."; break; + case VmbErrorNotImplemented: msg += "Not implemented."; break; + case VmbErrorNotSupported: msg += "Not supported."; break; + } + return msg; +} diff --git a/recorder/src/utils.h b/recorder/src/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..30c154c8cb85d28f832fb4c227279f5634d592f5 --- /dev/null +++ b/recorder/src/utils.h @@ -0,0 +1,11 @@ +#ifndef UTILS_H +#define UTILS_H + +#include <QString> + +#include "VimbaC/Include/VmbCommonTypes.h" //VmbError_t -> how to fwd decl?? + +const QString getVersionString(); +const QString errorCodeToMessage( VmbError_t ); + +#endif diff --git a/recorder/src/version.h b/recorder/src/version.h deleted file mode 100644 index c97cacad6a28216ad7b14d8b4077270d10958e70..0000000000000000000000000000000000000000 --- a/recorder/src/version.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef VERSION_H -#define VERSION_H - - -#include "opencv2/core/version.hpp" - -#include "mainwindow.h" -#include "VimbaCPP/Include/VimbaCPP.h" - -const int APP_VERSION_MAJOR = 0; -const int APP_VERSION_MINOR = 0; -const int APP_VERSION_PATCH = 1; - -using namespace AVT::VmbAPI; - -inline const QString getVersionString() -{ - VmbVersionInfo_t version; - VimbaSystem::GetInstance().QueryVersion(version); - - QString s = "### Versions\n"; - s += QStringLiteral("# Recorder: %1.%2.%3\n").arg(APP_VERSION_MAJOR).arg(APP_VERSION_MINOR).arg(APP_VERSION_PATCH); - s += QStringLiteral("# Vimba: %1.%2.%3\n").arg(version.major).arg(version.minor).arg(version.patch); - s += QStringLiteral("# Qt: %1.%2.%3\n").arg(QT_VERSION_MAJOR).arg(QT_VERSION_MINOR).arg(QT_VERSION_PATCH); - s += QStringLiteral("# openCV: %1.%2.%3\n").arg(CV_VERSION_MAJOR).arg(CV_VERSION_MINOR).arg(CV_VERSION_REVISION); - - return s; -} - - -#endif