Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgeosatelliteinfosource_gypsy_p.h
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
4#ifndef QGEOSATELLITEINFOSOURCE_GYPSY_H
5#define QGEOSATELLITEINFOSOURCE_GYPSY_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
20#include <gypsy/gypsy-satellite.h>
21#include <gypsy/gypsy-control.h>
22#include <gypsy/gypsy-device.h>
23#include <gconf/gconf-client.h>
24#include <QTimer>
25
26// #define Q_LOCATION_GYPSY_DEBUG
27
28QT_BEGIN_NAMESPACE
29
30// An engine that encapsulates all symbols we want
31// to be able to mock (for unit/autotest purposes).
32class SatelliteGypsyEngine
33{
34public:
35 SatelliteGypsyEngine(QGeoSatelliteInfoSource *parent = 0);
36 virtual ~SatelliteGypsyEngine();
37 // Glib symbols
38 virtual gulong eng_g_signal_connect(gpointer instance,
39 const gchar *detailed_signal,
40 GCallback c_handler,
41 gpointer data);
42 virtual guint eng_g_signal_handlers_disconnect_by_func(gpointer instance,
43 gpointer func,
44 gpointer data);
45 virtual void eng_g_free(gpointer mem);
46 // Gypsy symbols
47 virtual GypsyControl *eng_gypsy_control_get_default (void);
48 virtual char *eng_gypsy_control_create (GypsyControl *control, const char *device_name, GError **error);
49 virtual GypsyDevice *eng_gypsy_device_new (const char *object_path);
50 virtual GypsySatellite *eng_gypsy_satellite_new (const char *object_path);
51 virtual gboolean eng_gypsy_device_start (GypsyDevice *device, GError **error);
52 virtual gboolean eng_gypsy_device_stop (GypsyDevice *device, GError **error);
53 virtual GypsyDeviceFixStatus eng_gypsy_device_get_fix_status (GypsyDevice *device, GError **error);
54 virtual GPtrArray *eng_gypsy_satellite_get_satellites (GypsySatellite *satellite, GError **error);
55 virtual void eng_gypsy_satellite_free_satellite_array (GPtrArray *satellites);
56 // GConf symbols (mockability due to X11 requirement)
57 virtual GConfClient *eng_gconf_client_get_default(void);
58 virtual gchar *eng_gconf_client_get_string(GConfClient *client, const gchar *key, GError** err);
59protected:
60 QGeoSatelliteInfoSource *m_owner;
61};
62
64 {
66
67public:
70 int init(const QVariantMap parameters);
71
73 Error error() const override;
74
75public slots:
76 virtual void startUpdates() override;
77 void stopUpdates() override;
78 void requestUpdate(int timeout = 5000) override;
79 void satellitesChanged(GypsySatellite *satellite, GPtrArray *satellites);
80
81private slots:
83
84private:
85 void setError(QGeoSatelliteInfoSource::Error error);
86 QString extractDeviceNameFromParameters(const QVariantMap &parameters) const;
87
88protected:
89 // Creates an engine which encapsulates all used symbols
90 // that we want to be also able to mock.
91 virtual void createEngine();
93
94private:
97 GypsyDevice *m_device;
98 QTimer m_requestTimer;
99 bool m_updatesOngoing;
100 bool m_requestOngoing;
102 GypsyControl *m_control = nullptr;
103 };
104
105QT_END_NAMESPACE
106
107#endif // QGEOSATELLITEINFOSOURCE_GYPSY_H
\inmodule QtPositioning
void satellitesChanged(GypsySatellite *satellite, GPtrArray *satellites)
void requestUpdate(int timeout=5000) override
int init(const QVariantMap parameters)
Error error() const override
Returns the last error that occurred.
Q_DECLARE_INTERFACE(QNetworkAccessBackendFactory, QNetworkAccessBackendFactory_iid)