From c9ffe70ee55df3c55e0390a8555968d0a9977fb2 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 12 Sep 2017 20:11:37 -0700 Subject: [PATCH] Better plan load signaling --- src/Vehicle/Vehicle.cc | 14 +++++++++++++- src/Vehicle/Vehicle.h | 6 ++++-- src/qgcunittest/UnitTest.cc | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 01030f8f8..f30d7590d 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -1959,7 +1959,7 @@ void Vehicle::_rallyPointLoadComplete(void) qCDebug(VehicleLog) << "_missionLoadComplete _initialPlanRequestComplete = true"; if (!_initialPlanRequestComplete) { _initialPlanRequestComplete = true; - emit initialPlanRequestCompleted(); + emit initialPlanRequestCompleteChanged(true); } } @@ -2812,6 +2812,18 @@ void Vehicle::_updateDistanceToHome(void) } } +void Vehicle::forceInitialPlanRequestComplete(void) +{ + _initialPlanRequestComplete = true; + emit initialPlanRequestCompleteChanged(true); +} + +void Vehicle::sendPlan(QString planFile) +{ + PlanMasterController::sendPlanToVehicle(this, planFile); +} + + //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- diff --git a/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h index 96c60f1ed..fa2a40e2c 100644 --- a/src/Vehicle/Vehicle.h +++ b/src/Vehicle/Vehicle.h @@ -316,6 +316,7 @@ public: Q_PROPERTY(QVariantList toolBarIndicators READ toolBarIndicators CONSTANT) Q_PROPERTY(QVariantList cameraList READ cameraList CONSTANT) Q_PROPERTY(QmlObjectListModel* adsbVehicles READ adsbVehicles CONSTANT) + Q_PROPERTY(bool initialPlanRequestComplete READ initialPlanRequestComplete NOTIFY initialPlanRequestCompleteChanged) /// true: Vehicle is flying, false: Vehicle is on ground Q_PROPERTY(bool flying READ flying NOTIFY flyingChanged) @@ -428,6 +429,7 @@ public: Q_INVOKABLE void clearMessages(); Q_INVOKABLE void triggerCamera(void); + Q_INVOKABLE void sendPlan(QString planFile); #if 0 // Temporarily removed, waiting for new command implementation @@ -698,7 +700,7 @@ public: /// @return: true: initial request is complete, false: initial request is still in progress; bool initialPlanRequestComplete(void) const { return _initialPlanRequestComplete; } - void forceInitialPlanRequestComplete(void) { _initialPlanRequestComplete = true; } + void forceInitialPlanRequestComplete(void); void _setFlying(bool flying); void _setLanding(bool landing); @@ -732,7 +734,7 @@ signals: void firmwareTypeChanged(void); void vehicleTypeChanged(void); void capabilitiesKnownChanged(bool capabilitiesKnown); - void initialPlanRequestCompleted(void); + void initialPlanRequestCompleteChanged(bool initialPlanRequestComplete); void capabilityBitsChanged(uint64_t capabilityBits); void messagesReceivedChanged (); diff --git a/src/qgcunittest/UnitTest.cc b/src/qgcunittest/UnitTest.cc index a970b5f1c..f2c9d2609 100644 --- a/src/qgcunittest/UnitTest.cc +++ b/src/qgcunittest/UnitTest.cc @@ -394,7 +394,7 @@ void UnitTest::_connectMockLink(MAV_AUTOPILOT autopilot) // Wait for plan request to complete if (!_vehicle->initialPlanRequestComplete()) { - QSignalSpy spyPlan(_vehicle, SIGNAL(initialPlanRequestCompleted())); + QSignalSpy spyPlan(_vehicle, SIGNAL(initialPlanRequestCompleteChanged(bool))); QCOMPARE(spyPlan.wait(10000), true); } } -- 2.22.0