19#include "moc_qgsgpsdconnection.cpp"
28 QTcpSocket *socket = qobject_cast< QTcpSocket * >(
mSource.get() );
30 QObject::connect( socket, SIGNAL( connected() ),
this, SLOT( connected() ) );
31 QObject::connect( socket, SIGNAL( error( QAbstractSocket::SocketError ) ),
this, SLOT( error( QAbstractSocket::SocketError ) ) );
32 socket->connectToHost( host, port );
35void QgsGpsdConnection::connected()
38 QTcpSocket *socket = qobject_cast< QTcpSocket * >(
mSource.get() );
39 socket->write( QStringLiteral(
"?WATCH={\"enable\":true,\"nmea\":true,\"raw\":true%1};" ).arg( mDevice.isEmpty() ? mDevice : QStringLiteral(
",\"device\":%1" ).arg( mDevice ) ).toUtf8() );
42void QgsGpsdConnection::error( QAbstractSocket::SocketError socketError )
45 QTcpSocket *socket = qobject_cast< QTcpSocket * >(
mSource.get() );
46 QgsDebugError( QStringLiteral(
"error: %1 %2" ).arg( socketError ).arg( socket->errorString() ) );
48 Q_UNUSED( socketError )
std::unique_ptr< QIODevice > mSource
Data source (e.g. serial device, socket, file,...)
QgsGpsdConnection(const QString &host, qint16 port, const QString &device)
Evaluates NMEA sentences coming from a GPS device.
#define QgsDebugMsgLevel(str, level)
#define QgsDebugError(str)