Conflict solved: mainwindow.cpp and calculate.cpp
[speedfreak] / Client / maemo5location.cpp
1 /*
2  * Maemo5Location
3  *
4  * @author     Toni Jussila <toni.jussila@fudeco.com>
5  * @copyright  (c) 2010 Speed Freak team
6  * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
7  */
8
9 //#ifdef Q_WS_MAEMO_5
10 #include "maemo5locationprivate.h"
11 #include "maemo5location.h"
12 #include <QDebug>
13
14 /**
15   * Default constructor of this class.
16   *
17   * @param QObject pointer to parent object. By default the value is NULL.
18   */
19 Maemo5Location::Maemo5Location(QObject* parent):QObject(parent)
20 {
21     qDebug() << "__Maemo5Location";
22     ptr = new Maemo5LocationPrivate(this);
23
24     connect(ptr, SIGNAL(agnss()), this, SIGNAL(agnss()));
25     connect(ptr, SIGNAL(awcp()), this, SIGNAL(awcp()));
26     connect(ptr, SIGNAL(locationUpdated()), this, SIGNAL(locationUpdated()));
27     connect(ptr, SIGNAL(gps_connected()), this, SIGNAL(gps_connected()));
28     connect(ptr, SIGNAL(gps_disconnected()), this, SIGNAL(gps_disconnected()));
29     connect(ptr, SIGNAL(gps_error(int)), this, SIGNAL(gps_error(int)));
30     connect(ptr, SIGNAL(gpsd_running()), this, SIGNAL(gpsd_running()));
31     connect(ptr, SIGNAL(gpsd_stopped()), this, SIGNAL(gpsd_stopped()));
32 }
33
34 /**
35   * Destructor of this class. Should be used to release all allocated resources.
36   */
37 Maemo5Location::~Maemo5Location()
38 {
39     qDebug() << "__~Maemo5Location";
40     if(ptr)
41         delete ptr;
42 }
43
44 /**
45   * Start polling gps.
46   */
47 void Maemo5Location::startPollingGPS()
48 {
49     qDebug() << "__Maemo5Location: startPollingGPS";
50     ptr->get_agnss();
51 }
52
53 /**
54   * Stop polling gps.
55   */
56 void Maemo5Location::stopPollingGPS()
57 {
58     qDebug() << "__Maemo5Location: stopPollingGPS";
59     ptr->stop();
60 }
61
62 /**
63   * Get number of satellites in use.
64   *
65   * @return int satellites in use
66   */
67 int Maemo5Location::getSatellitesInUse()
68 {
69     return ptr->get_satellites_in_use();
70 }
71
72 /**
73   * Get number of satellites in view.
74   *
75   * @return int satellites in view
76   */
77 int Maemo5Location::getSatellitesInView()
78 {
79     return ptr->get_satellites_in_view();
80 }
81
82 /**
83   * Get average signal strength of satellites which are in use.
84   *
85   * @return int signal strength
86   */
87 int Maemo5Location::getSignalStrength()
88 {
89     return ptr->get_signal_strength();
90 }
91
92 /**
93   * Get gps online.
94   *
95   * @return bool gps online
96   */
97 bool Maemo5Location::getGpsOnline()
98 {
99     return ptr->get_gps_online();
100 }
101
102 /**
103   * Get latitude.
104   *
105   * @return double latitude
106   */
107 double Maemo5Location::getLatitude()
108 {
109     return ptr->get_lat();
110 }
111
112 /**
113   * Get longitude.
114   *
115   * @return double longitude
116   */
117 double Maemo5Location::getLongitude()
118 {
119     return ptr->get_lon();
120 }
121
122 /**
123   * Get timestamp of the update in seconds.
124   *
125   * @return double time
126   */
127 double Maemo5Location::getTime()
128 {
129     return ptr->get_time();
130 }
131
132 /**
133   * Get time accuracy in seconds.
134   *
135   * @return double ept
136   */
137 double Maemo5Location::getEpt()
138 {
139     return ptr->get_ept();
140 }
141
142 /**
143   * Get horizontal position accuracy in cm.
144   *
145   * @return double eph
146   */
147 double Maemo5Location::getEph()
148 {
149     return ptr->get_eph();
150 }
151
152 /**
153   * Get fix altitude in meters.
154   *
155   * @return double altitude
156   */
157 double Maemo5Location::getAltitude()
158 {
159     return ptr->get_altitude();
160 }
161
162 /**
163   * Get altitude accuracy in meters.
164   *
165   * @return double epv
166   */
167 double Maemo5Location::getEpv()
168 {
169     return ptr->get_epv();
170 }
171
172 /**
173   * Get direction of motion in degrees(0-359).
174   *
175   * @return double track
176   */
177 double Maemo5Location::getTrack()
178 {
179     return ptr->get_track();
180 }
181
182 /**
183   * Get track accuracy in degrees.
184   *
185   * @return double epd
186   */
187 double Maemo5Location::getEpd()
188 {
189     return ptr->get_epd();
190 }
191
192 /**
193   * Get current speed in km/h.
194   *
195   * @return double speed
196   */
197 double Maemo5Location::getSpeed()
198 {
199     return ptr->get_speed();
200 }
201
202 /**
203   * Get speed accuracy in km/h.
204   *
205   * @return double eps
206   */
207 double Maemo5Location::getEps()
208 {
209     return ptr->get_eps();
210 }
211
212 /**
213   * Get current rate of climb in m/s.
214   *
215   * @return double climb
216   */
217 double Maemo5Location::getClimb()
218 {
219     return ptr->get_climb();
220 }
221
222 /**
223   * Get climb accuracy in m/s.
224   *
225   * @return double epc
226   */
227 double Maemo5Location::getEpc()
228 {
229     return ptr->get_epc();
230 }
231
232 /**
233   * Get distance between two points in kilometers.
234   *
235   * @param double latitude of first point
236   * @param double longitude of first point
237   * @param double latitude of second point
238   * @param double longitude of second point
239   * @return double distance
240   */
241 double Maemo5Location::distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f)
242 {
243     return ptr->distance_between_two_points(latitude_s, longitude_s, latitude_f, longitude_f);
244 }