ModemManagerQt

modemtime.h
1/*
2 SPDX-FileCopyrightText: 2013 Lukas Tinkl <ltinkl@redhat.com>
3 SPDX-FileCopyrightText: 2013-2015 Jan Grulich <jgrulich@redhat.com>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#ifndef MODEMMANAGERQT_MODEMTIME_H
9#define MODEMMANAGERQT_MODEMTIME_H
10
11#include "interface.h"
12#include <modemmanagerqt_export.h>
13
14#include <QDBusPendingReply>
15#include <QDateTime>
16#include <QObject>
17#include <QSharedPointer>
18
19namespace ModemManager
20{
21class ModemTimePrivate;
22
23/**
24 * This class represents the timezone data provided by the network
25 */
26class MODEMMANAGERQT_EXPORT NetworkTimezone
27{
28public:
29 /**
30 * Constructs an empty timezone data object
31 */
33
34 /**
35 * Destroys this NetworkTimezone object.
36 */
38
39 /**
40 * Constructs an NetworkTimezone object that is a copy of the object @p other.
41 */
42 NetworkTimezone(const NetworkTimezone &other);
43
44 /**
45 * Returns offset of the timezone from UTC, in minutes (including DST, if applicable)
46 */
47 int offset() const;
48
49 /**
50 * Sets offset of the timezone from UTC
51 */
52 void setOffset(int offset);
53
54 /**
55 * Returns amount of offset that is due to DST (daylight saving time)
56 */
57 int dstOffset() const;
58
59 /**
60 * Sets amount of offset that is due to DST
61 */
62 void setDstOffset(int dstOffset);
63
64 /**
65 * Returns number of leap seconds included in the network time
66 */
67 int leapSecond() const;
68
69 /**
70 * Sets number of leap seconds included in the network timezone
71 */
72 void setLeapSecond(int leapSecond);
73 /**
74 * Makes a copy of the NetworkTimezone object @p other.
75 */
77
78private:
79 class Private;
80 Private *const d;
81};
82
83/**
84 * @brief The ModemTime class
85 *
86 * This class allows clients to receive network time and timezone updates broadcast by mobile networks.
87 */
88class MODEMMANAGERQT_EXPORT ModemTime : public Interface
89{
91 Q_DECLARE_PRIVATE(ModemTime)
92
93public:
94 typedef QSharedPointer<ModemTime> Ptr;
95 typedef QList<Ptr> List;
96
97 explicit ModemTime(const QString &path, QObject *parent = nullptr);
98 ~ModemTime() override;
99
100 /**
101 * @return the current network time in local time.
102 *
103 * This method will only work if the modem tracks, or can request, the
104 * current network time; it will not attempt to use previously-received
105 * network time updates on the host to guess the current network time.
106 */
108
109 /**
110 * @return the timezone data provided by the network.
111 * @see NetworkTimezone
112 */
113 ModemManager::NetworkTimezone networkTimezone() const;
114
115 /**
116 * Sets the timeout in milliseconds for all async method DBus calls.
117 * -1 means the default DBus timeout (usually 25 seconds).
118 */
119 void setTimeout(int timeout);
120
121 /**
122 * Returns the current value of the DBus timeout in milliseconds.
123 * -1 means the default DBus timeout (usually 25 seconds).
124 */
125 int timeout() const;
126
128 /**
129 * Sent when the network time is updated.
130 * @param dateTime the new date and time
131 */
132 void networkTimeChanged(const QDateTime &dateTime);
133 void networkTimezoneChanged(const ModemManager::NetworkTimezone &timeZone);
134};
135
136} // namespace ModemManager
137
138Q_DECLARE_METATYPE(ModemManager::NetworkTimezone)
139
140#endif
void networkTimeChanged(const QDateTime &dateTime)
Sent when the network time is updated.
QDBusPendingReply< QString > networkTime()
ModemManager::NetworkTimezone networkTimezone() const
void setTimeout(int timeout)
Sets the timeout in milliseconds for all async method DBus calls.
int timeout() const
Returns the current value of the DBus timeout in milliseconds.
This class represents the timezone data provided by the network.
Definition modemtime.h:27
int leapSecond() const
Returns number of leap seconds included in the network time.
Definition modemtime.cpp:68
void setDstOffset(int dstOffset)
Sets amount of offset that is due to DST.
Definition modemtime.cpp:63
int offset() const
Returns offset of the timezone from UTC, in minutes (including DST, if applicable)
Definition modemtime.cpp:48
void setLeapSecond(int leapSecond)
Sets number of leap seconds included in the network timezone.
Definition modemtime.cpp:73
void setOffset(int offset)
Sets offset of the timezone from UTC.
Definition modemtime.cpp:53
int dstOffset() const
Returns amount of offset that is due to DST (daylight saving time)
Definition modemtime.cpp:58
NetworkTimezone & operator=(const NetworkTimezone &other)
Makes a copy of the NetworkTimezone object other.
Definition modemtime.cpp:78
NetworkTimezone()
Constructs an empty timezone data object.
Definition modemtime.cpp:32
This namespace allows to query the underlying system to discover the available modem interfaces respo...
Definition bearer.cpp:20
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.