NemoInterface.h 1.63 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"
12

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

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

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

28 29 30 31 32 33 34
  enum class STATUS {
    NOT_CONNECTED = 0,
    HEARTBEAT_DETECTED = 1,
    WEBSOCKET_DETECTED = 2,
    TIMEOUT = -1,
    INVALID_HEARTBEAT = -2
  };
35
  Q_ENUM(STATUS)
36

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

  Q_INVOKABLE void start();
  Q_INVOKABLE void stop();

45 46 47 48 49 50 51 52 53 54
  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);
  TileArray extractTiles(const IDArray &idArray);
  std::size_t size();
  bool empty();
55

56
  STATUS status() const;
57 58 59 60 61 62 63 64 65 66 67 68
  QString statusString() const;
  QString editorQml();
  bool running();

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

private:
  PImpl pImpl;
};
69 70

#define pNemoInterface NemoInterface::instance()