2 * This file is part of ofono-qt
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 #include <QtTest/QtTest>
25 #include <QtCore/QObject>
27 #include <ofononetworkregistration.h>
32 class TestOfonoNetworkRegistration : public QObject
38 void modeChanged(QString mode)
40 qDebug() << "modeChanged" << mode;
43 void statusChanged(QString status)
45 qDebug() << "statusChanged" << status;
48 void locationAreaCodeChanged(uint locationAreaCode)
50 qDebug() << "locationAreaCodeChanged" << locationAreaCode;
53 void cellIdChanged(uint cellId)
55 qDebug() << "cellIdChanged" << cellId;
58 void mccChanged(QString mcc)
60 qDebug() << "mccChanged" << mcc;
63 void mncChanged(QString mnc)
65 qDebug() << "mncChanged" << mnc;
68 void technologyChanged(QString technology)
70 qDebug() << "technologyChanged" << technology;
73 void nameChanged(QString name)
75 qDebug() << "nameChanged" << name;
78 void strengthChanged(uint strength)
80 qDebug() << "strengthChanged" << strength;
83 void baseStationChanged(QString baseStation)
85 qDebug() << "baseStationChanged" << baseStation;
88 void registerComplete(bool success)
90 qDebug() << "registerComplete:" << success;
93 void deregisterComplete(bool success)
95 qDebug() << "deregisterComplete:" << success;
98 void getOperatorsComplete(bool success, QStringList oplist)
100 qDebug() << "getOperatorsComplete:" << success << oplist;
103 void scanComplete(bool success, QStringList oplist)
105 qDebug() << "scanComplete:" << success << oplist;
110 m = new OfonoNetworkRegistration(OfonoModem::AutomaticSelect, QString(), this);
112 connect(m, SIGNAL(registerComplete(bool)), this,
113 SLOT(registerComplete(bool)));
114 connect(m, SIGNAL(deregisterComplete(bool)), this,
115 SLOT(deregisterComplete(bool)));
116 connect(m, SIGNAL(getOperatorsComplete(bool, QStringList)),
117 this, SLOT(getOperatorsComplete(bool, QStringList)));
118 connect(m, SIGNAL(scanComplete(bool, QStringList)),
119 this, SLOT(scanComplete(bool, QStringList)));
121 connect(m, SIGNAL(modeChanged(QString)),
122 this, SLOT(modeChanged(QString)));
123 connect(m, SIGNAL(statusChanged(QString)),
124 this, SLOT(statusChanged(QString)));
125 connect(m, SIGNAL(locationAreaCodeChanged(uint)),
126 this, SLOT(locationAreaCodeChanged(uint)));
127 connect(m, SIGNAL(cellIdChanged(uint)),
128 this, SLOT(cellIdChanged(uint)));
129 connect(m, SIGNAL(mccChanged(QString)),
130 this, SLOT(mccChanged(QString)));
131 connect(m, SIGNAL(mncChanged(QString)),
132 this, SLOT(mncChanged(QString)));
133 connect(m, SIGNAL(technologyChanged(QString)),
134 this, SLOT(technologyChanged(QString)));
135 connect(m, SIGNAL(nameChanged(QString)),
136 this, SLOT(nameChanged(QString)));
137 connect(m, SIGNAL(strengthChanged(uint)),
138 this, SLOT(strengthChanged(uint)));
139 connect(m, SIGNAL(baseStationChanged(QString)),
140 this, SLOT(baseStationChanged(QString)));
144 void testOfonoNetworkRegistration()
146 qDebug() << "mode():" << m->mode();
147 qDebug() << "status():" << m->status();
148 qDebug() << "lac():" << m->locationAreaCode();
149 qDebug() << "cellid():" << m->cellId();
150 qDebug() << "mobileCountryCode():" << m->mcc();
151 qDebug() << "mobileNetworkCode():" << m->mnc();
152 qDebug() << "technology():" << m->technology();
153 qDebug() << "name():" << m->name();
154 qDebug() << "strength():" << m->strength();
155 qDebug() << "baseStation():" << m->baseStation();
167 QTest::qWait(120000);
171 void cleanupTestCase()
178 OfonoNetworkRegistration *m;
181 QTEST_MAIN(TestOfonoNetworkRegistration)
182 #include "test_ofononetworkregistration.moc"