#ifndef BEERSERVICE_H #define BEERSERVICE_H #include #include #include "services/dumpservice.h" class SettingsService; class BeerService : public QObject { Q_OBJECT Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) public: static BeerService *instance() { static BeerService i; return &i; } enum Action { ActionUndefined = 0, ActionGet, ActionAdd, ActionDelete, ActionModify }; void sendCommand(const QString &entity, Action action, const QVariantMap &data = QVariantMap()); void connectListener(QObject *listener); void removeListener(QObject *listener); signals: void connectedChanged(); private: BeerService(); ~BeerService(); SettingsService *settings() const; void restoreStash(); void reconnect(); void sendCommand(const QVariantMap &command); bool connected() const; QMultiMap m_listeners; DumpService m_dumpService; QWebSocket m_socket; QVariantList m_commandStash; QMap m_actions; }; #endif // BEERSERVICE_H