update ofono API
Task-number: QTBUG-29381 Change-Id: I952b73d86b4e8f497b4ff90d10c1f5312882bd8a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
38f740e4de
commit
539a024819
@ -56,6 +56,22 @@
|
|||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
#ifndef QT_NO_BEARERMANAGEMENT
|
||||||
#ifndef QT_NO_DBUS
|
#ifndef QT_NO_DBUS
|
||||||
|
|
||||||
|
QDBusArgument &operator<<(QDBusArgument &argument, const ObjectPathProperties &item)
|
||||||
|
{
|
||||||
|
argument.beginStructure();
|
||||||
|
argument << item.path << item.properties;
|
||||||
|
argument.endStructure();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDBusArgument &operator>>(const QDBusArgument &argument, ObjectPathProperties &item)
|
||||||
|
{
|
||||||
|
argument.beginStructure();
|
||||||
|
argument >> item.path >> item.properties;
|
||||||
|
argument.endStructure();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent)
|
QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent)
|
||||||
@ -64,6 +80,8 @@ QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent)
|
|||||||
OFONO_MANAGER_INTERFACE,
|
OFONO_MANAGER_INTERFACE,
|
||||||
QDBusConnection::systemBus(), parent)
|
QDBusConnection::systemBus(), parent)
|
||||||
{
|
{
|
||||||
|
qDBusRegisterMetaType<ObjectPathProperties>();
|
||||||
|
qDBusRegisterMetaType<PathPropertiesList>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QOfonoManagerInterface::~QOfonoManagerInterface()
|
QOfonoManagerInterface::~QOfonoManagerInterface()
|
||||||
@ -72,8 +90,16 @@ QOfonoManagerInterface::~QOfonoManagerInterface()
|
|||||||
|
|
||||||
QList <QDBusObjectPath> QOfonoManagerInterface::getModems()
|
QList <QDBusObjectPath> QOfonoManagerInterface::getModems()
|
||||||
{
|
{
|
||||||
QVariant var = getProperty("Modems");
|
QList <QDBusObjectPath> modemList;
|
||||||
return qdbus_cast<QList<QDBusObjectPath> >(var);
|
QList<QVariant> argumentList;
|
||||||
|
QDBusReply<PathPropertiesList > reply = this->asyncCallWithArgumentList(QLatin1String("GetModems"), argumentList);
|
||||||
|
if (reply.isValid()) {
|
||||||
|
foreach (ObjectPathProperties modem, reply.value()) {
|
||||||
|
modemList << modem.path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return modemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusObjectPath QOfonoManagerInterface::currentModem()
|
QDBusObjectPath QOfonoManagerInterface::currentModem()
|
||||||
@ -81,7 +107,7 @@ QDBusObjectPath QOfonoManagerInterface::currentModem()
|
|||||||
QList<QDBusObjectPath> modems = getModems();
|
QList<QDBusObjectPath> modems = getModems();
|
||||||
foreach (const QDBusObjectPath &modem, modems) {
|
foreach (const QDBusObjectPath &modem, modems) {
|
||||||
QOfonoModemInterface device(modem.path());
|
QOfonoModemInterface device(modem.path());
|
||||||
if(device.isPowered() && device.isOnline())
|
if (device.isPowered() && device.isOnline())
|
||||||
return modem;;
|
return modem;;
|
||||||
}
|
}
|
||||||
return QDBusObjectPath();
|
return QDBusObjectPath();
|
||||||
@ -92,7 +118,7 @@ void QOfonoManagerInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
{
|
{
|
||||||
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoManagerInterface::propertyChanged);
|
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoManagerInterface::propertyChanged);
|
||||||
if (signal == propertyChangedSignal) {
|
if (signal == propertyChangedSignal) {
|
||||||
if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
QLatin1String(OFONO_MANAGER_PATH),
|
QLatin1String(OFONO_MANAGER_PATH),
|
||||||
QLatin1String(OFONO_MANAGER_INTERFACE),
|
QLatin1String(OFONO_MANAGER_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -140,7 +166,7 @@ QVariant QOfonoManagerInterface::getProperty(const QString &property)
|
|||||||
QVariantMap QOfonoManagerInterface::getProperties()
|
QVariantMap QOfonoManagerInterface::getProperties()
|
||||||
{
|
{
|
||||||
QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
|
QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
|
||||||
if(reply.isValid())
|
if (reply.isValid())
|
||||||
return reply.value();
|
return reply.value();
|
||||||
else
|
else
|
||||||
return QVariantMap();
|
return QVariantMap();
|
||||||
@ -234,7 +260,7 @@ QStringList QOfonoModemInterface::getInterfaces()
|
|||||||
|
|
||||||
QString QOfonoModemInterface::defaultInterface()
|
QString QOfonoModemInterface::defaultInterface()
|
||||||
{
|
{
|
||||||
foreach(const QString &modem,getInterfaces()) {
|
foreach (const QString &modem,getInterfaces()) {
|
||||||
return modem;
|
return modem;
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
@ -245,7 +271,7 @@ void QOfonoModemInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
{
|
{
|
||||||
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoModemInterface::propertyChanged);
|
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoModemInterface::propertyChanged);
|
||||||
if (signal == propertyChangedSignal) {
|
if (signal == propertyChangedSignal) {
|
||||||
if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_MODEM_INTERFACE),
|
QLatin1String(OFONO_MODEM_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -363,15 +389,23 @@ QString QOfonoNetworkRegistrationInterface::getBaseStation()
|
|||||||
|
|
||||||
QList <QDBusObjectPath> QOfonoNetworkRegistrationInterface::getOperators()
|
QList <QDBusObjectPath> QOfonoNetworkRegistrationInterface::getOperators()
|
||||||
{
|
{
|
||||||
QVariant var = getProperty("Operators");
|
QList <QDBusObjectPath> operatorList;
|
||||||
return qdbus_cast<QList <QDBusObjectPath> >(var);
|
QList<QVariant> argumentList;
|
||||||
|
QDBusReply<PathPropertiesList > reply = this->asyncCallWithArgumentList(QLatin1String("GetOperators"),
|
||||||
|
argumentList);
|
||||||
|
if (reply.isValid()) {
|
||||||
|
foreach (ObjectPathProperties netop, reply.value()) {
|
||||||
|
operatorList << netop.path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return operatorList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QOfonoNetworkRegistrationInterface::connectNotify(const QMetaMethod &signal)
|
void QOfonoNetworkRegistrationInterface::connectNotify(const QMetaMethod &signal)
|
||||||
{
|
{
|
||||||
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkRegistrationInterface::propertyChanged);
|
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkRegistrationInterface::propertyChanged);
|
||||||
if (signal == propertyChangedSignal) {
|
if (signal == propertyChangedSignal) {
|
||||||
if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_NETWORK_REGISTRATION_INTERFACE),
|
QLatin1String(OFONO_NETWORK_REGISTRATION_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -473,7 +507,7 @@ void QOfonoNetworkOperatorInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
Q_UNUSED(signal);
|
Q_UNUSED(signal);
|
||||||
// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkOperatorInterface::propertyChanged);
|
// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkOperatorInterface::propertyChanged);
|
||||||
// if (signal == propertyChangedSignal) {
|
// if (signal == propertyChangedSignal) {
|
||||||
// if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
// if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
// this->path(),
|
// this->path(),
|
||||||
// QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE),
|
// QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE),
|
||||||
// QLatin1String("PropertyChanged"),
|
// QLatin1String("PropertyChanged"),
|
||||||
@ -581,7 +615,7 @@ void QOfonoSimInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
Q_UNUSED(signal);
|
Q_UNUSED(signal);
|
||||||
// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSimInterface::propertyChanged);
|
// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSimInterface::propertyChanged);
|
||||||
// if (signal == propertyChangedSignal) {
|
// if (signal == propertyChangedSignal) {
|
||||||
// if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
// if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
// this->path(),
|
// this->path(),
|
||||||
// QLatin1String(OFONO_SIM_MANAGER_INTERFACE),
|
// QLatin1String(OFONO_SIM_MANAGER_INTERFACE),
|
||||||
// QLatin1String("PropertyChanged"),
|
// QLatin1String("PropertyChanged"),
|
||||||
@ -648,8 +682,16 @@ QOfonoDataConnectionManagerInterface::~QOfonoDataConnectionManagerInterface()
|
|||||||
|
|
||||||
QList<QDBusObjectPath> QOfonoDataConnectionManagerInterface::getPrimaryContexts()
|
QList<QDBusObjectPath> QOfonoDataConnectionManagerInterface::getPrimaryContexts()
|
||||||
{
|
{
|
||||||
QVariant var = getProperty("PrimaryContexts");
|
QList <QDBusObjectPath> contextList;
|
||||||
return qdbus_cast<QList<QDBusObjectPath> >(var);
|
QList<QVariant> argumentList;
|
||||||
|
QDBusReply<PathPropertiesList > reply = this->asyncCallWithArgumentList(QLatin1String("GetContexts"),
|
||||||
|
argumentList);
|
||||||
|
if (reply.isValid()) {
|
||||||
|
foreach (ObjectPathProperties context, reply.value()) {
|
||||||
|
contextList << context.path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return contextList;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QOfonoDataConnectionManagerInterface::isAttached()
|
bool QOfonoDataConnectionManagerInterface::isAttached()
|
||||||
@ -675,7 +717,7 @@ void QOfonoDataConnectionManagerInterface::connectNotify(const QMetaMethod &sign
|
|||||||
Q_UNUSED(signal);
|
Q_UNUSED(signal);
|
||||||
// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoDataConnectionManagerInterface::propertyChanged);
|
// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoDataConnectionManagerInterface::propertyChanged);
|
||||||
// if (signal == propertyChangedSignal) {
|
// if (signal == propertyChangedSignal) {
|
||||||
// if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
// if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
// this->path(),
|
// this->path(),
|
||||||
// QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE),
|
// QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE),
|
||||||
// QLatin1String("PropertyChanged"),
|
// QLatin1String("PropertyChanged"),
|
||||||
@ -799,7 +841,7 @@ void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
Q_UNUSED(signal);
|
Q_UNUSED(signal);
|
||||||
// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged);
|
// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged);
|
||||||
// if (signal == propertyChangedSignal) {
|
// if (signal == propertyChangedSignal) {
|
||||||
// if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
// if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
// this->path(),
|
// this->path(),
|
||||||
// QLatin1String(OFONO_DATA_CONTEXT_INTERFACE),
|
// QLatin1String(OFONO_DATA_CONTEXT_INTERFACE),
|
||||||
// QLatin1String("PropertyChanged"),
|
// QLatin1String("PropertyChanged"),
|
||||||
@ -861,7 +903,7 @@ bool QOfonoPrimaryDataContextInterface::setProp(const QString &property, const Q
|
|||||||
QLatin1String("SetProperty"),
|
QLatin1String("SetProperty"),
|
||||||
args);
|
args);
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
if(reply.type() != QDBusMessage::ReplyMessage) {
|
if (reply.type() != QDBusMessage::ReplyMessage) {
|
||||||
qWarning() << reply.errorMessage();
|
qWarning() << reply.errorMessage();
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
@ -885,7 +927,7 @@ void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
{
|
{
|
||||||
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::propertyChanged);
|
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::propertyChanged);
|
||||||
if (signal == propertyChangedSignal) {
|
if (signal == propertyChangedSignal) {
|
||||||
if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
|
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -912,7 +954,7 @@ void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
|
|
||||||
static const QMetaMethod immediateMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::immediateMessage);
|
static const QMetaMethod immediateMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::immediateMessage);
|
||||||
if (signal == immediateMessageSignal) {
|
if (signal == immediateMessageSignal) {
|
||||||
if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
|
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
|
||||||
QLatin1String("ImmediateMessage"),
|
QLatin1String("ImmediateMessage"),
|
||||||
@ -923,7 +965,7 @@ void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
|
|
||||||
static const QMetaMethod incomingMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::incomingMessage);
|
static const QMetaMethod incomingMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::incomingMessage);
|
||||||
if (signal == incomingMessageSignal) {
|
if (signal == incomingMessageSignal) {
|
||||||
if(!connection().connect(QLatin1String(OFONO_SERVICE),
|
if (!connection().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
|
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
|
||||||
QLatin1String("IncomingMessage"),
|
QLatin1String("IncomingMessage"),
|
||||||
|
@ -88,6 +88,14 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
struct ObjectPathProperties
|
||||||
|
{
|
||||||
|
QDBusObjectPath path;
|
||||||
|
QVariantMap properties;
|
||||||
|
};
|
||||||
|
typedef QList<ObjectPathProperties> PathPropertiesList;
|
||||||
|
Q_DECLARE_METATYPE(ObjectPathProperties)
|
||||||
|
Q_DECLARE_METATYPE (PathPropertiesList)
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user