27 QTcpSocket *socket = qobject_cast< QTcpSocket * >(
mSource );
29 QObject::connect( socket, SIGNAL( connected() ),
this, SLOT( connected() ) );
30 QObject::connect( socket, SIGNAL( error( QAbstractSocket::SocketError ) ),
this, SLOT( error( QAbstractSocket::SocketError ) ) );
31 socket->connectToHost( host, port );
40 void QgsGpsdConnection::connected()
43 QTcpSocket *socket = qobject_cast< QTcpSocket * >(
mSource );
44 socket->write( QString(
"?WATCH={\"enable\":true,\"nmea\":true,\"raw\":true%1};" ).arg( mDevice.isEmpty() ? mDevice : QString(
",\"device\":%1" ).arg( mDevice ) ).toUtf8() );
47 void QgsGpsdConnection::error( QAbstractSocket::SocketError socketError )
50 QTcpSocket *socket = qobject_cast< QTcpSocket * >(
mSource );
51 QgsDebugMsg( QString(
"error: %1 %2" ).arg( socketError ).arg( socket->errorString() ) );
53 Q_UNUSED( socketError );