6#ifdef Q_LOCATION_GYPSY_DEBUG
14#define UPDATE_TIMEOUT_COLD_START 120000
18static const auto defaultGconfKey =
"/apps/geoclue/master/org.freedesktop.Geoclue.GPSDevice";
22 GPtrArray *satellites,
25#ifdef Q_LOCATION_GYPSY_DEBUG
26 qDebug() <<
"QGeoSatelliteInfoSourceGypsy Gypsy satellites-changed -signal received.";
41 const gchar *detailed_signal,
45 return ::g_signal_connect(instance, detailed_signal, c_handler,
data);
51 return ::g_signal_handlers_disconnect_by_func(instance,
func,
data);
61 return ::gypsy_control_get_default();
65 return ::gypsy_control_create(control, device_name,
error);
69 return ::gypsy_device_new(object_path);
73 return ::gypsy_satellite_new (object_path);
91 return ::gypsy_device_get_fix_status (
device,
error);
95 return ::gypsy_satellite_get_satellites (satellite,
error);
99 return ::gypsy_satellite_free_satellite_array(satellites);
104 return ::gconf_client_get_default();
108 return ::gconf_client_get_string(client,
key, err);
113 m_requestTimer(
this), m_updatesOngoing(
false), m_requestOngoing(
false)
127 GError *
error = NULL;
130 g_object_unref(m_device);
133 g_object_unref(m_satellite);
135 g_object_unref(m_control);
143 if (prn >= 1 && prn <= 32)
145 else if (prn >= 65 && prn <= 96)
147 else if (prn >= 193 && prn <= 200)
149 else if ((prn >= 201 && prn <= 235) || (prn >= 401 && prn <= 437))
151 else if (prn >= 301 && prn <= 336)
157 GPtrArray *satellites)
159 if (!satellite || !satellites)
169 for (
i = 0;
i < satellites->len;
i++) {
170 GypsySatelliteDetails *details = (GypsySatelliteDetails *)satellites->pdata[
i];
172 info.setSatelliteIdentifier(details->satellite_id);
176 info.setSignalStrength(details->snr);
181 bool sendUpdates(
false);
183 if (m_requestOngoing) {
185 m_requestTimer.
stop();
186 m_requestOngoing =
false;
188 if (!m_updatesOngoing) {
193 if (m_updatesOngoing)
202QString QGeoSatelliteInfoSourceGypsy::extractDeviceNameFromParameters(
const QVariantMap ¶meters)
const
228 g_object_unref(client);
238 GError *
error = NULL;
241#if !GLIB_CHECK_VERSION(2, 36, 0)
246 const QString deviceName = extractDeviceNameFromParameters(parameters);
250 qWarning (
"QGeoSatelliteInfoSourceGypsy Empty/nonexistent GPS device name detected.");
252 qWarning(
"or use '%s' plugin parameter to specify a GConf key to extract the device name.",
254 qWarning (
"If the GConf key is used, the gconftool-2 tool can be used to set device name "
255 "for the selected key, e.g. on terminal:");
261 qWarning(
"QGeoSatelliteInfoSourceGypsy unable to create Gypsy control.");
267 qWarning (
"QGeoSatelliteInfoSourceGypsy error creating client.");
270 g_error_free (
error);
277 if (!m_device || !m_satellite) {
278 qWarning (
"QGeoSatelliteInfoSourceGypsy error creating satellite device.");
279 qWarning (
"Please check that the GPS device is specified correctly.");
281 qWarning(
"or use '%s' plugin parameter to specify a GConf key to extract the device name.",
283 qWarning (
"If the GConf key is used, the gconftool-2 tool can be used to set device name "
284 "for the selected key, e.g. on terminal:");
287 g_object_unref(m_device);
289 g_object_unref(m_satellite);
294 qWarning (
"QGeoSatelliteInfoSourceGypsy error starting device: %s ",
297 g_object_unref(m_device);
298 g_object_unref(m_satellite);
316 if (m_updatesOngoing)
326 m_updatesOngoing =
true;
331 if (!m_updatesOngoing)
333 m_updatesOngoing =
false;
343 if (m_requestOngoing)
352 m_requestOngoing =
true;
356 if (!
error && (fixStatus != GYPSY_DEVICE_FIX_STATUS_INVALID &&
357 fixStatus != GYPSY_DEVICE_FIX_STATUS_NONE)) {
358#ifdef Q_LOCATION_GYPSY_DEBUG
359 qDebug() <<
"QGeoSatelliteInfoSourceGypsy fix available, requesting current satellite data";
371 if (!m_updatesOngoing) {
375 m_requestTimer.
start();
377#ifdef Q_LOCATION_GYPSY_DEBUG
378 qDebug() <<
"QGeoSatelliteInfoSourceGypsy error asking fix status or satellite data: " <<
error->message;
384void QGeoSatelliteInfoSourceGypsy::requestUpdateTimeout()
386#ifdef Q_LOCATION_GYPSY_DEBUG
387 qDebug(
"QGeoSatelliteInfoSourceGypsy request update timeout occurred.");
392 if (!m_updatesOngoing) {
395 m_requestOngoing =
false;
IOBluetoothDevice * device
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void satellitesChanged(GypsySatellite *satellite, GPtrArray *satellites)
void requestUpdate(int timeout=5000) override
void stopUpdates() override
virtual void createEngine()
int init(const QVariantMap parameters)
QGeoSatelliteInfoSourceGypsy(QObject *parent=0)
~QGeoSatelliteInfoSourceGypsy()
virtual void startUpdates() override
SatelliteGypsyEngine * m_engine
int minimumUpdateInterval() const override
Error error() const override
Returns the last error that occurred.
Error
The Error enumeration represents the errors which can occur.
void satellitesInViewUpdated(const QList< QGeoSatelliteInfo > &satellites)
If startUpdates() or requestUpdate() is called, this signal is emitted when an update is available on...
void satellitesInUseUpdated(const QList< QGeoSatelliteInfo > &satellites)
If startUpdates() or requestUpdate() is called, this signal is emitted when an update is available on...
void errorOccurred(QGeoSatelliteInfoSource::Error)
This signal is emitted after an error occurred.
SatelliteSystem
Defines the GNSS system of the satellite.
void append(parameter_type t)
T value(const Key &key, const T &defaultValue=T()) const
bool contains(const Key &key) const
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
QByteArray toLatin1() const &
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString trimmed() const &
void setSingleShot(bool singleShot)
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
void setInterval(int msec)
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
void stop()
Stops the timer.
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
virtual void eng_g_free(gpointer mem)
virtual gboolean eng_gypsy_device_stop(GypsyDevice *device, GError **error)
virtual gchar * eng_gconf_client_get_string(GConfClient *client, const gchar *key, GError **err)
SatelliteGypsyEngine(QGeoSatelliteInfoSource *parent=0)
virtual guint eng_g_signal_handlers_disconnect_by_func(gpointer instance, gpointer func, gpointer data)
virtual GypsyControl * eng_gypsy_control_get_default(void)
virtual GConfClient * eng_gconf_client_get_default(void)
virtual gulong eng_g_signal_connect(gpointer instance, const gchar *detailed_signal, GCallback c_handler, gpointer data)
virtual gboolean eng_gypsy_device_start(GypsyDevice *device, GError **error)
virtual void eng_gypsy_satellite_free_satellite_array(GPtrArray *satellites)
virtual GPtrArray * eng_gypsy_satellite_get_satellites(GypsySatellite *satellite, GError **error)
virtual GypsyDevice * eng_gypsy_device_new(const char *object_path)
virtual ~SatelliteGypsyEngine()
virtual char * eng_gypsy_control_create(GypsyControl *control, const char *device_name, GError **error)
virtual GypsySatellite * eng_gypsy_satellite_new(const char *object_path)
virtual GypsyDeviceFixStatus eng_gypsy_device_get_fix_status(GypsyDevice *device, GError **error)
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
static const auto defaultGconfKey
static const auto gconfKeyParameter
static const auto deviceNameParameter
static void satellites_changed(GypsySatellite *satellite, GPtrArray *satellites, gpointer userdata)
static QGeoSatelliteInfo::SatelliteSystem idToSystem(int prn)
#define UPDATE_TIMEOUT_COLD_START
GLbitfield GLuint64 timeout
[4]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei const GLchar *const * path
QFileInfo info(fileName)
[8]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent