Commit 21ff56d2 authored by Lamarque Souza's avatar Lamarque Souza
Browse files

Cache data in Solid ModemManager backend to prevent desktop freeze.

(cherry picked from commit 112163ad4e2163a78e9f77ac323268387e9313bb)
parent 1ac4f566
......@@ -43,6 +43,11 @@ MMModemGsmNetworkInterface::MMModemGsmNetworkInterface(const QString & path, MMM
this, SLOT(slotRegistrationInfoChanged(uint,QString,QString)));
connect( &d->modemGsmNetworkIface, SIGNAL(SignalQuality(uint)),
this, SIGNAL(signalQualityChanged(uint)));
d->signalQuality = d->modemGsmNetworkIface.GetSignalQuality();
d->registrationInfo = d->modemGsmNetworkIface.GetRegistrationInfo();
d->accessTechnology = (Solid::Control::ModemInterface::AccessTechnology)d->modemGsmNetworkIface.accessTechnology();
d->allowedMode = (Solid::Control::ModemInterface::AllowedMode)d->modemGsmNetworkIface.allowedMode();
}
MMModemGsmNetworkInterface::~MMModemGsmNetworkInterface()
......@@ -69,27 +74,34 @@ void MMModemGsmNetworkInterface::propertiesChanged(const QString & interface, co
}
}
void MMModemGsmNetworkInterface::slotSignalQualityChanged(uint signalQuality)
{
Q_D(MMModemGsmNetworkInterface);
d->signalQuality = signalQuality;
emit signalQualityChanged(d->signalQuality);
}
void MMModemGsmNetworkInterface::slotRegistrationInfoChanged(uint status, const QString & operatorCode, const QString &operatorName)
{
RegistrationInfoType r;
Q_D(MMModemGsmNetworkInterface);
r.status = (Solid::Control::ModemGsmNetworkInterface::RegistrationStatus) status;
r.operatorCode = operatorCode;
r.operatorName = operatorName;
d->registrationInfo.status = (Solid::Control::ModemGsmNetworkInterface::RegistrationStatus) status;
d->registrationInfo.operatorCode = operatorCode;
d->registrationInfo.operatorName = operatorName;
emit registrationInfoChanged(r);
emit registrationInfoChanged(d->registrationInfo);
}
Solid::Control::ModemInterface::AllowedMode MMModemGsmNetworkInterface::getAllowedMode() const
{
Q_D(const MMModemGsmNetworkInterface);
return (Solid::Control::ModemInterface::AllowedMode) d->modemGsmNetworkIface.allowedMode();
return d->allowedMode;
}
Solid::Control::ModemInterface::AccessTechnology MMModemGsmNetworkInterface::getAccessTechnology() const
{
Q_D(const MMModemGsmNetworkInterface);
return (Solid::Control::ModemInterface::AccessTechnology) d->modemGsmNetworkIface.accessTechnology();
return d->accessTechnology;
}
void MMModemGsmNetworkInterface::registerToNetwork(const QString & networkId)
......@@ -130,26 +142,14 @@ Solid::Control::ModemInterface::Band MMModemGsmNetworkInterface::getBand()
RegistrationInfoType MMModemGsmNetworkInterface::getRegistrationInfo()
{
Q_D(MMModemGsmNetworkInterface);
QDBusReply< RegistrationInfoType > registrationInfo = d->modemGsmNetworkIface.GetRegistrationInfo();
if (registrationInfo.isValid())
return registrationInfo.value();
kDebug(1441) << "Error getting registration info for operator: " << registrationInfo.error().name() << ": " << registrationInfo.error().message();
return RegistrationInfoType();
Q_D(const MMModemGsmNetworkInterface);
return d->registrationInfo;
}
uint MMModemGsmNetworkInterface::getSignalQuality()
{
Q_D(MMModemGsmNetworkInterface);
QDBusReply< uint > signalQuality = d->modemGsmNetworkIface.GetSignalQuality();
if (signalQuality.isValid())
return signalQuality.value();
kDebug(1441) << "Error getting signal quality: " << signalQuality.error().name() << ": " << signalQuality.error().message();
return 0;
Q_D(const MMModemGsmNetworkInterface);
return d->signalQuality;
}
void MMModemGsmNetworkInterface::setAllowedMode(const Solid::Control::ModemInterface::AllowedMode mode)
......
......@@ -50,6 +50,7 @@ public:
Solid::Control::ModemInterface::AllowedMode getAllowedMode() const;
Solid::Control::ModemInterface::AccessTechnology getAccessTechnology() const;
public Q_SLOTS:
void slotSignalQualityChanged(uint signalQuality);
void slotRegistrationInfoChanged(uint status, const QString & operatorCode, const QString &operatorName);
void propertiesChanged(const QString & interface, const QVariantMap & properties);
Q_SIGNALS:
......
......@@ -30,6 +30,10 @@ class MMModemGsmNetworkInterfacePrivate: public MMModemInterfacePrivate
public:
MMModemGsmNetworkInterfacePrivate(const QString &path, QObject *owner);
OrgFreedesktopModemManagerModemGsmNetworkInterface modemGsmNetworkIface;
uint signalQuality;
Solid::Control::ModemGsmNetworkInterface::RegistrationInfoType registrationInfo;
Solid::Control::ModemInterface::AccessTechnology accessTechnology;
Solid::Control::ModemInterface::AllowedMode allowedMode;
};
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment