Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • cali
  • dev
  • master
3 results

Target

Select target project
  • sugu/vimba
1 result
Select Git revision
  • cali
  • dev
  • master
3 results
Show changes
Commits on Source (1)
Showing
with 174 additions and 113 deletions
...@@ -105,6 +105,7 @@ extern "C" { ...@@ -105,6 +105,7 @@ extern "C" {
// //
typedef enum VmbErrorType typedef enum VmbErrorType
{ {
VmbErrorNothing = 27, // No error. No Success. Nothing really!
VmbErrorSuccess = 0, // No error VmbErrorSuccess = 0, // No error
VmbErrorInternalFault = -1, // Unexpected fault in VimbaC or driver VmbErrorInternalFault = -1, // Unexpected fault in VimbaC or driver
VmbErrorApiNotStarted = -2, // VmbStartup() was not called before the current command VmbErrorApiNotStarted = -2, // VmbStartup() was not called before the current command
......
...@@ -313,6 +313,9 @@ VmbErrorType ApiController::QueueFrame( FramePtr pFrame ) ...@@ -313,6 +313,9 @@ VmbErrorType ApiController::QueueFrame( FramePtr pFrame )
QObject* ApiController::GetCameraObserver() QObject* ApiController::GetCameraObserver()
{ {
return SP_DYN_CAST( m_pCameraObserver, CameraObserver ).get(); return SP_DYN_CAST( m_pCameraObserver, CameraObserver ).get();
// so same as
// return SP_ACCESS(SP_DYN_CAST( m_pCameraObserver, CameraObserver );
// ??
} }
// //
......
...@@ -40,6 +40,8 @@ namespace AVT { ...@@ -40,6 +40,8 @@ namespace AVT {
namespace VmbAPI { namespace VmbAPI {
namespace Examples { namespace Examples {
//Why VIRTUAL inheritance?? https://www.sandordargo.com/blog/2020/12/23/virtual-inheritance
class FrameObserver : public QObject, virtual public IFrameObserver class FrameObserver : public QObject, virtual public IFrameObserver
{ {
Q_OBJECT Q_OBJECT
......
...@@ -255,7 +255,7 @@ class OpenCVRecorder: public QThread ...@@ -255,7 +255,7 @@ class OpenCVRecorder: public QThread
// Details: main thread processing function that will run while the object is alife. // Details: main thread processing function that will run while the object is alife.
// //
// //
void run() void run() override
{ {
while( ! m_StopThread ) while( ! m_StopThread )
{ {
......
...@@ -22,8 +22,8 @@ QT_BEGIN_MOC_NAMESPACE ...@@ -22,8 +22,8 @@ QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_MainWindow_t { struct qt_meta_stringdata_MainWindow_t {
const uint offsetsAndSize[14]; const uint offsetsAndSize[16];
char stringdata0[55]; char stringdata0[65];
}; };
#define QT_MOC_LITERAL(ofs, len) \ #define QT_MOC_LITERAL(ofs, len) \
uint(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs), len uint(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs), len
...@@ -35,11 +35,12 @@ QT_MOC_LITERAL(15, 0), // "" ...@@ -35,11 +35,12 @@ QT_MOC_LITERAL(15, 0), // ""
QT_MOC_LITERAL(16, 10), // "VmbError_t" QT_MOC_LITERAL(16, 10), // "VmbError_t"
QT_MOC_LITERAL(27, 3), // "err" QT_MOC_LITERAL(27, 3), // "err"
QT_MOC_LITERAL(31, 10), // "updateCams" QT_MOC_LITERAL(31, 10), // "updateCams"
QT_MOC_LITERAL(42, 12) // "opencloseCam" QT_MOC_LITERAL(42, 12), // "openCloseCam"
QT_MOC_LITERAL(55, 9) // "selectCam"
}, },
"MainWindow\0log\0\0VmbError_t\0err\0" "MainWindow\0log\0\0VmbError_t\0err\0"
"updateCams\0opencloseCam" "updateCams\0openCloseCam\0selectCam"
}; };
#undef QT_MOC_LITERAL #undef QT_MOC_LITERAL
...@@ -49,7 +50,7 @@ static const uint qt_meta_data_MainWindow[] = { ...@@ -49,7 +50,7 @@ static const uint qt_meta_data_MainWindow[] = {
10, // revision 10, // revision
0, // classname 0, // classname
0, 0, // classinfo 0, 0, // classinfo
4, 14, // methods 5, 14, // methods
0, 0, // properties 0, 0, // properties
0, 0, // enums/sets 0, 0, // enums/sets
0, 0, // constructors 0, 0, // constructors
...@@ -57,15 +58,17 @@ static const uint qt_meta_data_MainWindow[] = { ...@@ -57,15 +58,17 @@ static const uint qt_meta_data_MainWindow[] = {
0, // signalCount 0, // signalCount
// slots: name, argc, parameters, tag, flags, initial metatype offsets // slots: name, argc, parameters, tag, flags, initial metatype offsets
1, 2, 38, 2, 0x0a, 1 /* Public */, 1, 2, 44, 2, 0x0a, 1 /* Public */,
1, 1, 43, 2, 0x2a, 4 /* Public | MethodCloned */, 1, 1, 49, 2, 0x2a, 4 /* Public | MethodCloned */,
5, 0, 46, 2, 0x08, 6 /* Private */, 5, 0, 52, 2, 0x08, 6 /* Private */,
6, 2, 47, 2, 0x08, 7 /* Private */, 6, 0, 53, 2, 0x08, 7 /* Private */,
7, 2, 54, 2, 0x08, 8 /* Private */,
// slots: parameters // slots: parameters
QMetaType::Void, QMetaType::QString, 0x80000000 | 3, 2, 4, QMetaType::Void, QMetaType::QString, 0x80000000 | 3, 2, 4,
QMetaType::Void, QMetaType::QString, 2, QMetaType::Void, QMetaType::QString, 2,
QMetaType::Void, QMetaType::Void,
QMetaType::Void,
QMetaType::Void, QMetaType::Int, QMetaType::Int, 2, 2, QMetaType::Void, QMetaType::Int, QMetaType::Int, 2, 2,
0 // eod 0 // eod
...@@ -80,7 +83,8 @@ void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, ...@@ -80,7 +83,8 @@ void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id,
case 0: _t->log((*reinterpret_cast< std::add_pointer_t<QString>>(_a[1])),(*reinterpret_cast< std::add_pointer_t<VmbError_t>>(_a[2]))); break; case 0: _t->log((*reinterpret_cast< std::add_pointer_t<QString>>(_a[1])),(*reinterpret_cast< std::add_pointer_t<VmbError_t>>(_a[2]))); break;
case 1: _t->log((*reinterpret_cast< std::add_pointer_t<QString>>(_a[1]))); break; case 1: _t->log((*reinterpret_cast< std::add_pointer_t<QString>>(_a[1]))); break;
case 2: _t->updateCams(); break; case 2: _t->updateCams(); break;
case 3: _t->opencloseCam((*reinterpret_cast< std::add_pointer_t<int>>(_a[1])),(*reinterpret_cast< std::add_pointer_t<int>>(_a[2]))); break; case 3: _t->openCloseCam(); break;
case 4: _t->selectCam((*reinterpret_cast< std::add_pointer_t<int>>(_a[1])),(*reinterpret_cast< std::add_pointer_t<int>>(_a[2]))); break;
default: ; default: ;
} }
} }
...@@ -94,7 +98,7 @@ const QMetaObject MainWindow::staticMetaObject = { { ...@@ -94,7 +98,7 @@ const QMetaObject MainWindow::staticMetaObject = { {
nullptr, nullptr,
qt_incomplete_metaTypeArray<qt_meta_stringdata_MainWindow_t qt_incomplete_metaTypeArray<qt_meta_stringdata_MainWindow_t
, QtPrivate::TypeAndForceComplete<MainWindow, std::true_type> , QtPrivate::TypeAndForceComplete<MainWindow, std::true_type>
, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<QString, std::false_type>, QtPrivate::TypeAndForceComplete<VmbError_t, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<QString, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<int, std::false_type>, QtPrivate::TypeAndForceComplete<int, std::false_type> , QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<QString, std::false_type>, QtPrivate::TypeAndForceComplete<VmbError_t, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<QString, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<int, std::false_type>, QtPrivate::TypeAndForceComplete<int, std::false_type>
>, >,
...@@ -121,13 +125,13 @@ int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) ...@@ -121,13 +125,13 @@ int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
if (_id < 0) if (_id < 0)
return _id; return _id;
if (_c == QMetaObject::InvokeMetaMethod) { if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4) if (_id < 5)
qt_static_metacall(this, _c, _id, _a); qt_static_metacall(this, _c, _id, _a);
_id -= 4; _id -= 5;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4) if (_id < 5)
*reinterpret_cast<QMetaType *>(_a[0]) = QMetaType(); *reinterpret_cast<QMetaType *>(_a[0]) = QMetaType();
_id -= 4; _id -= 5;
} }
return _id; return _id;
} }
......
...@@ -15,11 +15,17 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -15,11 +15,17 @@ MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
, ui(new Ui::MainWindow) , ui(new Ui::MainWindow)
, sys(VimbaSystem::GetInstance()) // Create and get Vimba singleton , sys(VimbaSystem::GetInstance()) // Create and get Vimba singleton
, curCam(CameraPtr())
, cameras(CameraPtrVector()) , cameras(CameraPtrVector())
, camInfoNames({"name","model","id","serial","interface","state"})
{ {
ui->setupUi(this); ui->setupUi(this);
ui->tw_cams->setColumnCount(camInfoNames.size());
ui->tw_cams->setHorizontalHeaderLabels(camInfoNames);
QObject::connect(ui->b_update, SIGNAL(clicked()), this, SLOT(updateCams())); QObject::connect(ui->b_update, SIGNAL(clicked()), this, SLOT(updateCams()));
QObject::connect(ui->tw_cams, SIGNAL(cellClicked(int,int)), this, SLOT(openCloseCam(int,int))); QObject::connect(ui->b_openclose, SIGNAL(clicked()), this, SLOT(openCloseCam()));
QObject::connect(ui->tw_cams, SIGNAL(cellClicked(int,int)), this, SLOT(selectCam(int,int)));
log(getVersionString()); log(getVersionString());
...@@ -57,45 +63,56 @@ void MainWindow::keyPressEvent(QKeyEvent *e) ...@@ -57,45 +63,56 @@ void MainWindow::keyPressEvent(QKeyEvent *e)
return QWidget::keyPressEvent(e); return QWidget::keyPressEvent(e);
} }
void MainWindow::opencloseCam(int row,int col) void MainWindow::selectCam(int row,int )
{ {
log(QString("%1,%2").arg(row).arg(col)); curCam = cameras.at(row);
auto cam = cameras.at(row); //display Stream on label (stackedWidget)
auto item = ui->tw_cams->itemAt(row,col); //display options in dockwidget-right
if( item->text() == "opened" )
}
void MainWindow::openCloseCam()
{
QPushButton* b = ui->b_openclose;
if( b->text() == "open" )
{ {
//close auto ret = curCam->Open(VmbAccessModeFull);
auto ret = cam->Close(); if( ret == VmbErrorSuccess )
log( QString("Close camera %1").arg(row), ret ); b->setText("close");
log( QString("Open camera"), ret );
} }
else else if( b->text() == "close" )
{ {
//open auto ret = curCam->Close();
auto ret = cam->Open(VmbAccessModeFull); if( ret == VmbErrorSuccess )
log( QString("Open camera %1").arg(row), ret ); b->setText("open");
log( QString("Close camera"), ret );
} }
} }
void MainWindow::updateCams() void MainWindow::updateCams()
{ {
// clear
ui->tw_cams->clear(); ui->tw_cams->setRowCount(0);
ui->tw_cams->clearContents(); //dont remove headers
VmbErrorType err = sys.GetCameras( cameras ); // Fetch all cameras known to Vimba curCam = CameraPtr();
cameras = CameraPtrVector();
// get new
VmbErrorType err = sys.GetCameras( cameras ); // fetch all cameras known to Vimba
if( VmbErrorSuccess == err ) if( VmbErrorSuccess == err )
{ {
// query and print all _static_ details of all known cams [without opening cams] // query and print all _static_ details of all known cams [without opening cams]
auto ncam = cameras.size(); auto ncam = cameras.size();
log( QString("Found %1 Camera%2!").arg(ncam).arg(ncam>1?"s":"")); log( QString("Found %1 Camera%2!").arg(ncam).arg(ncam>1?"s":""));
auto mf = std::bind(&MainWindow::printCamInfo, this, std::placeholders::_1); //weird syntax for calling non-static memberfunction in for_each... auto mf = std::bind(&MainWindow::getCamInfo, this, std::placeholders::_1); //weird syntax for calling non-static memberfunction in for_each...
ui->tw_cams->setRowCount(ncam); // ui->tw_cams->setRowCount(ncam);
std::for_each( cameras.begin(), cameras.end(), mf ); std::for_each( cameras.begin(), cameras.end(), mf );
if( cameras.size() ) if( cameras.size() )
{ ui->tw_cams->setCurrentCell(0,0); //select row
ui->tw_cams->setCurrentCell(0,0); //XXX select row?
}
} }
else else
{ {
...@@ -103,49 +120,66 @@ void MainWindow::updateCams() ...@@ -103,49 +120,66 @@ void MainWindow::updateCams()
} }
} }
/// get static cam info and add to listwidget /// get static cam info
void MainWindow::printCamInfo( const CameraPtr &camera ) void MainWindow::getCamInfo( const CameraPtr &camera )
{ {
std::string strID, strName, strModelName, strSerialNumber, strInterfaceID, strCaminfo; std::string str;
QStringList infos;
VmbErrorType err = camera->GetID( strID ); VmbErrorType err = camera->GetID( str );
if( VmbErrorSuccess != err ) if( VmbErrorSuccess != err )
strID = errorCodeToMessage(err).toStdString(); str = errorCodeToMessage(err).toStdString();
infos << QString::fromStdString(str);
err = camera->GetName( strName ); err = camera->GetName( str );
if( VmbErrorSuccess != err ) if( VmbErrorSuccess != err )
strName = errorCodeToMessage(err).toStdString(); str = errorCodeToMessage(err).toStdString();
infos << QString::fromStdString(str);
err = camera->GetModel( strModelName ); err = camera->GetModel( str );
if( VmbErrorSuccess != err ) if( VmbErrorSuccess != err )
strModelName = errorCodeToMessage(err).toStdString(); str = errorCodeToMessage(err).toStdString();
infos << QString::fromStdString(str);
err = camera->GetSerialNumber( strSerialNumber ); err = camera->GetSerialNumber( str );
if( VmbErrorSuccess != err ) if( VmbErrorSuccess != err )
strSerialNumber = errorCodeToMessage(err).toStdString(); str = errorCodeToMessage(err).toStdString();
infos << QString::fromStdString(str);
err = camera->GetInterfaceID( strInterfaceID ); err = camera->GetInterfaceID( str );
if( VmbErrorSuccess != err ) if( VmbErrorSuccess != err )
strInterfaceID = errorCodeToMessage(err).toStdString(); str = errorCodeToMessage(err).toStdString();
infos << QString::fromStdString(str);
strCaminfo = \ infos << "closed"; //initially cams are closed, right?
"Name : " + strName + //XXX use sth like isClosed() instead??
"\nModel : " + strModelName +
"\nID : " + strID +
"\nSerial : " + strSerialNumber +
"\n@Interface : " + strInterfaceID + "\n\n";
QString caminfo = QString::fromStdString(strCaminfo);
auto row = ui->tw_cams->rowCount()-1; //XXX use icon instead of text
//QTableWidgetItem(const QIcon &icon, const QString &text, int type = Type)
ui->tw_cams->setItem( row, 0, new QTableWidgetItem( caminfo ) ); addRow(infos);
ui->tw_cams->setItem( row, 1, new QTableWidgetItem("closed") ); //XXX setIcon ?? QStringList sl= {randomString(),randomString(),randomString(),randomString(),randomString(),randomString()};
addRow(sl);
} }
///add row to listwidget
void MainWindow::addRow( QStringList& camInfos )
{
auto row = ui->tw_cams->rowCount();
ui->tw_cams->setRowCount(row+1);
for( auto col=0; col < ui->tw_cams->columnCount(); col++)
{
auto item = new QTableWidgetItem( camInfos.at(col) );
item->setTextAlignment(Qt::AlignCenter);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); //but not editable!
ui->tw_cams->setItem( row, col, item );
}
}
void MainWindow::log(QString msg, VmbError_t err ) void MainWindow::log(QString msg, VmbError_t err )
{ {
msg.append(QString("%1" ).arg(errorCodeToMessage(err))); msg.append(QString("%1").arg(errorCodeToMessage(err)));
//for std::string, use: log(QString::fromStdString(msg)) //for std::string, use: log(QString::fromStdString(msg))
auto idx = ui->lw_log->count()-1; auto idx = ui->lw_log->count()-1;
......
...@@ -18,20 +18,25 @@ public: ...@@ -18,20 +18,25 @@ public:
~MainWindow(); ~MainWindow();
public slots: public slots:
void log(QString,VmbError_t err = VmbErrorSuccess); void log(QString,VmbError_t err = VmbErrorNothing);
private slots: private slots:
void updateCams(); void updateCams();
void opencloseCam(int,int); void openCloseCam();
void selectCam(int,int);
protected: protected:
void keyPressEvent(QKeyEvent *); void keyPressEvent(QKeyEvent *);
private: private:
void printCamInfo( const AVT::VmbAPI::CameraPtr &camera ); void getCamInfo( const AVT::VmbAPI::CameraPtr &camera );
void addRow( QStringList& );
Ui::MainWindow *ui; Ui::MainWindow *ui;
AVT::VmbAPI::VimbaSystem &sys; AVT::VmbAPI::VimbaSystem &sys;
AVT::VmbAPI::CameraPtr curCam;
AVT::VmbAPI::CameraPtrVector cameras; AVT::VmbAPI::CameraPtrVector cameras;
QStringList camInfoNames;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H
...@@ -6,63 +6,36 @@ ...@@ -6,63 +6,36 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>984</width>
<height>600</height> <height>622</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<widget class="QTableWidget" name="tw_cams_2"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="geometry"> <item>
<rect> <widget class="QLabel" name="l_vid">
<x>50</x> <property name="text">
<y>30</y> <string/>
<width>311</width> </property>
<height>241</height> </widget>
</rect> </item>
</property> </layout>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="rowCount">
<number>3</number>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<row/>
<row/>
<row/>
<column/>
<column/>
</widget>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>984</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/> <widget class="QStatusBar" name="statusbar"/>
<widget class="QDockWidget" name="dockWidget"> <widget class="QDockWidget" name="dockWidget_down">
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>8</number> <number>8</number>
</attribute> </attribute>
...@@ -74,7 +47,7 @@ ...@@ -74,7 +47,7 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QDockWidget" name="dockWidget_2"> <widget class="QDockWidget" name="dockWidget_left">
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>1</number> <number>1</number>
</attribute> </attribute>
...@@ -83,20 +56,43 @@ ...@@ -83,20 +56,43 @@
<item> <item>
<widget class="QPushButton" name="b_update"> <widget class="QPushButton" name="b_update">
<property name="text"> <property name="text">
<string>update</string> <string>update (search Cams)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="tw_cams"> <widget class="QTableWidget" name="tw_cams">
<property name="columnCount"> <property name="selectionBehavior">
<number>2</number> <enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property> </property>
<attribute name="horizontalHeaderVisible"> <attribute name="horizontalHeaderVisible">
<bool>false</bool> <bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>true</bool>
</attribute> </attribute>
<column/> </widget>
<column/> </item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget_right">
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_3">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QPushButton" name="b_openclose">
<property name="text">
<string>open</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
......
#include "opencv2/core/version.hpp" #include "opencv2/core/version.hpp"
#include <random>
#include "mainwindow.h" #include "mainwindow.h"
#include "VimbaCPP/Include/VimbaCPP.h" #include "VimbaCPP/Include/VimbaCPP.h"
#include <QString> #include <QString>
#include <QDebug>
const int APP_VERSION_MAJOR = 0; const int APP_VERSION_MAJOR = 0;
...@@ -32,7 +35,8 @@ const QString errorCodeToMessage( VmbError_t err ) ...@@ -32,7 +35,8 @@ const QString errorCodeToMessage( VmbError_t err )
switch( err ) switch( err )
{ {
default: msg += "Unknown"; break; default: msg += "Unknown"; break;
case VmbErrorSuccess: msg = ""; break; case VmbErrorNothing: msg = ""; break;
case VmbErrorSuccess: msg = "Success"; break;
case VmbErrorInternalFault: msg += "Unexpected fault in VmbApi or driver."; break; case VmbErrorInternalFault: msg += "Unexpected fault in VmbApi or driver."; break;
case VmbErrorApiNotStarted: msg += "API not started."; break; case VmbErrorApiNotStarted: msg += "API not started."; break;
case VmbErrorNotFound: msg += "Not found."; break; case VmbErrorNotFound: msg += "Not found."; break;
...@@ -55,3 +59,14 @@ const QString errorCodeToMessage( VmbError_t err ) ...@@ -55,3 +59,14 @@ const QString errorCodeToMessage( VmbError_t err )
return msg; return msg;
} }
QString randomString()
{
QStringList list{"a", "b", "c", "d", "e", "f", "g"};
//, "h", "i", "j", "k", "l", "m"};
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(list.begin(), list.end(), g);
QString randomString = list.join("");
qDebug() << "Random string:" << randomString;
return randomString;
}
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
const QString getVersionString(); const QString getVersionString();
const QString errorCodeToMessage( VmbError_t ); const QString errorCodeToMessage( VmbError_t );
QString randomString();
#endif #endif