14#include "dbus/fakedbus.h"
19ModemManager::SimPrivate::SimPrivate(
const QString &path, Sim *q)
28 if (simIface.isValid()) {
29 active = simIface.active();
30 simIdentifier = simIface.simIdentifier();
31 imsi = simIface.imsi();
33 operatorIdentifier = simIface.operatorIdentifier();
34 operatorName = simIface.operatorName();
35 emergencyNumbers = simIface.emergencyNumbers();
36 preferredNetworks = simIface.preferredNetworks();
37#if MM_CHECK_VERSION(1, 20, 0)
38 gid1 = simIface.gid1();
39 gid2 = simIface.gid2();
40 simType = (MMSimType)simIface.simType();
41 esimStatus = (MMSimEsimStatus)simIface.esimStatus();
42 removability = (MMSimRemovability)simIface.removability();
49 , d_ptr(new SimPrivate(
path, this))
56 QStringLiteral(
"PropertiesChanged"),
63 QStringLiteral(
"PropertiesChanged"),
69ModemManager::Sim::~Sim()
83 return d->simIdentifier;
101 return d->operatorIdentifier;
107 return d->operatorName;
113 return d->emergencyNumbers;
119 return d->preferredNetworks;
122#if MM_CHECK_VERSION(1, 20, 0)
135MMSimType ModemManager::Sim::simType()
const
141MMSimEsimStatus ModemManager::Sim::esimStatus()
const
144 return d->esimStatus;
147MMSimRemovability ModemManager::Sim::removability()
const
150 return d->removability;
157 return d->simIface.SendPuk(puk, pin);
163 return d->simIface.SendPin(pin);
169 return d->simIface.EnablePin(pin, enabled);
175 return d->simIface.ChangePin(oldPin, newPin);
181 return d->simIface.SetPreferredNetworks(preferredNetworks);
184QString ModemManager::Sim::uni()
const
193 d->simIface.setTimeout(timeout);
199 return d->simIface.timeout();
202void ModemManager::SimPrivate::onPropertiesChanged(
const QString &interface,
const QVariantMap &properties,
const QStringList &invalidatedProps)
205 Q_UNUSED(invalidatedProps);
206 qCDebug(MMQT) <<
interface << properties.keys();
209 QVariantMap::const_iterator it = properties.constFind(
QLatin1String(MM_SIM_PROPERTY_ACTIVE));
210 if (it != properties.constEnd()) {
211 active = it->toBool();
212 Q_EMIT q->activeChanged(active);
214 it = properties.constFind(
QLatin1String(MM_SIM_PROPERTY_SIMIDENTIFIER));
215 if (it != properties.constEnd()) {
216 simIdentifier = it->toString();
217 Q_EMIT q->simIdentifierChanged(simIdentifier);
221 imsi = it->toString();
222 Q_EMIT q->imsiChanged(imsi);
226 eid = it->toString();
227 Q_EMIT q->eidChanged(eid);
231 operatorIdentifier = it->toString();
232 Q_EMIT q->operatorIdentifierChanged(operatorIdentifier);
236 operatorName = it->toString();
237 Q_EMIT q->operatorNameChanged(operatorName);
241 emergencyNumbers = it->toStringList();
242 Q_EMIT q->emergencyNumbersChanged(emergencyNumbers);
246 preferredNetworks = it->toMap();
247 Q_EMIT q->preferredNetworksChanged(preferredNetworks);
249#if MM_CHECK_VERSION(1, 20, 0)
252 gid1 = it->toByteArray();
253 Q_EMIT q->gid1Changed(gid1);
257 gid2 = it->toByteArray();
258 Q_EMIT q->gid1Changed(gid2);
262 simType = (MMSimType)it->toUInt();
263 Q_EMIT q->simTypeChanged(simType);
267 esimStatus = (MMSimEsimStatus)it->toUInt();
268 Q_EMIT q->esimStatusChanged(esimStatus);
272 removability = (MMSimRemovability)it->toUInt();
273 Q_EMIT q->removabilityChanged(removability);
279#include "moc_sim.cpp"
280#include "moc_sim_p.cpp"
QDBusPendingReply sendPin(const QString &pin)
Send the PIN to unlock the SIM card.
QString operatorName() const
QVariantMap preferredNetworks() const
QDBusPendingReply sendPuk(const QString &puk, const QString &pin)
Send the PUK and a new PIN to unlock the SIM card.
QString operatorIdentifier() const
int timeout() const
Returns the current value of the DBus timeout in milliseconds.
QStringList emergencyNumbers() const
QDBusPendingReply changePin(const QString &oldPin, const QString &newPin)
Change the PIN code.
QString simIdentifier() const
QDBusPendingReply enablePin(const QString &pin, bool enabled)
Enable or disable the PIN checking.
QDBusPendingReply setPreferredNetworks(QVariantMap preferredNetworks)
void setTimeout(int timeout)
Sets the timeout in milliseconds for all async method DBus calls.
QString path(const QString &relativePath)
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
QDBusConnection sessionBus()
QDBusConnection systemBus()