46 QList< QPair<QString, QString> > devs;
49#if defined(QT_POSITIONING_LIB)
50 devs << QPair<QString, QString>( QStringLiteral(
"internalGPS" ), tr(
"internal GPS" ) );
54 devs << QPair<QString, QString>( QStringLiteral(
"localhost:2947:" ), tr(
"local gpsd" ) );
57#if defined( HAVE_QTSERIALPORT )
58 for (
const QSerialPortInfo &p : QSerialPortInfo::availablePorts() )
60 devs << QPair<QString, QString>( p.portName(), tr(
"%1: %2" ).arg( p.portName(), p.description() ) );
92 if ( mBaudIndex == mBaudList.size() )
98 if ( mPortIndex == mPortList.size() )
105 if ( mPortList.at( mPortIndex ).first.contains(
':' ) )
107 mBaudIndex = mBaudList.size() - 1;
109 QStringList gpsParams = mPortList.at( mPortIndex ).first.split(
':' );
111 Q_ASSERT( gpsParams.size() >= 3 );
113 mConn = std::make_unique< QgsGpsdConnection >( gpsParams[0], gpsParams[1].toShort(), gpsParams[2] );
115 else if ( mPortList.at( mPortIndex ).first.contains( QLatin1String(
"internalGPS" ) ) )
117#if defined(QT_POSITIONING_LIB)
118 mConn = std::make_unique< QgsQtLocationConnection >();
120 qWarning(
"QT_POSITIONING_LIB not found and mPortList matches internalGPS, this should never happen" );
125#if defined( HAVE_QTSERIALPORT )
126 std::unique_ptr< QSerialPort > serial = std::make_unique< QSerialPort >( mPortList.at( mPortIndex ).first );
128 serial->setBaudRate( mBaudList[ mBaudIndex ] );
130 serial->setFlowControl( QgsGpsDetector::settingsGpsFlowControl->value() );
131 serial->setParity( QgsGpsDetector::settingsGpsParity->value() );
132 serial->setDataBits( QgsGpsDetector::settingsGpsDataBits->value() );
133 serial->setStopBits( QgsGpsDetector::settingsGpsStopBits->value() );
135 if ( serial->open( QIODevice::ReadOnly ) )
137 mConn = std::make_unique< QgsNmeaConnection >( serial.release() );
140 qWarning(
"QT5SERIALPORT not found and mPortList matches serial port, this should never happen" );
A template class for enum and flag settings entry.