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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Eckhart Wörner <ewoerner@kde.org>
0004 //
0005 
0006 #ifndef GPSDCONNECTION_H
0007 #define GPSDCONNECTION_H
0008 
0009 #include "PositionProviderPlugin.h"
0010 
0011 #include <QObject>
0012 #include <QTimer>
0013 
0014 #include <libgpsmm.h>
0015 
0016 namespace Marble
0017 {
0018 
0019 class GpsdConnection : public QObject
0020 {
0021     Q_OBJECT
0022 
0023  public:
0024     explicit GpsdConnection( QObject* parent = nullptr );
0025 
0026     ~GpsdConnection() override;
0027 
0028     void initialize();
0029 
0030     QString error() const;    
0031 
0032  Q_SIGNALS:
0033     void gpsdInfo( gps_data_t data );
0034 
0035     void statusChanged( PositionProviderStatus status ) const;    
0036 
0037 private:
0038     void open();
0039 
0040     gpsmm m_gpsd;
0041     QTimer m_timer;
0042     PositionProviderStatus m_status;
0043     QString m_error;
0044     const char* m_oldLocale;
0045     
0046  private Q_SLOTS:
0047     void update();
0048 };
0049 
0050 }
0051 
0052 #endif