Commit b730b4b7 authored by DonLakeFlyer's avatar DonLakeFlyer
Browse files

More work on vehicle connect state machine(s)
parent e5c86ca7
...@@ -60,3 +60,23 @@ bool QGCMAVLink::isVTOL(MAV_TYPE mavType) ...@@ -60,3 +60,23 @@ bool QGCMAVLink::isVTOL(MAV_TYPE mavType)
return false; return false;
} }
} }
QString QGCMAVLink::mavResultToString(MAV_RESULT result)
{
switch (result) {
case MAV_RESULT_ACCEPTED:
return QStringLiteral("MAV_RESULT_ACCEPTED");
case MAV_RESULT_TEMPORARILY_REJECTED:
return QStringLiteral("MAV_RESULT_TEMPORARILY_REJECTED");
case MAV_RESULT_DENIED:
return QStringLiteral("MAV_RESULT_DENIED");
case MAV_RESULT_UNSUPPORTED:
return QStringLiteral("MAV_RESULT_UNSUPPORTED");
case MAV_RESULT_FAILED:
return QStringLiteral("MAV_RESULT_FAILED");
case MAV_RESULT_IN_PROGRESS:
return QStringLiteral("MAV_RESULT_IN_PROGRESS");
default:
return QStringLiteral("MAV_RESULT unknown %1").arg(result);
}
}
...@@ -7,15 +7,10 @@ ...@@ -7,15 +7,10 @@
* *
****************************************************************************/ ****************************************************************************/
/**
* @file
* @brief MAVLink header file for QGroundControl
* @author Lorenz Meier <pixhawk@switched.com>
*/
#pragma once #pragma once
#include <QString>
#define MAVLINK_USE_MESSAGE_INFO #define MAVLINK_USE_MESSAGE_INFO
#define MAVLINK_EXTERNAL_RX_STATUS // Single m_mavlink_status instance is in QGCApplication.cc #define MAVLINK_EXTERNAL_RX_STATUS // Single m_mavlink_status instance is in QGCApplication.cc
#include <stddef.h> // Hack workaround for Mav 2.0 header problem with respect to offsetof usage #include <stddef.h> // Hack workaround for Mav 2.0 header problem with respect to offsetof usage
...@@ -47,11 +42,12 @@ extern mavlink_status_t m_mavlink_status[MAVLINK_COMM_NUM_BUFFERS]; ...@@ -47,11 +42,12 @@ extern mavlink_status_t m_mavlink_status[MAVLINK_COMM_NUM_BUFFERS];
class QGCMAVLink { class QGCMAVLink {
public: public:
static bool isFixedWing(MAV_TYPE mavType); static bool isFixedWing (MAV_TYPE mavType);
static bool isRover(MAV_TYPE mavType); static bool isRover (MAV_TYPE mavType);
static bool isSub(MAV_TYPE mavType); static bool isSub (MAV_TYPE mavType);
static bool isMultiRotor(MAV_TYPE mavType); static bool isMultiRotor (MAV_TYPE mavType);
static bool isVTOL(MAV_TYPE mavType); static bool isVTOL (MAV_TYPE mavType);
static QString mavResultToString (MAV_RESULT result);
}; };
...@@ -389,21 +389,25 @@ void UnitTest::_connectMockLink(MAV_AUTOPILOT autopilot) ...@@ -389,21 +389,25 @@ void UnitTest::_connectMockLink(MAV_AUTOPILOT autopilot)
case MAV_AUTOPILOT_GENERIC: case MAV_AUTOPILOT_GENERIC:
_mockLink = MockLink::startGenericMockLink(false); _mockLink = MockLink::startGenericMockLink(false);
break; break;
case MAV_AUTOPILOT_INVALID:
_mockLink = MockLink::startNoInitialConnectMockLink(false);
break;
default: default:
qWarning() << "Type not supported"; qWarning() << "Type not supported";
break; break;
} }
// Wait for the Vehicle to get created // Wait for the Vehicle to get created
QSignalSpy spyVehicle(qgcApp()->toolbox()->multiVehicleManager(), SIGNAL(parameterReadyVehicleAvailableChanged(bool))); QSignalSpy spyVehicle(qgcApp()->toolbox()->multiVehicleManager(), &MultiVehicleManager::activeVehicleChanged);
QCOMPARE(spyVehicle.wait(10000), true); QCOMPARE(spyVehicle.wait(10000), true);
QVERIFY(qgcApp()->toolbox()->multiVehicleManager()->parameterReadyVehicleAvailable());
_vehicle = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle(); _vehicle = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle();
QVERIFY(_vehicle); QVERIFY(_vehicle);
// Wait for initial connect sequence to complete if (autopilot != MAV_AUTOPILOT_INVALID) {
QSignalSpy spyPlan(_vehicle, SIGNAL(initialConnectComplete())); // Wait for initial connect sequence to complete
QCOMPARE(spyPlan.wait(10000), true); QSignalSpy spyPlan(_vehicle, &Vehicle::initialConnectComplete);
QCOMPARE(spyPlan.wait(30000), true);
}
} }
void UnitTest::_disconnectMockLink(void) void UnitTest::_disconnectMockLink(void)
......
...@@ -120,6 +120,7 @@ protected slots: ...@@ -120,6 +120,7 @@ protected slots:
protected: protected:
void _connectMockLink(MAV_AUTOPILOT autopilot = MAV_AUTOPILOT_PX4); void _connectMockLink(MAV_AUTOPILOT autopilot = MAV_AUTOPILOT_PX4);
void _connectMockLinkNoInitialConnectSequence(void) { _connectMockLink(MAV_AUTOPILOT_INVALID); }
void _disconnectMockLink(void); void _disconnectMockLink(void);
void _createMainWindow(void); void _createMainWindow(void);
void _closeMainWindow(bool cancelExpected = false); void _closeMainWindow(bool cancelExpected = false);
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
#include "ParameterManagerTest.h" #include "ParameterManagerTest.h"
#include "MissionCommandTreeTest.h" #include "MissionCommandTreeTest.h"
//#include "LogDownloadTest.h" //#include "LogDownloadTest.h"
#include "SendMavCommandTest.h" #include "SendMavCommandWithSignallingTest.h"
#include "SendMavCommandWithHandlerTest.h"
#include "VisualMissionItemTest.h" #include "VisualMissionItemTest.h"
#include "CameraSectionTest.h" #include "CameraSectionTest.h"
#include "SpeedSectionTest.h" #include "SpeedSectionTest.h"
...@@ -44,6 +45,7 @@ ...@@ -44,6 +45,7 @@
#include "TransectStyleComplexItemTest.h" #include "TransectStyleComplexItemTest.h"
#include "CameraCalcTest.h" #include "CameraCalcTest.h"
#include "FWLandingPatternTest.h" #include "FWLandingPatternTest.h"
#include "RequestMessageTest.h"
UT_REGISTER_TEST(FactSystemTestGeneric) UT_REGISTER_TEST(FactSystemTestGeneric)
UT_REGISTER_TEST(FactSystemTestPX4) UT_REGISTER_TEST(FactSystemTestPX4)
...@@ -51,6 +53,9 @@ UT_REGISTER_TEST(FactSystemTestPX4) ...@@ -51,6 +53,9 @@ UT_REGISTER_TEST(FactSystemTestPX4)
UT_REGISTER_TEST(GeoTest) UT_REGISTER_TEST(GeoTest)
UT_REGISTER_TEST(LinkManagerTest) UT_REGISTER_TEST(LinkManagerTest)
//UT_REGISTER_TEST(MessageBoxTest) //UT_REGISTER_TEST(MessageBoxTest)
UT_REGISTER_TEST(SendMavCommandWithSignallingTest)
UT_REGISTER_TEST(SendMavCommandWithHandlerTest)
UT_REGISTER_TEST(RequestMessageTest)
UT_REGISTER_TEST(MissionItemTest) UT_REGISTER_TEST(MissionItemTest)
UT_REGISTER_TEST(SimpleMissionItemTest) UT_REGISTER_TEST(SimpleMissionItemTest)
UT_REGISTER_TEST(MissionControllerTest) UT_REGISTER_TEST(MissionControllerTest)
...@@ -61,7 +66,6 @@ UT_REGISTER_TEST(TCPLinkTest) ...@@ -61,7 +66,6 @@ UT_REGISTER_TEST(TCPLinkTest)
UT_REGISTER_TEST(ParameterManagerTest) UT_REGISTER_TEST(ParameterManagerTest)
UT_REGISTER_TEST(MissionCommandTreeTest) UT_REGISTER_TEST(MissionCommandTreeTest)
//UT_REGISTER_TEST(LogDownloadTest) //UT_REGISTER_TEST(LogDownloadTest)
UT_REGISTER_TEST(SendMavCommandTest)
UT_REGISTER_TEST(SurveyComplexItemTest) UT_REGISTER_TEST(SurveyComplexItemTest)
UT_REGISTER_TEST(CameraSectionTest) UT_REGISTER_TEST(CameraSectionTest)
UT_REGISTER_TEST(SpeedSectionTest) UT_REGISTER_TEST(SpeedSectionTest)
......
Supports Markdown
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