Commit e107a34a authored by Valentin Platzgummer's avatar Valentin Platzgummer

temp

parent 40da114d
......@@ -453,6 +453,8 @@ HEADERS += \
src/MeasurementComplexItem/geometry/TileDiff.h \
src/MeasurementComplexItem/geometry/geometry.h \
src/MeasurementComplexItem/HashFunctions.h \
src/MeasurementComplexItem/nemo_interface/Command.h \
src/MeasurementComplexItem/nemo_interface/CommandDispatcher.h \
src/MeasurementComplexItem/nemo_interface/MeasurementTile.h \
src/QmlControls/QmlUnitsConversion.h \
src/MeasurementComplexItem/geometry/GeoArea.h \
......@@ -534,6 +536,8 @@ SOURCES += \
src/MeasurementComplexItem/geometry/SafeArea.cc \
src/MeasurementComplexItem/geometry/geometry.cpp \
src/MeasurementComplexItem/HashFunctions.cpp \
src/MeasurementComplexItem/nemo_interface/Command.cpp \
src/MeasurementComplexItem/nemo_interface/CommandDispatcher.cpp \
src/MeasurementComplexItem/nemo_interface/MeasurementTile.cpp \
src/Vehicle/VehicleEscStatusFactGroup.cc \
src/MeasurementComplexItem/AreaData.cc \
......
......@@ -9,6 +9,7 @@
#include "LogicalArray.h"
#include "TileArray.h"
#include "TilePtrArray.h"
#include "geometry/ProgressArray.h"
// Singelton class used to interface measurement devices implementing the nemo
// interface.
......@@ -26,11 +27,11 @@ public:
static NemoInterface *instance();
enum class STATUS {
NOT_CONNECTED = 0,
HEARTBEAT_DETECTED = 1,
WEBSOCKET_DETECTED = 2,
TIMEOUT = -1,
INVALID_HEARTBEAT = -2
NOT_CONNECTED,
READY,
WEBSOCKET_DETECTED,
TIMEOUT,
INVALID_HEARTBEAT
};
Q_ENUM(STATUS)
......@@ -39,9 +40,12 @@ public:
Q_PROPERTY(QString editorQml READ editorQml CONSTANT)
Q_PROPERTY(bool running READ running NOTIFY runningChanged)
QString editorQml();
Q_INVOKABLE void start();
Q_INVOKABLE void stop();
// Tile editing.
void addTiles(const TilePtrArray &tileArray);
void addTiles(const TileArray &tileArray);
void removeTiles(const IDArray &idArray);
......@@ -49,18 +53,22 @@ public:
TileArray getTiles(const IDArray &idArray);
TileArray getAllTiles();
LogicalArray containsTiles(const IDArray &idArray);
TileArray extractTiles(const IDArray &idArray);
std::size_t size();
bool empty();
// Progress.
ProgressArray getProgress();
ProgressArray getProgress(const IDArray &idArray);
// Status.
STATUS status() const;
QString statusString() const;
QString editorQml();
bool running();
signals:
void statusChanged();
void progressChanged();
void progressChanged(const ProgressArray &progressArray);
void tilesChanged();
void runningChanged();
private:
......
#include "Command.h"
namespace nemo_interface {
Command::Command(Functor onExec) : _onExec(onExec) {}
QFuture<Command::ERROR> Command::exec() { return _onExec(); }
} // namespace nemo_interface
#ifndef COMMAND_H
#define COMMAND_H
#include <QFuture>
#include <functional>
namespace nemo_interface {
class Command {
public:
enum class ERROR {
NO_ERROR,
NETWORK_TIMEOUT,
PARAMETER_ERROR,
UNEXPECTED_SERVER_RESPONSE
};
typedef QFuture<ERROR> ReturnType;
typedef std::function<ReturnType()> Functor;
Command(Functor onExec);
QFuture<ERROR> exec();
private:
Functor _onExec;
};
} // namespace nemo_interface
#endif // COMMAND_H
#include "CommandDispatcher.h"
CommandDispatcher::CommandDispatcher()
{
}
#ifndef COMMANDDISPATCHER_H
#define COMMANDDISPATCHER_H
class CommandDispatcher
{
public:
CommandDispatcher();
};
#endif // COMMANDDISPATCHER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment