ModemManagerQt

sim.h
1/*
2 SPDX-FileCopyrightText: 2008, 2011 Will Stephenson <wstephenson@kde.org>
3 SPDX-FileCopyrightText: 2010-2011 Lamarque Souza <lamarque@kde.org>
4 SPDX-FileCopyrightText: 2013 Lukas Tinkl <ltinkl@redhat.com>
5 SPDX-FileCopyrightText: 2013-2015 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_SIM_H
11#define MODEMMANAGERQT_SIM_H
12
13#include <modemmanagerqt_export.h>
14
15#include <QDBusPendingReply>
16#include <QObject>
17#include <QSharedPointer>
18
19#include "generictypes.h"
20
21namespace ModemManager
22{
23class SimPrivate;
24
25/**
26 * @brief The Sim class
27 *
28 * The SIM class handles communication with SIM, USIM, and RUIM (CDMA SIM) cards.
29 */
30class MODEMMANAGERQT_EXPORT Sim : public QObject
31{
32 Q_OBJECT
33 Q_DECLARE_PRIVATE(Sim)
34
35public:
37 typedef QList<Ptr> List;
38
39 explicit Sim(const QString &path, QObject *parent = nullptr);
40 ~Sim() override;
41
42 /**
43 * @return Boolean indicating whether the SIM is currently active.
44 *
45 * On systems that support Multi SIM Single Standby, only one SIM may be
46 * active at any given time, which will be the one considered primary.
47
48 * On systems that support Multi SIM Multi Standby, more than one SIM may
49 * be active at any given time, but only one of them is considered primary.
50 */
51 bool active() const;
52
53 /**
54 * @return The ICCID of the SIM card.
55 *
56 * This may be available before the PIN has been entered depending on the device itself.
57 */
58 QString simIdentifier() const;
59
60 /**
61 * @return The IMSI of the SIM card, if any.
62 */
63 QString imsi() const;
64
65 /**
66 * @return The EID of the SIM card, if any.
67 */
68 QString eid() const;
69
70 /**
71 * @return The ID of the network operator, as given by the SIM card, if known.
72 */
73 QString operatorIdentifier() const;
74
75 /**
76 * @return The name of the network operator, as given by the SIM card, if known.
77 */
78 QString operatorName() const;
79
80 /**
81 * @return List of emergency numbers programmed in the SIM card.
82 *
83 * These numbers should be treated as numbers for emergency calls in
84 * addition to 112 and 911.
85 */
86 QStringList emergencyNumbers() const;
87
88 /**
89 * @return Map of preferred networks with access technologies configured in the SIM card.
90 *
91 * Each entry contains an operator id string key "MCCMNC"
92 * consisting of 5 or 6 digits, to an MMModemAccessTechnology mask value.
93 * If the SIM card does not support access technology storage, the mask will be
94 * set to MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN.
95 */
96 QVariantMap preferredNetworks() const;
97
98#if MM_CHECK_VERSION(1, 20, 0)
99 /**
100 * @return Group identifier 1evel 1.
101 */
102 QByteArray gid1() const;
103
104 /**
105 * @return Group identifier 1evel 2.
106 */
107 QByteArray gid2() const;
108
109 /**
110 * @return Indicates whether the current primary SIM is a ESIM or a physical SIM.
111 */
112 MMSimType simType() const;
113
114 /**
115 * @return If current SIM is ESIM then this indicates whether there is a profile or not.
116 */
117 MMSimEsimStatus esimStatus() const;
118
119 /**
120 * @return Indicates whether the current SIM is a removable SIM or not.
121 */
122 MMSimRemovability removability() const;
123#endif
124
125 /**
126 * Send the PIN to unlock the SIM card.
127 * @param pin A string containing the PIN code.
128 */
129 QDBusPendingReply<> sendPin(const QString &pin);
130
131 /**
132 * Send the PUK and a new PIN to unlock the SIM card.
133 * @param puk A string containing the PUK code.
134 * @param pin A string containing the PIN code.
135 */
136 QDBusPendingReply<> sendPuk(const QString &puk, const QString &pin);
137
138 /**
139 * Enable or disable the PIN checking.
140 * @param pin A string containing the PIN code.
141 * @param enabled TRUE to enable PIN checking, FALSE otherwise.
142 */
143 QDBusPendingReply<> enablePin(const QString &pin, bool enabled);
144
145 /**
146 * Change the PIN code.
147 * @param oldPin A string containing the current PIN code.
148 * @param newPin A string containing the new PIN code.
149 */
150 QDBusPendingReply<> changePin(const QString &oldPin, const QString &newPin);
151
152 /**
153 * @param preferred_plmns List of preferred networks.
154 *
155 * Stores the provided preferred network list to the SIM card. Each entry contains
156 * an operator id string ("MCCMNC") consisting of 5 or 6 digits,
157 * and an MMModemAccessTechnology mask to store to SIM card if supported.
158 *
159 * This method removes any pre-existing entries of the preferred network list. Note
160 * that even if this operation fails, the preferred network list on the SIM card may
161 * have changed.
162 */
163 QDBusPendingReply<> setPreferredNetworks(QVariantMap preferredNetworks);
164
165 QString uni() const;
166
167 /**
168 * Sets the timeout in milliseconds for all async method DBus calls.
169 * -1 means the default DBus timeout (usually 25 seconds).
170 */
171 void setTimeout(int timeout);
172
173 /**
174 * Returns the current value of the DBus timeout in milliseconds.
175 * -1 means the default DBus timeout (usually 25 seconds).
176 */
177 int timeout() const;
178
179Q_SIGNALS:
180 void activeChanged(bool active);
181 void simIdentifierChanged(const QString &identifier);
182 void imsiChanged(const QString &imsi);
183 void eidChanged(const QString &eid);
184 void operatorIdentifierChanged(const QString &identifier);
185 void operatorNameChanged(const QString &name);
186 void emergencyNumbersChanged(const QStringList &emergencyNumbers);
187 void preferredNetworksChanged(const QVariantMap &preferredNetworks);
188#if MM_CHECK_VERSION(1, 20, 0)
189 void gid1Changed(const QByteArray &gid1);
190 void gid2Changed(const QByteArray &gid2);
191 void simTypeChanged(MMSimType simType);
192 void esimStatusChanged(MMSimEsimStatus esimStatus);
193 void removabilityChanged(MMSimRemovability removability);
194#endif
195
196private:
197 SimPrivate *const d_ptr;
198};
199} // namespace ModemManager
200
201#endif
The Sim class.
Definition sim.h:31
This namespace allows to query the underlying system to discover the available modem interfaces respo...
Definition bearer.cpp:20
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:07:54 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.