diff --git a/src/ANT/ANTlocalController.cpp b/src/ANT/ANTlocalController.cpp index 3a50c4202..8644cb70f 100644 --- a/src/ANT/ANTlocalController.cpp +++ b/src/ANT/ANTlocalController.cpp @@ -22,6 +22,7 @@ #include "ANT.h" #include "ANTLogger.h" #include "RealtimeData.h" +#include "GarminServiceHelper.h" ANTlocalController::ANTlocalController(TrainSidebar *parent, DeviceConfiguration *dc) : RealtimeController(parent, dc) { @@ -64,6 +65,27 @@ ANTlocalController::setDevice(QString device) int ANTlocalController::start() { + // Before we do the low level device opening, check for an active Garmin Service + if (GarminServiceHelper::isServiceRunning()) + { + int dialogStatus = QMessageBox::warning(parent, tr("Found Garmin Express service"), + tr("The Garmin Express service is active on your computer.\n" + "This can block GoldenCheetah from accessing your ANT+ stick.\n\n" + "Do you want to temporarily disable the service?"), + QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); + + if (dialogStatus == QMessageBox::Ok) + { + if (!GarminServiceHelper::stopService()) + { + // we failed to stop the service, tell the user + QMessageBox::critical(parent, tr("Failed stopping Garmin Express service"), + tr("GoldenCheetah failed to stop the Garmin Express service.\n" + "It might be necessary to manually disable it.")); + } + } + } + logger->open(); myANTlocal->start(); myANTlocal->setup();