Skip to content

Commit

Permalink
Update qgsappgpsconnection.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
bettellam committed Dec 8, 2022
1 parent a5e14b4 commit 8ba3036
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/gps/qgsappgpsconnection.cpp
Expand Up @@ -148,6 +148,7 @@ void QgsAppGpsConnection::connectGps()
emit statusChanged( Qgis::GpsConnectionStatus::Connecting );
emit fixStatusChanged( Qgis::GpsFixStatus::NoData );

QgisApp::instance()->statusBarIface()->clearMessage();
showStatusBarMessage( tr( "Connecting to GPS device %1…" ).arg( port ) );

QgsGpsDetector *detector = new QgsGpsDetector( port );
Expand All @@ -168,6 +169,7 @@ void QgsAppGpsConnection::disconnectGps()
emit statusChanged( Qgis::GpsConnectionStatus::Disconnected );
emit fixStatusChanged( Qgis::GpsFixStatus::NoData );

QgisApp::instance()->statusBarIface()->clearMessage();
showStatusBarMessage( tr( "Disconnected from GPS device." ) );

QgsApplication::gpsConnectionRegistry()->unregisterConnection( oldConnection.get() );
Expand All @@ -176,12 +178,18 @@ void QgsAppGpsConnection::disconnectGps()

void QgsAppGpsConnection::onTimeOut()
{
std::unique_ptr< QgsGpsConnection > oldConnection( mConnection );
mConnection = nullptr;
emit connectionTimedOut();

emit disconnected();
emit statusChanged( Qgis::GpsConnectionStatus::Disconnected );
emit fixStatusChanged( Qgis::GpsFixStatus::NoData );
emit connectionTimedOut();

QgisApp::instance()->statusBarIface()->clearMessage();
showGpsConnectFailureWarning( tr( "Failed to connect to GPS device." ) );
showGpsConnectFailureWarning( tr( "TIMEOUT - Failed to connect to GPS device." ) );

QgsApplication::gpsConnectionRegistry()->unregisterConnection( oldConnection.get() );
}

void QgsAppGpsConnection::onConnected( QgsGpsConnection *conn )
Expand Down

0 comments on commit 8ba3036

Please sign in to comment.