Added comments and debug prints.
[situare] / src / gps / geopositioninfo.cpp
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Jussi Laitinen - jussi.laitinen@ixonos.com
6
7    Situare is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    version 2 as published by the Free Software Foundation.
10
11    Situare is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with Situare; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19    USA.
20 */
21
22 #include <QDateTime>
23 #include <QDebug>
24
25 #include "geopositioninfo.h"
26 #include "gpscommon.h"
27 #include "geocoordinate.h"
28
29 GeoPositionInfo::GeoPositionInfo()
30     : m_timestamp(QDateTime()),
31       m_coordinate(GeoCoordinate()),
32       m_horizontalAccuracy(GPS_ACCURACY_UNDEFINED),
33       m_isAccurate(false)
34 {
35     qDebug() << __PRETTY_FUNCTION__;
36 }
37
38 QDateTime GeoPositionInfo::timestamp() const
39 {
40     qDebug() << __PRETTY_FUNCTION__;
41
42     return m_timestamp;
43 }
44
45 void GeoPositionInfo::setTimestamp(qreal time)
46 {
47     qDebug() << __PRETTY_FUNCTION__;
48
49     m_timestamp = QDateTime::fromTime_t(time);
50 }
51
52 void GeoPositionInfo::setCoordinate(const GeoCoordinate &coordinate)
53 {
54     qDebug() << __PRETTY_FUNCTION__;
55
56     m_coordinate = coordinate;
57 }
58
59 GeoCoordinate GeoPositionInfo::coordinate() const
60 {
61     qDebug() << __PRETTY_FUNCTION__;
62
63     return m_coordinate;
64 }
65
66 bool GeoPositionInfo::isValid()
67 {
68     qDebug() << __PRETTY_FUNCTION__;
69
70     return m_coordinate.isValid();
71 }
72
73 void GeoPositionInfo::setAccuracy(bool accurate, qreal accuracy)
74 {
75     qDebug() << __PRETTY_FUNCTION__;
76
77     if (accuracy < 0)
78         m_horizontalAccuracy = GPS_ACCURACY_UNDEFINED;
79     else
80         m_horizontalAccuracy = accuracy;
81
82     m_isAccurate = accurate;
83 }
84
85 qreal GeoPositionInfo::accuracy() const
86 {
87     qDebug() << __PRETTY_FUNCTION__;
88
89     return m_horizontalAccuracy;
90 }
91
92 bool GeoPositionInfo::isAccurate() const
93 {
94     qDebug() << __PRETTY_FUNCTION__;
95
96     return m_isAccurate;
97 }