Stellarium  0.90.0
StelLocationMgr_p.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 Fabien Chereau
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 
19 #ifndef _STELLOCATIONMGR_P_HPP_
20 #define _STELLOCATIONMGR_P_HPP_
21 
25 
26 #include "StelLocationMgr.hpp"
27 
28 #ifdef ENABLE_GPS
29 
30 class GPSLookupHelper : public QObject
31 {
32  Q_OBJECT
33 protected:
34  GPSLookupHelper(QObject* parent) : QObject(parent)
35  {
36  }
37 public:
39  virtual bool isReady() = 0;
43  virtual void query() = 0;
44 signals:
47  void queryFinished(const StelLocation& loc);
49  void queryError(const QString& msg);
50 };
51 
52 #ifdef ENABLE_LIBGPS
53 #include <libgpsmm.h>
54 
55 class LibGPSLookupHelper : public GPSLookupHelper
56 {
57  Q_OBJECT
58 public:
59  LibGPSLookupHelper(QObject * parent);
60  ~LibGPSLookupHelper();
61 
62  virtual bool isReady() Q_DECL_OVERRIDE;
63  virtual void query() Q_DECL_OVERRIDE;
64 private:
65  bool ready;
66  gpsmm* gps_rec;
67 };
68 #endif //ENABLE_LIBGPS
69 
70 #include <QNmeaPositionInfoSource>
71 #include <QSerialPort>
72 #include <QSerialPortInfo>
73 class NMEALookupHelper : public GPSLookupHelper
74 {
75  Q_OBJECT
76 public:
77  NMEALookupHelper(QObject* parent);
78  virtual bool isReady() Q_DECL_OVERRIDE
79  {
80  return nmea;
81  }
82 
83  virtual void query() Q_DECL_OVERRIDE;
84 private slots:
85  void nmeaError(QGeoPositionInfoSource::Error error);
86  void nmeaUpdated(const QGeoPositionInfo &update);
87  void nmeaTimeout();
88 private:
89  QSerialPort* serial;
90  QNmeaPositionInfoSource* nmea;
91 };
92 
93 #endif //ENABLE_GPS
94 
95 #endif // _STELLOCATIONMGR_P_HPP_
Store the informations for a location on a planet.