Hmm.... thanks for this really interesting approach. I will do some tests with a single thread environment.
Actually I stuck in another problem. As mentioned earlier I'm really familiar with C# and Java. But I'm completely new to QT. I plan to create a BaseClass for the handlers for different manufacturers.
I planned to make a base class that defines the set of methods that will be called by the serial thread. First I tried to make an Interface but I didn't manage it The implementation classes shall emit Signals to be able to connect them to the database thread.
Now I'm trying it with a BaseClass which I want to subclass. But even with my 10 line trial I stuck in linker warnings.
This is the implmentation now:
serialhandlerbase.h
#ifndef SERIALHANDLERBASE_H
#define SERIALHANDLERBASE_H
#include <QObject>
class SerialHandlerBase
: public QObject{
Q_OBJECT
public:
SerialHandlerBase();
virtual void startHandling();
virtual void stopHandling();
};
#endif // SERIALHANDLERBASE_H
#ifndef SERIALHANDLERBASE_H
#define SERIALHANDLERBASE_H
#include <QObject>
class SerialHandlerBase : public QObject
{
Q_OBJECT
public:
SerialHandlerBase();
virtual void startHandling();
virtual void stopHandling();
};
#endif // SERIALHANDLERBASE_H
To copy to clipboard, switch view to plain text mode
serialbasehandler.cpp
#include "serialhandlerbase.h"
SerialHandlerBase::SerialHandlerBase()
{
}
#include "serialhandlerbase.h"
SerialHandlerBase::SerialHandlerBase()
{
}
To copy to clipboard, switch view to plain text mode
The compiler says: undefined reference to 'vtable for SerialHandlerBase'
and the linker: collect2: Id returned 1 exit status
I can get rid of the compiler messages if I declare a destructor and implement it in the cpp file. But it does not fix the linker message.
Do you have an idea for me?
Bookmarks