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