NemoInterface.h 1.3 KB
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1 2 3 4 5 6 7
#pragma once

#include <QGeoCoordinate>
#include <QObject>

#include <memory>

8 9
class TileData;

Valentin Platzgummer's avatar
Valentin Platzgummer committed
10 11 12 13 14 15
class NemoInterface : public QObject {
  Q_OBJECT
  class Impl;
  using PImpl = std::unique_ptr<Impl>;

public:
16 17 18 19 20 21
  enum class STATUS {
    NOT_CONNECTED = 0,
    HEARTBEAT_DETECTED = 1,
    WEBSOCKET_DETECTED = 2,
    TIMEOUT = -1,
    INVALID_HEARTBEAT = -2
Valentin Platzgummer's avatar
Valentin Platzgummer committed
22 23 24
  };

  explicit NemoInterface(QObject *parent = nullptr);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
25
  ~NemoInterface() override;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
26

27 28 29 30 31
  Q_PROPERTY(int status READ status NOTIFY statusChanged)
  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)
Valentin Platzgummer's avatar
Valentin Platzgummer committed
32

33 34 35 36 37 38
  Q_INVOKABLE void start();
  Q_INVOKABLE void stop();
  Q_INVOKABLE void publishTileData();
  Q_INVOKABLE void requestProgress();

  void setTileData(const TileData &tileData);
39
  bool hasTileData(const TileData &tileData) const;
40 41
  void setAutoPublish(bool ap);
  void setHoldProgress(bool hp);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
42

43 44 45
  int status() const;
  STATUS statusEnum() const;
  QString statusString() const;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
46
  QVector<int> progress() const;
47 48
  QString editorQml();
  bool running();
Valentin Platzgummer's avatar
Valentin Platzgummer committed
49 50 51 52

signals:
  void statusChanged();
  void progressChanged();
53
  void runningChanged();
Valentin Platzgummer's avatar
Valentin Platzgummer committed
54 55 56 57

private:
  PImpl pImpl;
};