diff options
author | Lorn Potter <lorn.potter@jollamobile.com> | 2014-01-23 18:47:31 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-07 05:34:30 +0100 |
commit | cc14f85730813b9f0bb752627bab3c44803091a6 (patch) | |
tree | 4067c89125712461df5ee9ce06e78ae69c82667d /src/plugins/bearer/connman/qofonoservice_linux_p.h | |
parent | 125bb81bef7729d182f533989ffdf53685abbe31 (diff) |
Refactor and remove dead code, add property caching.
This helps with a flood of dbus messages due to properties.
Change-Id: I7aa9d36a077d84a88dab561d007d597b0780e096
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Diffstat (limited to 'src/plugins/bearer/connman/qofonoservice_linux_p.h')
-rw-r--r-- | src/plugins/bearer/connman/qofonoservice_linux_p.h | 220 |
1 files changed, 26 insertions, 194 deletions
diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h index 4802e0dc70..8fea465fd0 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux_p.h +++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h @@ -71,18 +71,10 @@ #define OFONO_SERVICE "org.ofono" #define OFONO_MANAGER_INTERFACE "org.ofono.Manager" #define OFONO_MANAGER_PATH "/" + #define OFONO_MODEM_INTERFACE "org.ofono.Modem" #define OFONO_NETWORK_REGISTRATION_INTERFACE "org.ofono.NetworkRegistration" -#define OFONO_NETWORK_OPERATOR_INTERFACE "org.ofono.NetworkOperator" #define OFONO_DATA_CONNECTION_MANAGER_INTERFACE "org.ofono.ConnectionManager" -#define OFONO_SIM_MANAGER_INTERFACE "org.ofono.SimManager" -#define OFONO_DATA_CONTEXT_INTERFACE "org.ofono.ConnectionContext" - -#define OFONO_SMS_MANAGER_INTERFACE "org.ofono.SmsManager" -#define OFONO_PHONEBOOK_INTERFACE "org.ofono.Phonebook" -#define OFONO_MESSAGE_WAITING_INTERFACE "org.ofono.MessageWaiting" - - QT_BEGIN_NAMESPACE @@ -108,35 +100,15 @@ public: QOfonoManagerInterface( QObject *parent = 0); ~QOfonoManagerInterface(); - QDBusObjectPath path() const; - - QVariantMap getProperties(); - bool setProperty(const QString &name, const QDBusVariant &value); - QList <QDBusObjectPath> getModems(); - QDBusObjectPath currentModem(); - -Q_SIGNALS: - void propertyChanged(const QString &, const QDBusVariant &value); - void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); -protected: - void connectNotify(const QMetaMethod &signal); - void disconnectNotify(const QMetaMethod &signal); - QVariant getProperty(const QString &); - -}; - - -class QOfonoDBusHelper: public QObject, protected QDBusContext - { - Q_OBJECT - public: - QOfonoDBusHelper(QObject *parent = 0); - ~QOfonoDBusHelper(); - - public slots: - void propertyChanged(const QString &, const QDBusVariant &); - Q_SIGNALS: - void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); + QStringList getModems(); + QString currentModem(); +signals: + void modemChanged(); +private: + QStringList modemList; +private slots: + void modemAdded(const QDBusObjectPath &path, const QVariantMap &var); + void modemRemoved(const QDBusObjectPath &path); }; class QOfonoModemInterface : public QDBusAbstractInterface @@ -148,27 +120,13 @@ public: explicit QOfonoModemInterface(const QString &dbusModemPathName, QObject *parent = 0); ~QOfonoModemInterface(); - QVariantMap getProperties(); - //properties bool isPowered(); bool isOnline(); - QString getName(); - QString getManufacturer(); - QString getModel(); - QString getRevision(); - QString getSerial(); - - QStringList getFeatures(); //sms, sim - QStringList getInterfaces(); - QString defaultInterface(); - -protected: - void connectNotify(const QMetaMethod &signal); - void disconnectNotify(const QMetaMethod &signal); +private: + QVariantMap getProperties(); + QVariantMap propertiesMap; QVariant getProperty(const QString &); -Q_SIGNALS: void propertyChanged(const QString &, const QDBusVariant &value); - void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); }; @@ -181,80 +139,16 @@ public: explicit QOfonoNetworkRegistrationInterface(const QString &dbusModemPathName, QObject *parent = 0); ~QOfonoNetworkRegistrationInterface(); - QVariantMap getProperties(); - - //properties - QString getStatus(); - quint16 getLac(); - quint32 getCellId(); QString getTechnology(); - QString getOperatorName(); - int getSignalStrength(); - QString getBaseStation(); - QList <QDBusObjectPath> getOperators(); - -protected: - void connectNotify(const QMetaMethod &signal); - void disconnectNotify(const QMetaMethod &signal); - QVariant getProperty(const QString &); -Q_SIGNALS: - void propertyChanged(const QString &, const QDBusVariant &value); - void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); - -}; - -class QOfonoNetworkOperatorInterface : public QDBusAbstractInterface -{ - Q_OBJECT - -public: -//modem or operator paths - explicit QOfonoNetworkOperatorInterface(const QString &dbusPathName, QObject *parent = 0); - ~QOfonoNetworkOperatorInterface(); - - QVariantMap getProperties(); - - //properties - QString getName(); - QString getStatus();// "unknown", "available", "current" and "forbidden" - QString getMcc(); - QString getMnc(); - QStringList getTechnologies(); - -protected: - void connectNotify(const QMetaMethod &signal); - void disconnectNotify(const QMetaMethod &signal); - QVariant getProperty(const QString &); -}; - -class QOfonoSimInterface : public QDBusAbstractInterface -{ - Q_OBJECT - -public: - - explicit QOfonoSimInterface(const QString &dbusModemPathName, QObject *parent = 0); - ~QOfonoSimInterface(); +private: QVariantMap getProperties(); - - //properties - bool isPresent(); - QString getHomeMcc(); - QString getHomeMnc(); -// QStringList subscriberNumbers(); -// QMap<QString,QString> serviceNumbers(); - QString pinRequired(); - QString lockedPins(); - QString cardIdentifier(); - -protected: - void connectNotify(const QMetaMethod &signal); - void disconnectNotify(const QMetaMethod &signal); QVariant getProperty(const QString &); + QVariantMap propertiesMap; +Q_SIGNALS: + void propertyChanged(const QString &, const QDBusVariant &value); }; - class QOfonoDataConnectionManagerInterface : public QDBusAbstractInterface { Q_OBJECT @@ -264,82 +158,20 @@ public: explicit QOfonoDataConnectionManagerInterface(const QString &dbusPathName, QObject *parent = 0); ~QOfonoDataConnectionManagerInterface(); + QStringList contexts(); + bool roamingAllowed(); +Q_SIGNALS: + void roamingAllowedChanged(bool); +private: QVariantMap getProperties(); - - //properties - QList<QDBusObjectPath> getPrimaryContexts(); - bool isAttached(); - bool isRoamingAllowed(); - bool isPowered(); - - bool setPower(bool on); - -protected: - void connectNotify(const QMetaMethod &signal); - void disconnectNotify(const QMetaMethod &signal); - QVariant getProperty(const QString &); -}; - - -class QOfonoConnectionContextInterface : public QDBusAbstractInterface -{ - Q_OBJECT - -public: - - explicit QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent = 0); - ~QOfonoConnectionContextInterface(); - - QVariantMap getProperties(); - - //properties - bool isActive(); - QString getApName(); - QString getType(); - QString getName(); - QVariantMap getSettings(); - QString getInterface(); - QString getAddress(); - - bool setActive(bool on); - bool setApn(const QString &name); - -protected: - void connectNotify(const QMetaMethod &signal); - void disconnectNotify(const QMetaMethod &signal); - QVariant getProperty(const QString &); - bool setProp(const QString &, const QVariant &var); -}; - -class QOfonoSmsInterface : public QDBusAbstractInterface -{ - Q_OBJECT - -public: - - explicit QOfonoSmsInterface(const QString &dbusModemPathName, QObject *parent = 0); - ~QOfonoSmsInterface(); - - QVariantMap getProperties(); - void sendMessage(const QString &to, const QString &message); - - //properties - QString serviceCenterAddress(); - bool useDeliveryReports(); - QString bearer(); - -protected: - void connectNotify(const QMetaMethod &signal); - void disconnectNotify(const QMetaMethod &signal); + QVariantMap propertiesMap; QVariant getProperty(const QString &); - -Q_SIGNALS: + QStringList contextList; +private slots: void propertyChanged(const QString &, const QDBusVariant &value); - void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); - void immediateMessage(const QString &message, const QVariantMap &info); - void incomingMessage(const QString &message, const QVariantMap &info); }; + QT_END_NAMESPACE #endif // QT_NO_DBUS |