ModemManagerQt

modemlocation.h
1/*
2 SPDX-FileCopyrightText: 2008, 2011 Will Stephenson <wstephenson@kde.org>
3 SPDX-FileCopyrightText: 2010 Lamarque Souza <lamarque@kde.org>
4 SPDX-FileCopyrightText: 2013 Lukas Tinkl <ltinkl@redhat.com>
5 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8*/
9
10#ifndef MODEMMANAGERQT_MODEMLOCATION_H
11#define MODEMMANAGERQT_MODEMLOCATION_H
12
13#include <modemmanagerqt_export.h>
14
15#include <QDBusPendingReply>
16#include <QObject>
17#include <QSharedPointer>
18
19#include "generictypes.h"
20#include "interface.h"
21
22namespace ModemManager
23{
24class ModemLocationPrivate;
25
26/**
27 * @brief The ModemLocation class
28 *
29 * The Location class allows devices to provide location information to
30 * client applications. Not all devices can provide this information, or even if
31 * they do, they may not be able to provide it while a data session is active.
32 */
33class MODEMMANAGERQT_EXPORT ModemLocation : public Interface
34{
36 Q_DECLARE_PRIVATE(ModemLocation)
37 Q_FLAGS(MMModemLocationSource)
38
39public:
41 typedef QList<Ptr> List;
42
43 Q_DECLARE_FLAGS(LocationSources, MMModemLocationSource)
44
45 explicit ModemLocation(const QString &path, QObject *parent = nullptr);
46 ~ModemLocation() override;
47
48 /**
49 * Configure the location sources to use when gathering location
50 * information. Also enable or disable location information gathering. This
51 * method may require the client to authenticate itself.
52 *
53 * When signals are emitted, any client application (including malicious
54 * ones!) can listen for location updates unless D-Bus permissions restrict
55 * these signals from certain users. If further security is desired, the
56 * @p signLocation argument can be set to FALSE to disable location updates
57 * via the locationChanged() signal and require applications to call authenticated APIs
58 * (like GetLocation() ) to get location information.
59 */
60 QDBusPendingReply<void> setup(ModemManager::ModemLocation::LocationSources sources, bool signalLocation);
61
62 /**
63 * @return current location information, if any. If the modem supports
64 * multiple location types it may return more than one. See the "Location"
65 * property for more information on the dictionary returned at location.
66 *
67 * This method may require the client to authenticate itself.
68 */
70
71 /**
72 * @return QFlags of MMModemLocationSource values, specifying the supported location sources.
73 */
74 LocationSources capabilities() const;
75
76 /**
77 * @return QFlags specifying which of the supported MMModemLocationSource location sources is currently enabled in the device.
78 */
79 LocationSources enabledCapabilities() const;
80
81 /**
82 * @return whether the device has any location capabilities
83 */
84 bool isEnabled() const;
85
86 /**
87 * @return TRUE if location updates will be emitted via the locationChanged() signal, FALSE if location updates will not be emitted.
88 *
89 * See the setup() method for more information.
90 */
91 bool signalsLocation() const;
92
93 /**
94 * @return Dictionary of available location information when location information gathering is enabled. If the modem supports multiple
95 * location types it may return more than one here.
96 * Note that if the device was told not to emit updated location information when location information gathering was initially enabled,
97 * this property may not return any location information for security reasons.
98 */
99 LocationInformationMap location() const;
100
101 /**
102 * Sets the timeout in milliseconds for all async method DBus calls.
103 * -1 means the default DBus timeout (usually 25 seconds).
104 */
105 void setTimeout(int timeout);
106
107 /**
108 * Returns the current value of the DBus timeout in milliseconds.
109 * -1 means the default DBus timeout (usually 25 seconds).
110 */
111 int timeout() const;
112
114 void capabilitiesChanged(QFlags<MMModemLocationSource> capabilities);
115 void enabledCapabilitiesChanged(QFlags<MMModemLocationSource> capabilities);
116 void signalsLocationChanged(bool signalsLocation);
117 /**
118 * Emitted when the location has changed
119 */
120 void locationChanged(const ModemManager::LocationInformationMap &location);
121};
122
123Q_DECLARE_OPERATORS_FOR_FLAGS(ModemLocation::LocationSources)
124
125} // namespace ModemManager
126
127#endif
LocationSources enabledCapabilities() const
void setTimeout(int timeout)
Sets the timeout in milliseconds for all async method DBus calls.
LocationSources capabilities() const
LocationInformationMap location() const
int timeout() const
Returns the current value of the DBus timeout in milliseconds.
QDBusPendingReply< void > setup(ModemManager::ModemLocation::LocationSources sources, bool signalLocation)
Configure the location sources to use when gathering location information.
QDBusPendingReply< LocationInformationMap > getLocation()
void locationChanged(const ModemManager::LocationInformationMap &location)
Emitted when the location has changed.
This namespace allows to query the underlying system to discover the available modem interfaces respo...
Definition bearer.cpp:20
Q_FLAGS(...)
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:54:23 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.