NemoInterface.h 1.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#pragma once

#include <QGeoCoordinate>
#include <QObject>

#include <memory>

class TileData;

class NemoInterface : public QObject {
  Q_OBJECT
  class Impl;
  using PImpl = std::unique_ptr<Impl>;

15 16 17 18
  NemoInterface();
  NemoInterface(NemoInterface &other) = delete;
  static NemoInterface *createInstance();

19
public:
20 21 22
  ~NemoInterface() override;
  static NemoInterface *instance();

23 24 25 26 27 28 29
  enum class STATUS {
    NOT_CONNECTED = 0,
    HEARTBEAT_DETECTED = 1,
    WEBSOCKET_DETECTED = 2,
    TIMEOUT = -1,
    INVALID_HEARTBEAT = -2
  };
30
  Q_ENUM(STATUS)
31

32
  Q_PROPERTY(STATUS status READ status NOTIFY statusChanged)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
  Q_PROPERTY(QString statusString READ statusString NOTIFY statusChanged)
  Q_PROPERTY(QVector<int> progress READ progress NOTIFY progressChanged)
  Q_PROPERTY(QString editorQml READ editorQml CONSTANT)
  Q_PROPERTY(bool running READ running NOTIFY runningChanged)

  Q_INVOKABLE void start();
  Q_INVOKABLE void stop();
  Q_INVOKABLE void publishTileData();
  Q_INVOKABLE void requestProgress();

  void setTileData(const TileData &tileData);
  bool hasTileData(const TileData &tileData) const;
  void setAutoPublish(bool ap);
  void setHoldProgress(bool hp);

48
  STATUS status() const;
49 50 51 52 53 54 55 56 57 58 59 60 61
  QString statusString() const;
  QVector<int> progress() const;
  QString editorQml();
  bool running();

signals:
  void statusChanged();
  void progressChanged();
  void runningChanged();

private:
  PImpl pImpl;
};
62 63

#define pNemoInterface NemoInterface::instance()