1 /***************************************************************************
2                           QgsQtLocationConnection.h  -  description
3                           -------------------
4     begin                : December 7th, 2011
5     copyright            : (C) 2011 by Marco Bernasocchi, Bernawebdesign.ch
6     email                : marco at bernawebdesign dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef QGSQTLOCATIONCONNECTION_H
19 #define QGSQTLOCATIONCONNECTION_H
20 
21 #include "qgis_core.h"
22 #include "qgis_sip.h"
23 #include "qgsgpsconnection.h"
24 
25 #include <QtCore/QPointer>
26 
27 #include <QtPositioning/QGeoPositionInfoSource>
28 #include <QtPositioning/QGeoSatelliteInfo>
29 #include <QtPositioning/QGeoSatelliteInfoSource>
30 
31 /**
32  * \ingroup core
33  * \class QgsQtLocationConnection
34  * \brief A GPS connection subclass based on the Qt Location libraries.
35  * \note may not be available in Python bindings on all platforms
36 */
37 class CORE_EXPORT QgsQtLocationConnection: public QgsGpsConnection
38 {
39     Q_OBJECT
40   public:
41     QgsQtLocationConnection();
42 
43   protected slots:
44     //! Needed to make QtLocation detected
45     void broadcastConnectionAvailable();
46 
47     //! Parse available data source content
48     void parseData() override;
49 
50     /**
51      * Called when the position updated.
52       * \note not available in Python bindings
53       */
54     void positionUpdated( const QGeoPositionInfo &info ) SIP_SKIP;
55 
56     /**
57      * Called when the number of satellites in view is updated.
58       * \note not available in Python bindings on android
59       */
60     void satellitesInViewUpdated( const QList<QGeoSatelliteInfo> &satellites );
61 
62     /**
63      * Called when the number of satellites in use is updated.
64       * \note not available in Python bindings on android
65       */
66     void satellitesInUseUpdated( const QList<QGeoSatelliteInfo> &satellites );
67 
68   private:
69     void startGPS();
70     void startSatelliteMonitor();
71     QString mDevice;
72     QGeoPositionInfo mInfo;
73     QPointer<QGeoPositionInfoSource> locationDataSource;
74     QPointer<QGeoSatelliteInfoSource> satelliteInfoSource;
75 
76 };
77 
78 #endif // QGSQTLOCATIONCONNECTION_H
79