[FSO] QT Dbus connection to Gypsy
Nicola Mfb
nicola.mfb at gmail.com
Tue Oct 28 15:08:11 CET 2008
2008/10/28 Michael Tansella <michael-tansella at gmx.de>
> > Are you extracting the data out of the
> > struct with the ">>" operators
>
> Thank you again for that hint:
>
> For interested the way I implemented it:
>
Here my snippet to read Phonebooks from sim:
struct PhonebookEntry
{
int index;
QString name;
QString number;
};
Q_DECLARE_METATYPE ( PhonebookEntry );
Q_DECLARE_METATYPE ( QList<PhonebookEntry> );
const QDBusArgument &operator>>(const QDBusArgument &argument,
PhonebookEntry &pe) {
argument.beginStructure();
argument >> pe.index >> pe.name >> pe.number;
argument.endStructure();
return argument;
}
const QDBusArgument &operator<<(QDBusArgument &argument, const
PhonebookEntry &pe) {
argument.beginStructure();
argument << pe.index << pe.name << pe.number;
argument.endStructure();
return argument;
}
qDBusRegisterMetaType<PhonebookEntry>(); //somewhere in the code
QDBusMessage m=gsm_sim->call ( "RetrievePhonebook","received" );
QList<PhonebookEntry> lpe=qdbus_cast<QList<PhonebookEntry>
>(m.arguments()[0]);
qDebug() <<lpe;
You may be interested to the following too:
const QDebug operator<<(QDebug debug, const PhonebookEntry &pe) {
debug << pe.index <<pe.number<< pe.name;
return debug;
}
const QDebug operator<<(QDebug debug, const QList<PhonebookEntry> &lpe) {
foreach(PhonebookEntry pe, lpe) debug << pe;
return debug;
}
Where to put this? fso/wiki? om/wiki?
Regards
Nicola
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/community/attachments/20081028/cd543ed7/attachment.htm
More information about the community
mailing list