NemoInterface.h 1.77 KB
Newer Older
1 2 3 4 5 6 7
#pragma once

#include <QGeoCoordinate>
#include <QObject>

#include <memory>

8 9 10 11
#include "IDArray.h"
#include "LogicalArray.h"
#include "TileArray.h"
#include "TilePtrArray.h"
Valentin Platzgummer's avatar
Valentin Platzgummer committed
12
#include "geometry/ProgressArray.h"
13

14 15
// Singelton class used to interface measurement devices implementing the nemo
// interface.
16 17 18 19 20
class NemoInterface : public QObject {
  Q_OBJECT
  class Impl;
  using PImpl = std::unique_ptr<Impl>;

21 22 23 24
  NemoInterface();
  NemoInterface(NemoInterface &other) = delete;
  static NemoInterface *createInstance();

25
public:
26 27 28
  ~NemoInterface() override;
  static NemoInterface *instance();

29
  enum class STATUS {
Valentin Platzgummer's avatar
Valentin Platzgummer committed
30 31 32 33 34
    NOT_CONNECTED,
    READY,
    WEBSOCKET_DETECTED,
    TIMEOUT,
    INVALID_HEARTBEAT
35
  };
36
  Q_ENUM(STATUS)
37

38
  Q_PROPERTY(STATUS status READ status NOTIFY statusChanged)
39 40 41 42
  Q_PROPERTY(QString statusString READ statusString NOTIFY statusChanged)
  Q_PROPERTY(QString editorQml READ editorQml CONSTANT)
  Q_PROPERTY(bool running READ running NOTIFY runningChanged)

Valentin Platzgummer's avatar
Valentin Platzgummer committed
43 44
  QString editorQml();

45 46 47
  Q_INVOKABLE void start();
  Q_INVOKABLE void stop();

Valentin Platzgummer's avatar
Valentin Platzgummer committed
48
  // Tile editing.
49 50 51 52 53 54 55 56 57
  void addTiles(const TilePtrArray &tileArray);
  void addTiles(const TileArray &tileArray);
  void removeTiles(const IDArray &idArray);
  void clearTiles();
  TileArray getTiles(const IDArray &idArray);
  TileArray getAllTiles();
  LogicalArray containsTiles(const IDArray &idArray);
  std::size_t size();
  bool empty();
58

Valentin Platzgummer's avatar
Valentin Platzgummer committed
59 60 61 62 63
  // Progress.
  ProgressArray getProgress();
  ProgressArray getProgress(const IDArray &idArray);

  // Status.
64
  STATUS status() const;
65 66 67 68 69
  QString statusString() const;
  bool running();

signals:
  void statusChanged();
Valentin Platzgummer's avatar
Valentin Platzgummer committed
70 71
  void progressChanged(const ProgressArray &progressArray);
  void tilesChanged();
72 73 74 75 76
  void runningChanged();

private:
  PImpl pImpl;
};
77 78

#define pNemoInterface NemoInterface::instance()