summaryrefslogtreecommitdiff
path: root/src/positioning/qgeosatelliteinfo.cpp
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2019-05-10 19:55:33 +0200
committerpaolo <paolo.angelelli@qt.io>2019-08-15 10:08:13 +0200
commitf613eb3a6031d6d4f3e5ee230fab3056314fa9a4 (patch)
tree804e4d47b2eed988c1af0847f023b81dae4afc96 /src/positioning/qgeosatelliteinfo.cpp
parent3334c6f6d00255f6fd5690e4b9cb05416950fd4d (diff)
downloadqtlocation-f613eb3a6031d6d4f3e5ee230fab3056314fa9a4.tar.gz
Add Satellite support to serialnmea plugin
This adds a new class, QNmeaSatelliteInfoSource, locally to the plugin, that behaves similarly to QNmeaPositionInfoSource in the way of handling the IODevice and producing the updates. Change-Id: Id594152dd70514974ac79c7757ce6f0da4631191 Fixes: QTBUG-59274 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/positioning/qgeosatelliteinfo.cpp')
-rw-r--r--src/positioning/qgeosatelliteinfo.cpp61
1 files changed, 43 insertions, 18 deletions
diff --git a/src/positioning/qgeosatelliteinfo.cpp b/src/positioning/qgeosatelliteinfo.cpp
index e62bd164..91ebfa85 100644
--- a/src/positioning/qgeosatelliteinfo.cpp
+++ b/src/positioning/qgeosatelliteinfo.cpp
@@ -37,6 +37,7 @@
**
****************************************************************************/
#include "qgeosatelliteinfo.h"
+#include "qgeosatelliteinfo_p.h"
#include <QHash>
#include <QDebug>
@@ -44,16 +45,6 @@
QT_BEGIN_NAMESPACE
-class QGeoSatelliteInfoPrivate
-{
-public:
- int signal;
- int satId;
- QGeoSatelliteInfo::SatelliteSystem system;
- QHash<int, qreal> doubleAttribs;
-};
-
-
/*!
\class QGeoSatelliteInfo
\inmodule QtPositioning
@@ -103,6 +94,10 @@ QGeoSatelliteInfo::QGeoSatelliteInfo(const QGeoSatelliteInfo &other)
operator=(other);
}
+QGeoSatelliteInfo::QGeoSatelliteInfo(QGeoSatelliteInfoPrivate &dd) : d(&dd)
+{
+}
+
/*!
Destroys a satellite information object.
*/
@@ -119,10 +114,9 @@ QGeoSatelliteInfo &QGeoSatelliteInfo::operator=(const QGeoSatelliteInfo & other)
if (this == &other)
return *this;
- d->signal = other.d->signal;
- d->satId = other.d->satId;
- d->system = other.d->system;
- d->doubleAttribs = other.d->doubleAttribs;
+ delete d;
+ d = other.d->clone();
+
return *this;
}
@@ -132,10 +126,7 @@ QGeoSatelliteInfo &QGeoSatelliteInfo::operator=(const QGeoSatelliteInfo & other)
*/
bool QGeoSatelliteInfo::operator==(const QGeoSatelliteInfo &other) const
{
- return d->signal == other.d->signal
- && d->satId == other.d->satId
- && d->system == other.d->system
- && d->doubleAttribs == other.d->doubleAttribs;
+ return *d == *other.d;
}
/*!
@@ -309,6 +300,40 @@ QDataStream &operator>>(QDataStream &stream, QGeoSatelliteInfo &info)
info.d->system = (QGeoSatelliteInfo::SatelliteSystem)system;
return stream;
}
+
+QGeoSatelliteInfoPrivate::QGeoSatelliteInfoPrivate()
+{
+
+}
+
+QGeoSatelliteInfoPrivate::QGeoSatelliteInfoPrivate(const QGeoSatelliteInfoPrivate &other)
+{
+ signal = other.signal;
+ satId = other.satId;
+ system = other.system;
+ doubleAttribs = other.doubleAttribs;
+}
+
+QGeoSatelliteInfoPrivate::~QGeoSatelliteInfoPrivate() {}
+
+QGeoSatelliteInfoPrivate *QGeoSatelliteInfoPrivate::clone() const
+{
+ return new QGeoSatelliteInfoPrivate(*this);
+}
+
+bool QGeoSatelliteInfoPrivate::operator==(const QGeoSatelliteInfoPrivate &other) const
+{
+ return signal == other.signal
+ && satId == other.satId
+ && system == other.system
+ && doubleAttribs == other.doubleAttribs;
+}
+
+QGeoSatelliteInfoPrivate *QGeoSatelliteInfoPrivate::get(const QGeoSatelliteInfo &info)
+{
+ return info.d;
+}
+
#endif
QT_END_NAMESPACE