Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgeosatelliteinfo.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#include "qgeosatelliteinfo.h"
4#include "private/qgeosatelliteinfo_p.h"
5
6#include <QHash>
7#include <QDebug>
8#include <QDataStream>
9
11
13
14
60{
61 d->signal = -1;
62 d->satId = -1;
64}
65
74
78
96
98
99
103{
104 if (this == &other)
105 return *this;
106
107 d = other.d;
108 return *this;
109}
110
140{
141 d.detach();
142 d->system = system;
143}
144
157
173{
174 d.detach();
175 d->satId = satId;
176}
177
205{
206 return d->satId;
207}
208
213{
214 d.detach();
216}
217
222{
223 return d->signal;
224}
225
234
243{
244 if (d->doubleAttribs.contains(int(attribute)))
245 return d->doubleAttribs[int(attribute)];
246 return -1;
247}
248
257
265
270{
271 if (d)
272 d.detach();
273 else
275}
276
277bool QGeoSatelliteInfo::equals(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)
278{
279 return *lhs.d == *rhs.d;
280}
281
282#ifndef QT_NO_DEBUG_STREAM
283QDebug QGeoSatelliteInfo::debugStreaming(QDebug dbg, const QGeoSatelliteInfo &info)
284{
285 QDebugStateSaver saver(dbg);
286 dbg.nospace() << "QGeoSatelliteInfo(system=" << info.d->system;
287 dbg << ", satId=" << info.d->satId;
288 dbg << ", signal-strength=" << info.d->signal;
289
290
291 QList<int> attribs = info.d->doubleAttribs.keys();
292 for (int i = 0; i < attribs.size(); ++i) {
293 dbg << ", ";
294 switch (attribs[i]) {
296 dbg << "Elevation=";
297 break;
299 dbg << "Azimuth=";
300 break;
301 }
302 dbg << info.d->doubleAttribs[attribs[i]];
303 }
304 dbg << ')';
305 return dbg;
306}
307#endif // QT_NO_DEBUG_STREAM
308
309#ifndef QT_NO_DATASTREAM
319QDataStream &QGeoSatelliteInfo::dataStreamOut(QDataStream &stream, const QGeoSatelliteInfo &info)
320{
321 stream << info.d->signal;
322 stream << info.d->doubleAttribs;
323 stream << info.d->satId;
324 stream << int(info.d->system);
325 return stream;
326}
327#endif // QT_NO_DATASTREAM
328
329#ifndef QT_NO_DATASTREAM
339QDataStream &QGeoSatelliteInfo::dataStreamIn(QDataStream &stream, QGeoSatelliteInfo &info)
340{
341 int system;
342 stream >> info.d->signal;
343 stream >> info.d->doubleAttribs;
344 stream >> info.d->satId;
345 stream >> system;
346 info.d->system = (QGeoSatelliteInfo::SatelliteSystem)system;
347 return stream;
348}
349#endif // QT_NO_DATASTREAM
350
355
358{
359 signal = other.signal;
360 satId = other.satId;
361 system = other.system;
362 doubleAttribs = other.doubleAttribs;
363}
364
366
368{
369 return signal == other.signal
370 && satId == other.satId
371 && system == other.system
372 && doubleAttribs == other.doubleAttribs;
373}
374
379
380size_t qHash(const QGeoSatelliteInfo &key, size_t seed) noexcept
381{
382 // Other properties and attributes might change
383 return qHashMulti(seed, key.d->satId, key.d->system);
384}
385
386namespace QTest
387{
388
390{
392 QDebug dbg(&result);
393 dbg << info;
394
395 return qstrdup(qPrintable(result));
396}
397
398}
399
400
\inmodule QtCore\reentrant
Definition qdatastream.h:46
\inmodule QtCore
\inmodule QtCore
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
static QGeoSatelliteInfoPrivate * get(const QGeoSatelliteInfo &info)
bool operator==(const QGeoSatelliteInfoPrivate &other) const
QHash< int, qreal > doubleAttribs
QGeoSatelliteInfo::SatelliteSystem system
\inmodule QtPositioning
void setSignalStrength(int signalStrength)
Sets the signal strength to signalStrength, in decibels.
void removeAttribute(Attribute attribute)
Removes the specified attribute and its value.
~QGeoSatelliteInfo()
Destroys a satellite information object.
friend class QGeoSatelliteInfoPrivate
Q_INVOKABLE qreal attribute(Attribute attribute) const
Returns the value of the specified attribute as a qreal value.
void setSatelliteSystem(SatelliteSystem system)
Sets the Satellite System (GPS, GLONASS, ...) to system.
SatelliteSystem satelliteSystem
Attribute
Defines the attributes for the satellite information.
void setSatelliteIdentifier(int satId)
Sets the satellite identifier number to satId.
SatelliteSystem
Defines the GNSS system of the satellite.
QGeoSatelliteInfo()
Creates a satellite information object.
Q_INVOKABLE bool hasAttribute(Attribute attribute) const
Returns true if the specified attribute is present in this update.
void setAttribute(Attribute attribute, qreal value)
Sets the value for attribute to value.
bool remove(const Key &key)
Removes the item that has the key from the hash.
Definition qhash.h:958
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
Definition qhash.h:1007
\inmodule QtCore
Definition qshareddata.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
char * toString(const MyPoint &point)
Q_CORE_EXPORT char * qstrdup(const char *)
EGLStreamKHR stream
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
EGLOutputLayerEXT EGLint attribute
size_t qHash(const QGeoSatelliteInfo &key, size_t seed) noexcept
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
#define QT_IMPL_METATYPE_EXTERN(TYPE)
Definition qmetatype.h:1390
GLuint64 key
GLuint64EXT * result
[6]
const GLint * attribs
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
#define QT_DEFINE_QESDP_SPECIALIZATION_DTOR(Class)
#define qPrintable(string)
Definition qstring.h:1531
double qreal
Definition qtypes.h:187
QSharedPointer< T > other(t)
[5]
QHostInfo info
[0]