Add type property to modem interface
authorAlexander Kanavin <alexander.kanavin@intel.com>
Wed, 21 Mar 2012 14:12:46 +0000 (16:12 +0200)
committerAlexander Kanavin <alexander.kanavin@intel.com>
Wed, 21 Mar 2012 14:12:46 +0000 (16:12 +0200)
TODO
lib/ofonomodem.cpp
lib/ofonomodem.h
tests/test_ofonomodem.cpp

diff --git a/TODO b/TODO
index 1e11966..bca5660 100644 (file)
--- a/TODO
+++ b/TODO
@@ -13,6 +13,7 @@ org.ofono.cdma.MessageManager ***
 org.ofono.cdma.NetworkRegistration **
 org.ofono.cdma.VoiceCallManager **
 org.ofono.CellBroadcast **
+org.ofono.Handsfree *
 org.ofono.LocationReporting *
 org.ofono.PushNotification and org.ofono.PushNotificationAgent **
 org.ofono.SmartMessaging and org.ofono.SmartMessagingAgent **
index 30cfea2..69d851f 100644 (file)
@@ -79,6 +79,8 @@ void OfonoModem::propertyChanged(const QString& property, const QVariant& value)
         emit revisionChanged(value.value<QString>());
     else if (property == "Serial")
         emit serialChanged(value.value<QString>());
+    else if (property == "Type")
+        emit typeChanged(value.value<QString>());
     else if (property == "Features")
         emit featuresChanged(value.value<QStringList>());
     else if (property == "Interfaces")
@@ -212,6 +214,11 @@ QString OfonoModem::serial() const
     return m_if->properties()["Serial"].value<QString>();
 }
 
+QString OfonoModem::type() const
+{
+    return m_if->properties()["Type"].value<QString>();
+}
+
 QStringList OfonoModem::features() const
 {
     return m_if->properties()["Features"].value<QStringList>();
index 532c865..701ab8b 100644 (file)
@@ -57,6 +57,7 @@ Q_PROPERTY(QString manufacturer READ manufacturer NOTIFY manufacturerChanged)
 Q_PROPERTY(QString model READ model NOTIFY modelChanged)
 Q_PROPERTY(QString revision READ revision NOTIFY revisionChanged)
 Q_PROPERTY(QString serial READ serial NOTIFY serialChanged)
+Q_PROPERTY(QString type READ type NOTIFY typeChanged)
 
 Q_PROPERTY(QStringList features READ features NOTIFY featuresChanged)
 Q_PROPERTY(QStringList interfaces READ interfaces NOTIFY interfacesChanged)
@@ -113,6 +114,7 @@ public:
     QString model() const;
     QString revision() const;
     QString serial() const;
+    QString type() const;
     
     QStringList features() const;
     QStringList interfaces() const;
@@ -141,6 +143,7 @@ signals:
     void modelChanged(const QString &model);
     void revisionChanged(const QString &revision);
     void serialChanged(const QString &serial);
+    void typeChanged(const QString &type);
 
     void featuresChanged(const QStringList &features);
     void interfacesChanged(const QStringList &interfaces);
index 8f6b148..657f152 100644 (file)
@@ -66,6 +66,7 @@ private slots:
         QCOMPARE(mm->model(), QString("Synthetic Device"));
         QCOMPARE(mm->revision(), QString("REV1"));
         QCOMPARE(mm->serial(), QString("1234567890"));
+        QCOMPARE(mm->type(), QString("hardware"));
     }
 
     void testOfonoModemAutomatic()
@@ -130,6 +131,7 @@ private slots:
         QSignalSpy model(mm, SIGNAL(modelChanged(const QString &)));
         QSignalSpy revision(mm, SIGNAL(revisionChanged(const QString &)));
         QSignalSpy serial(mm, SIGNAL(serialChanged(const QString &)));
+        QSignalSpy type(mm, SIGNAL(typeChanged(const QString &)));
         QSignalSpy features(mm, SIGNAL(featuresChanged(const QStringList &)));
         QSignalSpy interfaces(mm, SIGNAL(interfacesChanged(const QStringList &)));
         
@@ -146,6 +148,7 @@ private slots:
         QCOMPARE(model.count(), 0);
         QCOMPARE(revision.count(), 0);
         QCOMPARE(serial.count(), 0);
+        QCOMPARE(type.count(), 0);
         QCOMPARE(features.count(), 1);
         QVERIFY(features.takeFirst().at(0).toStringList().count() > 0);
         QCOMPARE(interfaces.count(), 1);
@@ -164,6 +167,7 @@ private slots:
         QCOMPARE(model.count(), 0);
         QCOMPARE(revision.count(), 0);
         QCOMPARE(serial.count(), 0);
+        QCOMPARE(type.count(), 0);
         QCOMPARE(features.count(), 1);
         QCOMPARE(features.takeFirst().at(0).toStringList().count(), 0);
         QCOMPARE(interfaces.count(), 1);
@@ -203,6 +207,7 @@ private slots:
         revision.takeFirst();
         QCOMPARE(serial.count(), 1);
         serial.takeFirst();
+        QCOMPARE(type.count(), 0);
         QVERIFY(features.count() > 0);
         QVERIFY(features.takeLast().at(0).toStringList().count() > 0);
         features.clear();
@@ -223,6 +228,7 @@ private slots:
         QCOMPARE(model.count(), 0);
         QCOMPARE(revision.count(), 0);
         QCOMPARE(serial.count(), 0);
+        QCOMPARE(type.count(), 0);
         QVERIFY(features.count() > 0);
         QVERIFY(features.takeLast().at(0).toStringList().count() > 0);
         QVERIFY(interfaces.count() > 0);