mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 08:36:33 +00:00
Added sendData function call to remote main.
Commented out more things that are currently not needed.
This commit is contained in:
@@ -5,6 +5,14 @@
|
||||
#include <QString>
|
||||
#include <QThread>
|
||||
|
||||
struct RectangleProperties
|
||||
{
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
uint16_t middleX;
|
||||
uint16_t middleY;
|
||||
};
|
||||
|
||||
class RemoteControl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -21,6 +29,7 @@ private slots:
|
||||
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:
|
||||
void openNamedPipe(void);
|
||||
|
||||
@@ -6,8 +6,10 @@ int main(int argc, char *argv[])
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
RemoteControl remoteControl;
|
||||
remoteControl.createNamedPipe();
|
||||
remoteControl.startCommunication();
|
||||
|
||||
#ifdef FIFO_TEST
|
||||
remoteControl.startTest();
|
||||
#else
|
||||
remoteControl.sendData(200, 200, 400, 400);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,18 @@
|
||||
#include <random>
|
||||
#endif
|
||||
|
||||
RemoteControl::RemoteControl() {}
|
||||
RemoteControl::RemoteControl()
|
||||
{
|
||||
createNamedPipe();
|
||||
}
|
||||
|
||||
RemoteControl::~RemoteControl()
|
||||
{
|
||||
#ifdef FIFO_TEST
|
||||
if (mFifoFdIn != -1) {
|
||||
close(mFifoFdIn);
|
||||
}
|
||||
#endif
|
||||
if (mFifoFdOut != -1) {
|
||||
close(mFifoFdOut);
|
||||
}
|
||||
@@ -29,6 +34,7 @@ void RemoteControl::createNamedPipe()
|
||||
{
|
||||
struct stat statBuf;
|
||||
|
||||
#ifdef FIFO_TEST
|
||||
// Open incoming pipe (READ ONLY)
|
||||
if (stat(FIFO_FROM_GIMBAL, &statBuf) == 0) {
|
||||
if (S_ISFIFO(statBuf.st_mode)) {
|
||||
@@ -51,6 +57,7 @@ void RemoteControl::createNamedPipe()
|
||||
} else {
|
||||
qInfo().noquote().nospace() << "Opened pipe: " << FIFO_FROM_GIMBAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Open outgoing pipe (WRITE ONLY)
|
||||
if (stat(FIFO_TO_GIMBAL, &statBuf) == 0) {
|
||||
|
||||
@@ -12,16 +12,16 @@ class RemoteControl
|
||||
public:
|
||||
RemoteControl();
|
||||
~RemoteControl();
|
||||
void createNamedPipe(void);
|
||||
void sendData(uint16_t top, uint16_t left, uint16_t bottom, uint16_t right);
|
||||
#ifdef FIFO_TEST
|
||||
void startTest(void);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void createNamedPipe(void);
|
||||
#ifdef FIFO_TEST
|
||||
float randomFloatBetween(float min, float max);
|
||||
#endif
|
||||
int mFifoFdIn;
|
||||
#endif
|
||||
int mFifoFdOut;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user