diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 587f8052c45e3572da7564d0a4280824382034dc..a3adf9bab238936a8b616dd1ddcda85f9e1fb264 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -104,8 +104,9 @@ QGCView { } Connections { - target: _missionController - onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady) + target: _missionController + onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady) + onResumeMissionUploadFail: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionUploadFail) } MessageDialog { diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml index c90f9bb079a786a2bbcebe5079517f1dd77db45a..46605805d9f1a6f350b7bbbaf13bf577e9ff1240 100644 --- a/src/FlightDisplay/GuidedActionsController.qml +++ b/src/FlightDisplay/GuidedActionsController.qml @@ -32,55 +32,58 @@ Item { property var actionList property var altitudeSlider - readonly property string emergencyStopTitle: qsTr("Emergency Stop") - readonly property string armTitle: qsTr("Arm") - readonly property string disarmTitle: qsTr("Disarm") - readonly property string rtlTitle: qsTr("RTL") - readonly property string takeoffTitle: qsTr("Takeoff") - readonly property string landTitle: qsTr("Land") - readonly property string startMissionTitle: qsTr("Start Mission") - readonly property string continueMissionTitle: qsTr("Continue Mission") - readonly property string resumeMissionTitle: qsTr("Resume Mission") - readonly property string pauseTitle: qsTr("Pause") - readonly property string changeAltTitle: qsTr("Change Altitude") - readonly property string orbitTitle: qsTr("Orbit") - readonly property string landAbortTitle: qsTr("Land Abort") - readonly property string setWaypointTitle: qsTr("Set Waypoint") - readonly property string gotoTitle: qsTr("Goto Location") + readonly property string emergencyStopTitle: qsTr("Emergency Stop") + readonly property string armTitle: qsTr("Arm") + readonly property string disarmTitle: qsTr("Disarm") + readonly property string rtlTitle: qsTr("RTL") + readonly property string takeoffTitle: qsTr("Takeoff") + readonly property string landTitle: qsTr("Land") + readonly property string startMissionTitle: qsTr("Start Mission") + readonly property string continueMissionTitle: qsTr("Continue Mission") + readonly property string resumeMissionTitle: qsTr("Resume Mission") + readonly property string resumeMissionUploadFailTitle: qsTr("Resume FAILED") + readonly property string pauseTitle: qsTr("Pause") + readonly property string changeAltTitle: qsTr("Change Altitude") + readonly property string orbitTitle: qsTr("Orbit") + readonly property string landAbortTitle: qsTr("Land Abort") + readonly property string setWaypointTitle: qsTr("Set Waypoint") + readonly property string gotoTitle: qsTr("Goto Location") - readonly property string armMessage: qsTr("Arm the vehicle.") - readonly property string disarmMessage: qsTr("Disarm the vehicle") - readonly property string emergencyStopMessage: qsTr("WARNING: This will stop all motors. If vehicle is currently in air it will crash.") - readonly property string takeoffMessage: qsTr("Takeoff from ground and hold position.") - readonly property string startMissionMessage: qsTr("Takeoff from ground and start the current mission.") - readonly property string continueMissionMessage: qsTr("Continue the mission from the current waypoint.") - property string resumeMissionMessage: qsTr("Resume the current mission. This will re-generate the mission from waypoint %1, takeoff and continue the mission.").arg(_resumeMissionIndex) - readonly property string resumeMissionReadyMessage: qsTr("Review the modified mission. Confirm if you want to takeoff and begin mission.") - readonly property string landMessage: qsTr("Land the vehicle at the current position.") - readonly property string rtlMessage: qsTr("Return to the home position of the vehicle.") - readonly property string changeAltMessage: qsTr("Change the altitude of the vehicle up or down.") - readonly property string gotoMessage: qsTr("Move the vehicle to the location clicked on the map.") - property string setWaypointMessage: qsTr("Adjust current waypoint to %1.").arg(_actionData) - readonly property string orbitMessage: qsTr("Orbit the vehicle around the current location.") - readonly property string landAbortMessage: qsTr("Abort the landing sequence.") - readonly property string pauseMessage: qsTr("Pause the vehicle at it's current position.") + readonly property string armMessage: qsTr("Arm the vehicle.") + readonly property string disarmMessage: qsTr("Disarm the vehicle") + readonly property string emergencyStopMessage: qsTr("WARNING: This will stop all motors. If vehicle is currently in air it will crash.") + readonly property string takeoffMessage: qsTr("Takeoff from ground and hold position.") + readonly property string startMissionMessage: qsTr("Takeoff from ground and start the current mission.") + readonly property string continueMissionMessage: qsTr("Continue the mission from the current waypoint.") + property string resumeMissionMessage: qsTr("Resume the current mission. This will re-generate the mission from waypoint %1, takeoff and continue the mission.").arg(_resumeMissionIndex) + property string resumeMissionUploadFailMessage: qsTr("Upload of resume mission failed. Confirm to retry upload") + readonly property string resumeMissionReadyMessage: qsTr("Review the modified mission. Confirm if you want to takeoff and begin mission.") + readonly property string landMessage: qsTr("Land the vehicle at the current position.") + readonly property string rtlMessage: qsTr("Return to the home position of the vehicle.") + readonly property string changeAltMessage: qsTr("Change the altitude of the vehicle up or down.") + readonly property string gotoMessage: qsTr("Move the vehicle to the location clicked on the map.") + property string setWaypointMessage: qsTr("Adjust current waypoint to %1.").arg(_actionData) + readonly property string orbitMessage: qsTr("Orbit the vehicle around the current location.") + readonly property string landAbortMessage: qsTr("Abort the landing sequence.") + readonly property string pauseMessage: qsTr("Pause the vehicle at it's current position.") - readonly property int actionRTL: 1 - readonly property int actionLand: 2 - readonly property int actionTakeoff: 3 - readonly property int actionArm: 4 - readonly property int actionDisarm: 5 - readonly property int actionEmergencyStop: 6 - readonly property int actionChangeAlt: 7 - readonly property int actionGoto: 8 - readonly property int actionSetWaypoint: 9 - readonly property int actionOrbit: 10 - readonly property int actionLandAbort: 11 - readonly property int actionStartMission: 12 - readonly property int actionContinueMission: 13 - readonly property int actionResumeMission: 14 - readonly property int actionResumeMissionReady: 15 - readonly property int actionPause: 16 + readonly property int actionRTL: 1 + readonly property int actionLand: 2 + readonly property int actionTakeoff: 3 + readonly property int actionArm: 4 + readonly property int actionDisarm: 5 + readonly property int actionEmergencyStop: 6 + readonly property int actionChangeAlt: 7 + readonly property int actionGoto: 8 + readonly property int actionSetWaypoint: 9 + readonly property int actionOrbit: 10 + readonly property int actionLandAbort: 11 + readonly property int actionStartMission: 12 + readonly property int actionContinueMission: 13 + readonly property int actionResumeMission: 14 + readonly property int actionResumeMissionReady: 15 + readonly property int actionResumeMissionUploadFail: 16 + readonly property int actionPause: 17 property bool showEmergenyStop: !_hideEmergenyStop && _activeVehicle && _vehicleArmed && _vehicleFlying property bool showArm: _activeVehicle && !_vehicleArmed @@ -205,6 +208,11 @@ Item { confirmDialog.message = resumeMissionMessage confirmDialog.hideTrigger = Qt.binding(function() { return !showResumeMission }) break; + case actionResumeMissionUploadFail: + confirmDialog.title = resumeMissionUploadFailTitle + confirmDialog.message = resumeMissionUploadFailMessage + confirmDialog.hideTrigger = Qt.binding(function() { return !showResumeMission }) + break; case actionResumeMissionReady: confirmDialog.title = resumeMissionTitle confirmDialog.message = resumeMissionReadyMessage @@ -271,6 +279,7 @@ Item { _activeVehicle.guidedModeTakeoff() break case actionResumeMission: + case actionResumeMissionUploadFail: missionController.resumeMission(missionController.resumeMissionIndex) break case actionResumeMissionReady: diff --git a/src/MissionManager/MissionController.cc b/src/MissionManager/MissionController.cc index d5d9c58ae7cea289c4d265197bfadeac9c33ea18..42c49151912c93b48165cdbee237eac74608509f 100644 --- a/src/MissionManager/MissionController.cc +++ b/src/MissionManager/MissionController.cc @@ -1476,6 +1476,7 @@ void MissionController::managerVehicleChanged(Vehicle* managerVehicle) connect(_missionManager, &MissionManager::currentIndexChanged, this, &MissionController::_currentMissionIndexChanged); connect(_missionManager, &MissionManager::lastCurrentIndexChanged, this, &MissionController::resumeMissionIndexChanged); connect(_missionManager, &MissionManager::resumeMissionReady, this, &MissionController::resumeMissionReady); + connect(_missionManager, &MissionManager::resumeMissionUploadFail, this, &MissionController::resumeMissionUploadFail); connect(_managerVehicle, &Vehicle::homePositionChanged, this, &MissionController::_managerVehicleHomePositionChanged); connect(_managerVehicle, &Vehicle::defaultCruiseSpeedChanged, this, &MissionController::_recalcMissionFlightStatus); connect(_managerVehicle, &Vehicle::defaultHoverSpeedChanged, this, &MissionController::_recalcMissionFlightStatus); diff --git a/src/MissionManager/MissionController.h b/src/MissionManager/MissionController.h index b5d2e1020d7d12499fd7f7777f95ed9848a0b4a6..daba4ffb6b0218ae4dc4e154a8d644c6c67f3ac0 100644 --- a/src/MissionManager/MissionController.h +++ b/src/MissionManager/MissionController.h @@ -160,6 +160,7 @@ signals: void complexMissionItemNamesChanged(void); void resumeMissionIndexChanged(void); void resumeMissionReady(void); + void resumeMissionUploadFail(void); void batteryChangePointChanged(int batteryChangePoint); void batteriesRequiredChanged(int batteriesRequired); void plannedHomePositionChanged(QGeoCoordinate plannedHomePosition); diff --git a/src/MissionManager/MissionManager.cc b/src/MissionManager/MissionManager.cc index 66376fbb1581c1d69b5193e09e45ec40987b6965..509ab96f225a9fade7ca77b598aeabab26bce6e5 100644 --- a/src/MissionManager/MissionManager.cc +++ b/src/MissionManager/MissionManager.cc @@ -55,6 +55,7 @@ void MissionManager::_writeMissionItemsWorker(void) qCDebug(MissionManagerLog) << "writeMissionItems count:" << _writeMissionItems.count(); // Prime write list + _itemIndicesToWrite.clear(); for (int i=0; i<_writeMissionItems.count(); i++) { _itemIndicesToWrite << i; } @@ -63,11 +64,6 @@ void MissionManager::_writeMissionItemsWorker(void) _retryCount = 0; emit inProgressChanged(true); _writeMissionCount(); - - _currentMissionIndex = -1; - _lastCurrentIndex = -1; - emit currentIndexChanged(-1); - emit lastCurrentIndexChanged(-1); } @@ -874,7 +870,11 @@ void MissionManager::_finishTransaction(bool success) break; case TransactionWrite: if (success) { - // Write succeeded, update internal list to be current + // Write succeeded, update internal list to be current + _currentMissionIndex = -1; + _lastCurrentIndex = -1; + emit currentIndexChanged(-1); + emit lastCurrentIndexChanged(-1); _clearAndDeleteMissionItems(); for (int i=0; i<_writeMissionItems.count(); i++) { _missionItems.append(_writeMissionItems[i]); @@ -895,7 +895,11 @@ void MissionManager::_finishTransaction(bool success) if (_resumeMission) { _resumeMission = false; - emit resumeMissionReady(); + if (success) { + emit resumeMissionReady(); + } else { + emit resumeMissionUploadFail(); + } } } diff --git a/src/MissionManager/MissionManager.h b/src/MissionManager/MissionManager.h index 5b258d1b12a8ec5e72a6d6bfb8fc4389b530c5a0..6c6a792a7c7433bbe2daf525d1c447d28734a4ed 100644 --- a/src/MissionManager/MissionManager.h +++ b/src/MissionManager/MissionManager.h @@ -88,6 +88,7 @@ signals: void currentIndexChanged(int currentIndex); void lastCurrentIndexChanged(int lastCurrentIndex); void resumeMissionReady(void); + void resumeMissionUploadFail(void); void progressPct(double progressPercentPct); void removeAllComplete (bool error); void sendComplete (bool error); diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 1991cddee765d9611b5858a6d24ffbf793f40a3c..8c7813459c91f5619fe0968336cecfa1ef51d5a1 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -671,3 +671,8 @@ void QGCApplication::qmlAttemptWindowClose(void) { QMetaObject::invokeMethod(_rootQmlObject(), "attemptWindowClose"); } + +bool QGCApplication::isInternetAvailable() +{ + return getQGCMapEngine()->isInternetActive(); +} diff --git a/src/QGCApplication.h b/src/QGCApplication.h index 4d264d0f7ffe2e2ad35cd44ac03bbae0ae9fecb5..fb4ec5d94e5f893adfbe6ce75ad7d73a1c0ddc23 100644 --- a/src/QGCApplication.h +++ b/src/QGCApplication.h @@ -92,6 +92,9 @@ public: /// Do we have Bluetooth Support? bool isBluetoothAvailable() { return _bluetoothAvailable; } + /// Is Internet available? + bool isInternetAvailable(); + public slots: /// You can connect to this slot to show an information message box from a different thread. void informationMessageBoxOnMainThread(const QString& title, const QString& msg); diff --git a/src/QtLocationPlugin/QGCTileCacheWorker.cpp b/src/QtLocationPlugin/QGCTileCacheWorker.cpp index df5118bac192b68bafd650a05c398a786addbd86..eca022cbe848d923d1ed5a1e2ca9a962cad391de 100644 --- a/src/QtLocationPlugin/QGCTileCacheWorker.cpp +++ b/src/QtLocationPlugin/QGCTileCacheWorker.cpp @@ -1056,7 +1056,7 @@ void QGCCacheWorker::_testInternet() { QTcpSocket socket; - socket.connectToHost("8.8.8.8", 53); + socket.connectToHost("www.github.com", 80); if (socket.waitForConnected(2500)) { qCDebug(QGCTileCacheLog) << "Yes Internet Access"; emit internetStatus(true);