File indexing completed on 2024-04-28 03:50:08

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Eckhart Wörner <ewoerner@kde.org>
0004 //
0005 
0006 #include "GpsdThread.h"
0007 
0008 #include <QMetaType>
0009 
0010 #include "GpsdConnection.h"
0011 
0012 namespace Marble
0013 {
0014 
0015 GpsdThread::GpsdThread() : m_connection( nullptr )
0016 {
0017     // nothing to do
0018 }
0019 
0020 GpsdThread::~GpsdThread()
0021 {
0022     delete m_connection;
0023 }
0024 
0025 void GpsdThread::run()
0026 {
0027     qRegisterMetaType<gps_data_t>( "gps_data_t" );
0028     qRegisterMetaType<PositionProviderStatus>("PositionProviderStatus");
0029     m_connection = new GpsdConnection;
0030     connect( m_connection, SIGNAL(statusChanged(PositionProviderStatus)),
0031              this, SIGNAL(statusChanged(PositionProviderStatus)) );
0032     connect( m_connection, SIGNAL(gpsdInfo(gps_data_t)),
0033              this, SIGNAL(gpsdInfo(gps_data_t)) );
0034     m_connection->initialize();
0035     exec();
0036 }
0037 
0038 QString GpsdThread::error() const
0039 {
0040     return m_connection->error();
0041 }
0042 
0043 } // namespace Marble
0044 
0045 #include "moc_GpsdThread.cpp"