mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 21:56:35 +00:00
41 lines
944 B
C++
41 lines
944 B
C++
#pragma once
|
|
|
|
#include <QJsonDocument>
|
|
#include <QJsonObject>
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QThread>
|
|
#include <QtNetwork/QUdpSocket>
|
|
|
|
struct RectangleProperties
|
|
{
|
|
uint16_t width;
|
|
uint16_t height;
|
|
uint16_t middleX;
|
|
uint16_t middleY;
|
|
};
|
|
|
|
class RemoteControl : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit RemoteControl(QObject *parent = nullptr);
|
|
|
|
private slots:
|
|
void readPendingDatagrams();
|
|
void processJSON(QJsonDocument jsonDoc);
|
|
void sendResponse(void);
|
|
void calculateTargetPosition(QJsonObject &commandObject);
|
|
void turnToTarget(QJsonObject &commandObject);
|
|
void zoomToTarget(QJsonObject &commandObject);
|
|
void restoreOrientation(void);
|
|
void restoreZoom(void);
|
|
RectangleProperties calculateRectangleProperties(uint16_t top, uint16_t left, uint16_t bottom, uint16_t right);
|
|
|
|
private:
|
|
bool mIsBusy;
|
|
QUdpSocket *mUdpSocket;
|
|
QJsonObject mResponseObject;
|
|
};
|