Initial commit
This commit is contained in:
31
services/beerservice.h
Normal file
31
services/beerservice.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef BEERSERVICE_H
|
||||
#define BEERSERVICE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtWebSockets/QWebSocket>
|
||||
|
||||
class BeerService : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BeerService(QObject *parent = nullptr);
|
||||
~BeerService();
|
||||
|
||||
Q_INVOKABLE void connectSrv(const QString &userId = QString());
|
||||
Q_INVOKABLE void sendCommand(const QString &entity, const QString &action, const QVariantMap &data = QVariantMap());
|
||||
Q_INVOKABLE void connectListener(QObject *listener);
|
||||
|
||||
private:
|
||||
QString stashFileName() const;
|
||||
void saveStash() const;
|
||||
void restoreStash();
|
||||
void sendCommand(const QVariantMap &command);
|
||||
|
||||
QMultiMap<QString, QObject *> m_listeners;
|
||||
|
||||
QWebSocket m_socket;
|
||||
QVariantList m_commandStash;
|
||||
};
|
||||
|
||||
#endif // BEERSERVICE_H
|
||||
Reference in New Issue
Block a user