From b8d72845dfb5b6401b3f04b50f08a226a48b69f4 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Wed, 21 Mar 2012 16:12:46 +0200 Subject: [PATCH] Add type property to modem interface --- TODO | 1 + lib/ofonomodem.cpp | 7 +++++++ lib/ofonomodem.h | 3 +++ tests/test_ofonomodem.cpp | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/TODO b/TODO index 1e11966..bca5660 100644 --- 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 ** diff --git a/lib/ofonomodem.cpp b/lib/ofonomodem.cpp index 30cfea2..69d851f 100644 --- a/lib/ofonomodem.cpp +++ b/lib/ofonomodem.cpp @@ -79,6 +79,8 @@ void OfonoModem::propertyChanged(const QString& property, const QVariant& value) emit revisionChanged(value.value()); else if (property == "Serial") emit serialChanged(value.value()); + else if (property == "Type") + emit typeChanged(value.value()); else if (property == "Features") emit featuresChanged(value.value()); else if (property == "Interfaces") @@ -212,6 +214,11 @@ QString OfonoModem::serial() const return m_if->properties()["Serial"].value(); } +QString OfonoModem::type() const +{ + return m_if->properties()["Type"].value(); +} + QStringList OfonoModem::features() const { return m_if->properties()["Features"].value(); diff --git a/lib/ofonomodem.h b/lib/ofonomodem.h index 532c865..701ab8b 100644 --- a/lib/ofonomodem.h +++ b/lib/ofonomodem.h @@ -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); diff --git a/tests/test_ofonomodem.cpp b/tests/test_ofonomodem.cpp index 8f6b148..657f152 100644 --- a/tests/test_ofonomodem.cpp +++ b/tests/test_ofonomodem.cpp @@ -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); -- 2.7.4